|
|
DataMuseum.dkPresents historical artifacts from the history of: RC9000 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about RC9000 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: @ T m
Length: 1669 (0x685)
Types: TextFile
Notes: @(#)mkccu.sh 13.2 (RC International) 91/12/27
Names: »mkccu«
└─⟦50656ff4a⟧ Bits:30010538 TX 3.1 Coldstart
└─⟦bbf173f5c⟧ »0004«
└─⟦this⟧ »./etc/mkccu«
#! /bin/sh
#
# @(#)mkccu.sh 13.2 (RC International) 91/12/27
#
# Make an entry in the password file and a home directory for
# the specified Communication Control Unit
#
umask 0
case $# in
3) CUDIR=$1; USER=$2; HOMEDIR=$CUDIR/$3;;
*) echo Usage: $0 main_directory FTS_user_name unit_name 1>&2 ; exit 1 ;;
esac
USR_NO_FILE=/etc/.mkccu_user_no
if test ! -s $USR_NO_FILE
then
echo "$USR_NO_FILE does not exist."
exit 2
fi
if [ `id | cut -c1-6` != "uid=0(" ] ; then
echo Must be root to execute this script
exit 2
fi
USR=""
while test -z "$USR"
do
x=`cat $USR_NO_FILE`
echo 0 $x 1 + p | dc > $USR_NO_FILE
USR=`cat $USR_NO_FILE`
cut -f3-5 -d: /etc/passwd |\
grep -s "^$USR:"
if test "$?" -eq "0"
then
USR=""
fi
done
GRP=4;
NAME="Load user control Unit $3"
FTSPATH=.ftspath
if [ ! -d $CUDIR ]
then
echo $0: Main directory $CUDIR does not exit
exit 2
fi
if PASSWD=`grep "^$USER:" /etc/passwd`
then
echo $0: FTS user name already in password file
exit 2
fi
if [ -d $HOMEDIR ]
then
echo $0: Unit directory $HOMEDIR exists already
exit 2
fi
/usr/sbin/passmgmt -a -c"$NAME" -h$HOMEDIR -u$USR -g$GRP -s/etc/keepaway $USER
/bin/passwd -d $USER
echo FTS user $USER \(userno=$USR,grpno=$GRP\) inserted in password file
mkdir $HOMEDIR
if [ $? = 0 ]
then
chmod 755 $HOMEDIR
chown $USR $HOMEDIR
chgrp $GRP $HOMEDIR
echo Home directory $HOMEDIR created for user $USER
else
echo "$0: Can't create home directory $HOMEDIR for $USER"
exit 2
fi
cd $HOMEDIR
echo "PATH=$CUDIR" > $FTSPATH
chmod 755 $FTSPATH
chown $USR $FTSPATH
echo $FTSPATH created in $HOMEDIR