summaryrefslogtreecommitdiff
path: root/configs/profile/root-image/root/.session/install/chroot-login.sh
blob: 83ab24844554b6c115e02689ff4b63b22703ac46 (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
#!/bin/bash

source /root/session-common.sh.inc


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


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


## main entry ##

# register unprivileged user
Login=$(GetStateVar 'USER_LOGIN')
Pass=$(openssl passwd $(GetStateVar 'USER_PASS'))
useradd -m -g users -G 'wheel' -s /bin/bash -p ${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