diff options
author | bill-auger <mr.j.spam.me@gmail.com> | 2022-08-16 06:57:05 -0400 |
---|---|---|
committer | bill-auger <mr.j.spam.me@gmail.com> | 2022-08-17 06:37:01 -0400 |
commit | 3741a9c3b9a50c1b7e88cf4b6b78595bf9b8aece (patch) | |
tree | 27991604648d301054f35c1e55af8f550d7696fe | |
parent | ba27cba2a145723e8e34f1b612927b112f7cff28 (diff) |
housekeeping
-rw-r--r-- | chroot-environment.sh | 29 | ||||
-rw-r--r-- | chroot-login.sh | 26 | ||||
-rw-r--r-- | chroot-services.sh | 18 | ||||
-rwxr-xr-x | install.sh | 13 |
4 files changed, 50 insertions, 36 deletions
diff --git a/chroot-environment.sh b/chroot-environment.sh index 32f8e89..2a950c8 100644 --- a/chroot-environment.sh +++ b/chroot-environment.sh @@ -32,36 +32,45 @@ source /root/session-common.sh.inc +readonly HOSTNAME=$(GetStateVar 'HOSTNAME') +readonly TIMEZONE=$(GetStateVar 'TIMEZONE') +readonly KEYMAP=$( GetStateVar 'KEYMAP' ) +readonly LOCALES=$( GetStateVar 'LOCALES' ) +readonly LANG=$( GetStateVar 'LANG' ) +readonly DEVICE=$( GetStateVar 'DEVICE' ) +readonly BOOT=$( GetStateVar 'BOOT' ) +readonly WMDE=$( GetStateVar 'WMDE' ) +readonly THEME_DIR=$( [[ "${Wmde}" == 'cli' ]] && echo GNUAxiom || echo parabola-laf ) + + # configure hostname -echo $(GetStateVar 'HOSTNAME') > /etc/hostname +echo ${HOSTNAME} > /etc/hostname # configure timezone -ln -sf /usr/share/zoneinfo/$(GetStateVar 'TIMEZONE') /etc/localtime +ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime # configure keymap -echo "KEYMAP=$(GetStateVar 'KEYMAP')" > /etc/vconsole.conf +echo "KEYMAP=${KEYMAP}" > /etc/vconsole.conf # configure locales -for locale in $(GetStateVar 'LOCALES') +for locale in ${LOCALES} do sed -i "s|^#${locale} |${locale} |" /etc/locale.gen done locale-gen # configure language -echo "LANG=$(GetStateVar 'LANG')" > /etc/locale.conf +echo "LANG=${LANG}" > /etc/locale.conf # prepare initrd mkinitcpio -p linux-libre # install and configure GRUB -if [[ "$(GetStateVar 'BOOT')" == 'grub' ]] -then device=$(GetStateVar 'DEVICE') - grub-install ${device} +if [[ "${BOOT}" == 'grub' ]] +then grub-install ${DEVICE} grub-mkconfig -o /boot/grub/grub.cfg # enable Parabola GRUB theme - theme_dir=$([[ "$(GetStateVar 'WMDE')" == 'cli' ]] && echo GNUAxiom || echo parabola-laf) - sed -i "$GRUB_THEME_SED_RX ; s|_THEME_DIR_|${theme_dir}|" /etc/default/grub + sed -i "$GRUB_THEME_SED_RX ; s|_THEME_DIR_|${THEME_DIR}|" /etc/default/grub fi exit diff --git a/chroot-login.sh b/chroot-login.sh index 13a959b..62fb06d 100644 --- a/chroot-login.sh +++ b/chroot-login.sh @@ -34,35 +34,35 @@ source /root/session-common.sh.inc readonly WHEEL_SUDOERS_SED_CMD='s|[#] [%]wheel ALL=[(]ALL[)] ALL|%wheel ALL=(ALL) ALL|' +readonly USER_LOGIN=$(GetStateVar 'USER_LOGIN') +readonly USER_PASS=$( GetStateVar 'USER_PASS' ) +readonly KEYMAP=$( GetStateVar 'XKBMAP' ) +readonly WMDE=$( GetStateVar 'WMDE' ) GsettingsSet() # (kvp) { - sudo -u ${Login} gsettings set $* + sudo -u ${USER_LOGIN} gsettings set $* } ## main entry ## # configure root login -usermod -p $(GetStateVar 'ROOT_PASS') root +usermod -p ${ROOT_PASS} root -# check for the signal to bypass user creation -[[ "$(GetStateVar 'USER_LOGIN')" != 'NONE' ]] && -[[ "$(GetStateVar 'USER_PASS' )" != 'NONE' ]] || exit 0 +# check for the 'NONE' flag, to bypass user creation +[[ "${USER_LOGIN}" != 'NONE' ]] && +[[ "${USER_PASS}" != 'NONE' ]] || exit 0 # register unprivileged user -Login=$(GetStateVar 'USER_LOGIN') -Pass=$(GetStateVar 'USER_PASS') -useradd -m -g users -G 'wheel' -s /bin/bash -p ${Pass} ${Login} +useradd -m -g users -G 'wheel' -s /bin/bash -p ${USER_PASS} ${USER_LOGIN} # set keymap -Keymap=$(GetStateVar 'XKBMAP') -echo "setxkbmap ${Keymap}" >> /home/${Login}/.bashrc +echo "setxkbmap ${KEYMAP}" >> /home/${USER_LOGIN}/.bashrc # configure desktop environment -wmde=$(GetStateVar 'WMDE') -if [[ "${wmde}" == 'mate' && -x /usr/bin/gsettings ]] +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' @@ -80,6 +80,6 @@ then if [[ -d /usr/share/themes/Radiance-Purple ]] fi # allow members of group wheel to execute any command -sed -i "$WHEEL_SUDOERS_SED_CMD" /etc/sudoers +sed -i "$WHEEL_SUDOERS_SED_RX" /etc/sudoers exit diff --git a/chroot-services.sh b/chroot-services.sh index c8d5871..757dc25 100644 --- a/chroot-services.sh +++ b/chroot-services.sh @@ -32,10 +32,12 @@ source /root/session-common.sh.inc -Init=$(GetStateVar 'INIT') -Wmde=$(GetStateVar 'WMDE') -if [[ "${Init}" == 'openrc' ]] -then # Create the dbus user if it doesn't exist +readonly INIT=$(GetStateVar 'INIT') +readonly WMDE=$(GetStateVar 'WMDE') + + +if [[ "${INIT}" == 'openrc' ]] +then # Create the 'dbus' user if it doesn't exist grep dbus /etc/group > /dev/null || groupadd -g 81 dbus grep dbus /etc/passwd > /dev/null || useradd -g 81 -u 81 dbus -r -s /sbin/nologin @@ -43,10 +45,14 @@ then # Create the dbus user if it doesn't exist rc-update add alsasound default rc-update add dbus default rc-update add NetworkManager default -elif [[ "${Init}" == 'systemd' ]] - case "${Wmde}" in + +elif [[ "${INIT}" == 'systemd' ]] +then # Enable services with systemd + case "${WMDE}" in 'lxde') systemctl enable 'NetworkManager.service' 'lxdm.service' ;; 'mate') systemctl enable 'NetworkManager.service' 'lightdm.service' ;; * ) systemctl enable 'dhcpcd.service' 'systemd-resolved.service' ;; esac fi + +exit @@ -57,8 +57,9 @@ readonly GRUB_THEME_SED_CMD='s|^#GRUB_THEME=.*|GRUB_THEME=/boot/grub/themes/para NoticeIntro() { # checks to skip this notice per preset config - # NOTE: 'READY' is the signal for unattended install, per a preset config. + # NOTE: The 'READY' key is the flag for unattended install. # This program will not set the 'READY' state var. + # Preset configs must specify it explicitly. AreConfiguredStateVars 'READY' || WizardDlg "${TR[dlg_intro-${Lang}]}" --msgbox "${TR[notice_intro-${Lang}]}" 0 0 } @@ -172,9 +173,7 @@ SelectLogins() # MOCK_SELECTLOGINS ; return 0 ; # checks to skip this stage per preset or partial config - for state_var in ${STATEVARS_LOGINS[*]} - do ! ValidateId "$(GetStateVar ${state_var})" || return 0 - done + ! AreConfiguredStateVars ${STATEVARS_LOGINS[*]} || return 0 # prompt for root user password local pass @@ -186,8 +185,8 @@ SelectLogins() # prompt to create an unprivileged user login local dlg_title="${TR[dlg_user-${Lang}]}" if ! (( $( WizardDlg "${dlg_title}" --yesno "${TR[user-${Lang}]}" 8 56 ) )) - then SetStateVar 'USER_LOGIN' 'NONE' # signal no user creation - SetStateVar 'USER_PASS' 'NONE' # signal no user creation + then SetStateVar 'USER_LOGIN' 'NONE' # flag no user creation + SetStateVar 'USER_PASS' 'NONE' # flag no user creation return 0 fi @@ -622,7 +621,7 @@ ConfigChroot() arch-chroot /mnt /root/chroot-services.sh # configure services } -NoticeDone() { WizardDlg "" --msgbox "${TR[notice_done-${Lang}]}" 0 0 ; } +NoticeDone() { WizardDlg "" --msgbox "${TR[notice_done-${Lang}]}" 8 56 ; } Cleanup() { |