SHARE
TWEET

add_users -- TazPup -- File System

s243a Mar 6th, 2019 (edited) 120 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. users=$1
  3. if [ -z "$1" ]; then
  4.     users='tux,root,spot:jwm'
  5. fi
  6. for line in ${users//,/ }; do
  7.   line2=(${line//:/ }) #https://stackoverflow.com/questions/918886/how-do-i-split-a-string-on-a-delimiter-in-bash
  8.   USER=${line2[0]}
  9.   wm="${line2[1]}"
  10.   WINDOW_MANAGER=${wm:-slim}
  11.  
  12.   if [ "$USER" != root ]; then
  13.     adduser -D -s /bin/sh -g 'SliTaz User' -G users -h /home/$USER $USER 2>/dev/null
  14.     passwd -d $USER 2>/dev/null
  15.     for group in audio cdrom video tty plugdev disk lp scanner dialout camera operator tape
  16.     do
  17.       addgroup $USER $group 2>/dev/null
  18.     done
  19.  
  20.     #https://www.pearltrees.com/s243a/startup-script-for-freenet/id14245425
  21.  
  22.     if [ "$(which hald)" != "" ] && [ -e /etc/init.d/hald ]; then
  23.       #action 'Configuring %s...' "haldaemon"
  24.       adduser -D -H haldaemon 2>/dev/null
  25.       for group in audio cdrom video tty plugdev disk lp scanner dialout camera operator tape
  26.       do
  27.         addgroup haldaemon $group 2>/dev/null
  28.       done
  29.       addgroup haldaemon haldaemon 2>/dev/null
  30.     fi
  31.   fi
  32.     ## Slim default user #TODO make spot have the default window manager jwm instead of slim.
  33.     #if [ -f /etc/slim.conf ]; then
  34.     #   sed -i "s|default_user .*|default_user    $USER|" /etc/slim.conf
  35.     #fi
  36.     #su -c "sh tazx start" $USER #
  37.     if [ $WINDOW_MANAGER = "jwm" ]; then  
  38.       usr_home=`su -c "echo $HOME" $USER`
  39.       ( export HOME=$USR_HOME; fixmenus ) #TODO update fixmenus so that it only updates files for a single user.
  40.     else
  41.       su -c "sh tazbox mkmenu" $USER #
  42.     fi      
  43. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top