summaryrefslogtreecommitdiff
path: root/configs/profile/root-image
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2017-11-17 12:11:20 -0500
committerbill-auger <mr.j.spam.me@gmail.com>2020-03-27 18:06:02 -0400
commit58f2f96f1d69bdcc9e7f8be4715b54118d89ae37 (patch)
tree115b6dc8230f549e899a8c7281c2cb733e6facb3 /configs/profile/root-image
parentf3695f93d991c12b0ecdf0afe8129ea7b08d8e29 (diff)
refactor chroot customization script
Diffstat (limited to 'configs/profile/root-image')
-rw-r--r--configs/profile/root-image/root/customize_root_image-constants.inc53
-rwxr-xr-xconfigs/profile/root-image/root/customize_root_image-dev.sh2
-rwxr-xr-xconfigs/profile/root-image/root/customize_root_image.sh78
3 files changed, 70 insertions, 63 deletions
diff --git a/configs/profile/root-image/root/customize_root_image-constants.inc b/configs/profile/root-image/root/customize_root_image-constants.inc
new file mode 100644
index 0000000..e2d3fc1
--- /dev/null
+++ b/configs/profile/root-image/root/customize_root_image-constants.inc
@@ -0,0 +1,53 @@
+readonly LOCALES="en_US\.UTF-8 \
+ eo \
+ es_ES\.UTF-8 \
+ fr_FR\.UTF-8 \
+ gl_ES\.UTF-8 \
+ it_IT\.UTF-8 \
+ pt_BR\.UTF-8 \
+ pl_PL\.UTF-8 "
+readonly REPOS='libre core extra community pcr'
+readonly SYSTEMD_DELETE_FILES="/etc/conf.d/agetty.tty1 \
+ /etc/conf.d/hostname \
+ /etc/init.d/pacman-init \
+ /etc/X11/Xwrapper.config"
+readonly OPENRC_DELETE_FILES="/etc/hostname \
+ /etc/systemd/scripts/choose-mirror \
+ /etc/systemd/system/choose-mirror.service \
+ /etc/systemd/system/etc-pacman.d-gnupg.mount \
+ /etc/systemd/system/getty@tty1.service.d/autologin.conf \
+ /etc/systemd/system/pacman-init.service "
+readonly SYSTEMD_SERVICES_ALL="choose-mirror.service \
+ multi-user.target \
+ pacman-init.service "
+readonly SYSTEMD_SERVICES_GUI="NetworkManager.service"
+readonly OPENRC_SERVICES_ALL="dbus \
+ haveged \
+ NetworkManager \
+ pacman-init "
+readonly OPENRC_SERVICES_GUI="alsasound \
+ elogind "
+[[ "${iso_gui}" == 'cli' ]] && readonly OPENRC_SERVICES="${OPENRC_SERVICES_ALL}" ||
+ readonly OPENRC_SERVICES="${OPENRC_SERVICES_ALL} ${OPENRC_SERVICES_GUI}"
+[[ "${iso_gui}" == 'cli' ]] && readonly SYSTEMD_SERVICES="${SYSTEMD_SERVICES_ALL}" ||
+ readonly SYSTEMD_SERVICES="${SYSTEMD_SERVICES_ALL} ${SYSTEMD_SERVICES_GUI}"
+readonly DEFAULT_SHELL=/bin/bash
+readonly NETINSTALL_MSG="To install Parabola, the system must be connected to the internet."
+readonly COMPLETE_MSG="This ISO is capable of installing a complete Parabola system\n\
+>>>>without a connection to the internet. If you would like to fetch\n\
+>>>>the latest packages from the internet, run the following command\n\
+>>>>before beginning the install:\n\
+ # cp /etc/pacman-online.conf /etc/pacman.conf"
+[ "${enable_offline_install}" == 'false' ] && readonly NETWORK_MOTD_MSG=${NETINSTALL_MSG} || \
+ readonly NETWORK_MOTD_MSG=${COMPLETE_MSG}
+readonly ROOT_SKEL_FILES="/etc/skel/.automated_script.sh \
+ /etc/skel/.bash_logout \
+ /etc/skel/.bash_profile "
+readonly LIVE_USER=parabola
+readonly LIVE_USER_GROUPS="adm,audio,floppy,log,network,rfkill,scanner,storage,optical,power,wheel"
+readonly OPENRC_USER_GROUPS="disk,sys"
+[[ "${iso_init}" == 'openrc' ]] && readonly USER_GROUPS="${LIVE_USER_GROUPS},${OPENRC_USER_GROUPS}" ||
+ readonly USER_GROUPS="${LIVE_USER_GROUPS}"
+[ "${enable_offline_install}" == 'true' ] && readonly INSTALL_TYPE="Complete" || \
+ readonly INSTALL_TYPE="NetInstall"
+readonly WELCOME_TITLE="Parabola ${iso_init}/${iso_gui} Edition - (${INSTALL_TYPE})"
diff --git a/configs/profile/root-image/root/customize_root_image-dev.sh b/configs/profile/root-image/root/customize_root_image-dev.sh
index e68d41c..5b13ab1 100755
--- a/configs/profile/root-image/root/customize_root_image-dev.sh
+++ b/configs/profile/root-image/root/customize_root_image-dev.sh
@@ -1,3 +1,5 @@
+[[ "${iso_gui}" == 'cli' ]] && exit 0
+
sed -i 's|^Terminal=.*$|Terminal=true|' /home/${LIVE_USER}/Desktop/parabola-installer.desktop
echo 'X-KeepTerminal=true' >> /home/${LIVE_USER}/Desktop/parabola-installer.desktop
diff --git a/configs/profile/root-image/root/customize_root_image.sh b/configs/profile/root-image/root/customize_root_image.sh
index c602220..a98e18a 100755
--- a/configs/profile/root-image/root/customize_root_image.sh
+++ b/configs/profile/root-image/root/customize_root_image.sh
@@ -1,51 +1,15 @@
#!/bin/bash
readonly DEV_RELEASE=1 # 1 for development builds - 0 for production builds
-readonly REPOS='libre core extra community pcr'
-readonly SYSTEMD_SERVICES_ALL="choose-mirror.service \
- multi-user.target \
- pacman-init.service "
-readonly SYSTEMD_SERVICES_GUI="NetworkManager.service"
-readonly OPENRC_SERVICES_ALL="dbus \
- haveged \
- NetworkManager \
- pacman-init "
-readonly OPENRC_SERVICES_GUI="alsasound \
- elogind "
-readonly DEFAULT_SHELL=/bin/bash
-readonly NETINSTALL_MSG="To install Parabola, the system must be connected to the internet."
-readonly COMPLETE_MSG="This ISO is capable of installing a complete Parabola system\n\
->>>>without a connection to the internet. If you would like to fetch\n\
->>>>the latest packages from the internet, run the following command\n\
->>>>before beginning the install:\n\
- # cp /etc/pacman-online.conf /etc/pacman.conf"
-[ "${enable_offline_install}" == 'false' ] && readonly NETWORK_MOTD_MSG=${NETINSTALL_MSG} || \
- readonly NETWORK_MOTD_MSG=${COMPLETE_MSG}
-readonly ROOT_SKEL_FILES="/etc/skel/.automated_script.sh \
- /etc/skel/.bash_logout \
- /etc/skel/.bash_profile "
-readonly LIVE_USER=parabola
-readonly LIVE_USER_GROUPS="adm,audio,floppy,log,network,rfkill,scanner,storage,optical,power,wheel"
-readonly OPENRC_USER_GROUPS="disk,sys"
-[[ "${iso_init}" == 'openrc' ]] && readonly USER_GROUPS="${LIVE_USER_GROUPS},${OPENRC_USER_GROUPS}" ||
- readonly USER_GROUPS="${LIVE_USER_GROUPS}"
-[ "${enable_offline_install}" == 'true' ] && readonly INSTALL_TYPE="Complete" || \
- readonly INSTALL_TYPE="NetInstall"
-readonly WELCOME_TITLE="Parabola ${iso_init}/${iso_gui} Edition - (${INSTALL_TYPE})"
+
+source /root/customize_root_image-constants.inc
set -e -u
-# configure locales
-ln -sf /usr/share/zoneinfo/UTC /etc/localtime
-sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen
-sed -i 's/#\(es_ES\.UTF-8\)/\1/' /etc/locale.gen
-sed -i 's/#\(gl_ES\.UTF-8\)/\1/' /etc/locale.gen
-sed -i 's/#\(pt_BR\.UTF-8\)/\1/' /etc/locale.gen
-sed -i 's/#\(pl_PL\.UTF-8\)/\1/' /etc/locale.gen
-sed -i 's/#\(it_IT\.UTF-8\)/\1/' /etc/locale.gen
-sed -i 's/#\(fr_FR\.UTF-8\)/\1/' /etc/locale.gen
-sed -i 's/#\(eo\)/\1/' /etc/locale.gen
+# configure timezone and locales
+ln -sf /usr/share/zoneinfo/UTC /etc/localtime
+for locale in ${LOCALES} ; do sed -i "s/#${locale}/${locale}/" /etc/locale.gen ; done ;
locale-gen
# configure sudo
@@ -70,33 +34,23 @@ echo "Server = https://parabola.isacdaavid.info:8081/\$repo/os/\$arch" > /etc/pa
# configure services
if [[ "${iso_init}" == 'systemd' ]]
-then systemctl enable ${SYSTEMD_SERVICES_ALL}
- # delete files that are specific to other init systems
- rm /etc/conf.d/agetty.tty1
- rm /etc/conf.d/hostname
- rm /etc/init.d/pacman-init
- rm /etc/X11/Xwrapper.config
+then # delete files that are specific to other init systems
+ rm ${SYSTEMD_DELETE_FILES}
# enable services
- [[ "${iso_gui}" != 'cli' ]] && systemctl enable ${SYSTEMD_SERVICES_GUI}
+ systemctl enable ${SYSTEMD_SERVICES}
elif [[ "${iso_init}" == 'openrc' ]]
- # delete files that are specific to other init systems
- rm /etc/hostname
- rm /etc/systemd/scripts/choose-mirror
- rm /etc/systemd/system/choose-mirror.service
- rm /etc/systemd/system/etc-pacman.d-gnupg.mount
- rm /etc/systemd/system/getty@tty1.service.d/autologin.conf
- rm /etc/systemd/system/pacman-init.service
+then # delete files that are specific to other init systems
+ rm ${OPENRC_DELETE_FILES}
# enable services
- for service in ${OPENRC_SERVICES_ALL} ; do rc-update add ${service} default ; done ;
- if [[ "${iso_gui}" != 'cli' ]]
- then for service in ${OPENRC_SERVICES_GUI} ; do rc-update add ${service} default ; done ;
- fi
+ for service in ${OPENRC_SERVICES} ; do rc-update add ${service} default ; done ;
# create the dbus user and group if it does not exist
if [[ "$(grep 'dbus' /etc/group )" = "" ]] ; then groupadd -g 81 dbus ; fi ;
if [[ "$(grep 'dbus' /etc/passwd)" = "" ]] ; then useradd -r -s /sbin/nologin -g 81 -u 81 dbus ; fi ;
+else echo "invalid \$iso_init for services '${iso_init}'"
+ exit 1
fi
# configure root user
@@ -132,9 +86,7 @@ else # configure GUI login session and live user
else echo "invalid \$iso_gui for _DESKTOP_SESSION_ '${iso_gui}'"
exit 1
fi
-
- # development builds - set DEV_RELEASE=0 for production builds
- (($DEV_RELEASE)) && source /root/customize_root_image-dev.sh 2> /dev/null
fi
+
# development builds - set DEV_RELEASE=0 for production builds
-(($DEV_RELEASE)) && rm /root/customize_root_image-dev.sh 2> /dev/null
+(($DEV_RELEASE)) && source /root/customize_root_image-dev.sh 2> /dev/null