Page MenuHomeDevCentral
Paste P237

/home/dereckson/bin/newuser
ActivePublic

Authored by dereckson on Jan 16 2017, 10:04.
Tags
None
Referenced Files
F277710: /home/dereckson/bin/newuser
Jan 16 2017, 10:04
Subscribers
None
#!/bin/sh
ARC=arc
SHELLUSERS=pillar/users/shellusers.sls
if [ $# -ne 1 ]
then
echo "Usage: `basename $0` <username>"
exit 1
fi
ACCOUNT=$1
if [ ! -f $SHELLUSERS ]
then
echo "You must run this at the top of a rOPS working copy."
exit 2
fi
LASTUID=`grep 'uid: 2' $SHELLUSERS | sort | tail -n 1 | awk '{print $2}'`
NEWUID=`expr $LASTUID + 1`
echo " $ACCOUNT:" >> $SHELLUSERS
echo " fullname: $ACCOUNT" >> $SHELLUSERS
echo " uid: $NEWUID" >> $SHELLUSERS
$EDITOR $SHELLUSERS
$EDITOR roles/shellserver/users/files/ssh_keys/$ACCOUNT
arc feature account/$ACCOUNT
git status

Event Timeline

dereckson changed the title of this paste from untitled to /home/dereckson/bin/newuser.
dereckson updated the paste's language from autodetect to autodetect.