Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- elif [ "$CURRENT_SELECTION" = "User-Name" ]; then
- if [ $(id -u) -eq 0 ]; then
- DIALOG --inputbox "Enter username : " 25 100 {username}
- DIALOG --inputbox "Enter password : " 25 100 {password}
- chroot ${DESTDIR} egrep "^$username" /etc/passwd >/dev/null
- if [ $? -eq 0 ]; then
- DIALOG --msgbox "$username exists!" 25 100
- exit 1
- else
- pass=$(perl -e'print crypt("$password", "aa")')
- chroot ${DESTDIR} useradd -m -G adm,wheel,floppy,scanner,power,locate,camera,storage,optical,audio,video,network,avahi -p $pass $username
- cp -r /etc/skel/* ${DESTDIR}/home/$username
- [ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!"
- fi
- else
- DIALOG --msgbox "Only root may add a user to the system" 25 100
- exit 2
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement