summaryrefslogtreecommitdiff
path: root/configs/profile/root-image/root/.session/install/chroot-login.sh
blob: 203a3566d2dcdb9350d7dc98d795a912cc041b5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash

source /root/session-common.sh.inc


readonly WHEEL_SUDOERS_SED_CMD='s|[#] [%]wheel ALL=[(]ALL[)] ALL|%wheel ALL=(ALL) ALL|'


ValidateLogin() { Login=$(tr -d '[:space:]' <<<${Login}) ; [[ -n "${Login}" ]] ; } # TODO:

GsettingsSet() # (kvp)
{
  sudo -u ${Login} gsettings set $*
}


## main entry ##

DlgTitle=$( ${TR[dlg_user-${TR_KEY}]/*) }

# create unprivileged user
Login=''
until ValidateLogin
do    Login=$( WizardDlg "${DlgTitle}"                                 \
                         --inputbox "${TR[user_login-${TR_KEY}]}" 8 40 )
done
Pass='changeme' Pass2=''
while [[ "${Pass}" != "${Pass2}" ]]
do    Pass=$(  WizardDlg "${DlgTitle}"                                                \
                         --passwordbox "${TR[user_pass-${TR_KEY}]} '${Login}':"  8 40 )
      Pass2=$( WizardDlg "${DlgTitle}"                                                \
                         --passwordbox "${TR[user_pass2-${TR_KEY}]} '${Login}':" 8 40 )
done
useradd -m -g users -G 'wheel' -s /bin/bash -p $(openssl passwd ${Pass}) ${Login}

# set keymap
Keymap=$(GetStateVar 'XKBMAP')
echo "setxkbmap ${Keymap}" >> /home/${Login}/.bashrc

# configure desktop environment
wmde=$(GetStateVar 'WMDE')
if   [[ "${wmde}" == 'mate' && -x /usr/bin/gsettings ]]
then if   [[ -d /usr/share/themes/Radiance-Purple ]]
     then GsettingsSet org.mate.interface gtk-theme            'Radiance-Purple'
          GsettingsSet org.mate.Marco.general theme            'Radiance-Purple'
     fi
     if   [[ -d /usr/share/icons/RAVE-X-Dark-Purple ]]
     then GsettingsSet org.mate.interface icon-theme           'RAVE-X-Dark-Purple'
     fi
     if   [[ -d /usr/share/icons/mate ]]
     then GsettingsSet org.mate.peripherals-mouse cursor-size  '18'
          GsettingsSet org.mate.peripherals-mouse cursor-theme 'mate'
     fi
     if   [[ -f /usr/share/backgrounds/parabola-laf/parabola-laf.png ]]
     then GsettingsSet org.mate.background picture-filename    '/usr/share/backgrounds/parabola-laf/parabola-laf.png'
     fi
fi

# allow members of group wheel to execute any command
sed -i "$WHEEL_SUDOERS_SED_CMD" /etc/sudoers

exit