From f92bfc9995fd4b9f524232f8c02cb155a7b9a93c Mon Sep 17 00:00:00 2001 From: udeved Date: Wed, 24 Feb 2016 00:06:27 +0100 Subject: [PATCH] [util-iso-image] add configure_logind() --- lib/util-iso-image.sh | 58 ++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/lib/util-iso-image.sh b/lib/util-iso-image.sh index 3ce0ad1..7b73004 100644 --- a/lib/util-iso-image.sh +++ b/lib/util-iso-image.sh @@ -102,22 +102,9 @@ configure_services_live(){ done info "Done configuring [%s]" "${initsys}" ;; - *) - info "Unsupported: [%s]!" "${initsys}" - ;; esac } -# $1: chroot -configure_lsb(){ - [[ -f $1/boot/grub/grub.cfg ]] && rm $1/boot/grub/grub.cfg - if [ -e $1/etc/lsb-release ] ; then - msg2 "Configuring lsb-release" - sed -i -e "s/^.*DISTRIB_RELEASE.*/DISTRIB_RELEASE=${dist_release}/" $1/etc/lsb-release - sed -i -e "s/^.*DISTRIB_CODENAME.*/DISTRIB_CODENAME=${dist_codename}/" $1/etc/lsb-release - fi -} - configure_services(){ case ${initsys} in 'openrc') @@ -137,13 +124,8 @@ configure_services(){ chroot $1 systemctl enable $svc #&> /dev/null fi done - sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' $1/etc/systemd/logind.conf - sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' $1/etc/systemd/logind.conf info "Done configuring [%s]" "${initsys}" ;; - *) - info "Unsupported: [%s]!" "${initsys}" - ;; esac } @@ -194,15 +176,6 @@ detect_desktop_env(){ msg2 "Detected: %s" "${default_desktop_file}" } -configure_mhwd(){ - if [[ ${arch} == "x86_64" ]];then - if ! ${multilib};then - msg2 "Disable mhwd lib32 support" - echo 'MHWD64_IS_LIB32="false"' > $1/etc/mhwd-x86_64.conf - fi - fi -} - # $1: chroot configure_displaymanager(){ msg2 "Configuring Displaymanager ..." @@ -332,6 +305,34 @@ chroot_clean(){ rm -rf --one-file-system "$1" } +# $1: chroot +configure_lsb(){ + [[ -f $1/boot/grub/grub.cfg ]] && rm $1/boot/grub/grub.cfg + if [ -e $1/etc/lsb-release ] ; then + msg2 "Configuring lsb-release" + sed -i -e "s/^.*DISTRIB_RELEASE.*/DISTRIB_RELEASE=${dist_release}/" $1/etc/lsb-release + sed -i -e "s/^.*DISTRIB_CODENAME.*/DISTRIB_CODENAME=${dist_codename}/" $1/etc/lsb-release + fi +} + +configure_logind(){ + if [[ ${initsys} == 'systemd' ]];then + msg2 "Configuring logind" + local conf=$1/etc/systemd/logind.conf + sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' "$conf" + sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' "$conf" + fi +} + +configure_mhwd(){ + if [[ ${arch} == "x86_64" ]];then + if ! ${multilib};then + msg2 "Disable mhwd lib32 support" + echo 'MHWD64_IS_LIB32="false"' > $1/etc/mhwd-x86_64.conf + fi + fi +} + configure_sysctl(){ if [[ ${initsys} == 'openrc' ]];then msg2 "Configuring sysctl for openrc" @@ -353,7 +354,7 @@ configure_time(){ # $1: chroot configure_systemd_live(){ if [[ ${initsys} == 'systemd' ]];then - msg2 "Configuring systemd for livecd" + msg2 "Configuring systemd for live session" sed -i 's/#\(Storage=\)auto/\1volatile/' $1/etc/systemd/journald.conf sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' $1/etc/systemd/logind.conf sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' $1/etc/systemd/logind.conf @@ -376,6 +377,7 @@ configure_root_image(){ configure_mhwd "$1" configure_sysctl "$1" configure_time "$1" + configure_logind "$1" msg "Done configuring [root-image]" }