From 9aa612ba7a98b70b26edb16dbcd549b5bcde3fcd Mon Sep 17 00:00:00 2001 From: bill-auger Date: Thu, 16 Nov 2017 13:36:18 -0500 Subject: add openrc config --- configs/profile/root-image/etc/X11/Xwrapper.config | 2 + configs/profile/root-image/etc/conf.d/agetty.tty1 | 11 +++++ configs/profile/root-image/etc/conf.d/hostname | 2 + configs/profile/root-image/etc/init.d/pacman-init | 31 +++++++++++++ .../root-image/root/customize_root_image.sh | 51 +++++++++++++++++++--- 5 files changed, 91 insertions(+), 6 deletions(-) create mode 100644 configs/profile/root-image/etc/X11/Xwrapper.config create mode 100644 configs/profile/root-image/etc/conf.d/agetty.tty1 create mode 100644 configs/profile/root-image/etc/conf.d/hostname create mode 100755 configs/profile/root-image/etc/init.d/pacman-init (limited to 'configs/profile/root-image') diff --git a/configs/profile/root-image/etc/X11/Xwrapper.config b/configs/profile/root-image/etc/X11/Xwrapper.config new file mode 100644 index 0000000..7483aaf --- /dev/null +++ b/configs/profile/root-image/etc/X11/Xwrapper.config @@ -0,0 +1,2 @@ +# Xorg.wrap configuation file +needs_root_rights = yes diff --git a/configs/profile/root-image/etc/conf.d/agetty.tty1 b/configs/profile/root-image/etc/conf.d/agetty.tty1 new file mode 100644 index 0000000..b7ff06d --- /dev/null +++ b/configs/profile/root-image/etc/conf.d/agetty.tty1 @@ -0,0 +1,11 @@ +# Set the baud rate of the terminal line +baud="38400" + +# set the terminal type +term_type="linux" + +# extra options to pass to agetty for this port +agetty_options="--autologin root --noclear" + +# make agetty quiet +#quiet="no" diff --git a/configs/profile/root-image/etc/conf.d/hostname b/configs/profile/root-image/etc/conf.d/hostname new file mode 100644 index 0000000..a701f0c --- /dev/null +++ b/configs/profile/root-image/etc/conf.d/hostname @@ -0,0 +1,2 @@ +# Set to the hostname of this machine +hostname="parabolaiso" diff --git a/configs/profile/root-image/etc/init.d/pacman-init b/configs/profile/root-image/etc/init.d/pacman-init new file mode 100755 index 0000000..b610683 --- /dev/null +++ b/configs/profile/root-image/etc/init.d/pacman-init @@ -0,0 +1,31 @@ +#!/usr/bin/openrc-run +# Copyright (C) 2017 Parabola Project +# Copyright (C) Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +description="Initializes Pacman keyring" + +depend() { + use haveged + after haveged +} + +start() { + # Check that there's no keyring, if there isn't, create one + # in the background for a faster boot + if [ ! -d /etc/pacman.d/gnupg ]; then + ebegin "Starting Pacman keyring" + pacman-key --init &> /dev/null && + pacman-key --populate archlinux parabola &> /dev/null + else + ebegin "Pacman keyring already started" + fi +} + +stop() { + # If there's a keyring, delete it + if [ -d /etc/pacman.d/gnupg ]; then + ebegin "Stoping Pacman keyring" + rm -rf /etc/pacman.d/gnupg + fi +} diff --git a/configs/profile/root-image/root/customize_root_image.sh b/configs/profile/root-image/root/customize_root_image.sh index 8d0b7b0..505bf3d 100755 --- a/configs/profile/root-image/root/customize_root_image.sh +++ b/configs/profile/root-image/root/customize_root_image.sh @@ -2,10 +2,16 @@ readonly DEV_RELEASE=1 # 1 for development builds - 0 for production builds readonly REPOS='libre core extra community pcr' -readonly SYSTEMD_SERVICES_ALL="multi-user.target \ - pacman-init.service \ - choose-mirror.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 " 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\ @@ -20,6 +26,9 @@ readonly ROOT_SKEL_FILES="/etc/skel/.automated_script.sh \ /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_wm} Edition - (${INSTALL_TYPE})" @@ -28,11 +37,15 @@ readonly WELCOME_TITLE="Parabola ${iso_init}/${iso_wm} Edition - (${INSTALL_TYPE set -e -u # configure locales -ln -sf /usr/share/zoneinfo/UTC /etc/localtime +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 locale-gen # configure sudo @@ -58,7 +71,32 @@ 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 + + # enable services [[ "${iso_wm}" != 'cli' ]] && systemctl enable ${SYSTEMD_SERVICES_GUI} +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 + + # enable services + for service in ${OPENRC_SERVICES_ALL} ; do rc-update add ${service} default ; done ; + if [[ "${iso_wm}" != 'cli' ]] + then for service in ${OPENRC_SERVICES_GUI} ; do rc-update add ${service} default ; done ; + fi + + # 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 ; fi # configure root user @@ -72,10 +110,11 @@ then cp ${ROOT_SKEL_FILES} /root/ sed -i "s|_DESKTOP_SESSION_||" /root/.bash_profile else # configure GUI login session and live user - [ -n "$(id ${LIVE_USER} 2> /dev/null)" ] && userdel -r ${LIVE_USER} 2> /dev/null - useradd -m -p "" -g users -G "$LIVE_USER_GROUPS" -s ${DEFAULT_SHELL} ${LIVE_USER} + [[ -n "$(id ${LIVE_USER} 2> /dev/null)" ]] && userdel -r ${LIVE_USER} 2> /dev/null + useradd -m -p "" -g users -G "${USER_GROUPS}" -s ${DEFAULT_SHELL} ${LIVE_USER} if [[ "${iso_init}" == 'systemd' ]] then sed -i "s|--autologin root|--autologin ${LIVE_USER}|" /etc/systemd/system/getty@tty1.service.d/autologin.conf + else sed -i "s|--autologin root|--autologin ${LIVE_USER}|" /etc/conf.d/agetty.tty1 fi # configure desktop environment -- cgit v1.2.2