From 97abe6a3f65d3146ed39662fe571c6e5fd44febf Mon Sep 17 00:00:00 2001 From: udeved Date: Fri, 12 Dec 2014 21:29:37 +0100 Subject: [PATCH] make svc autoconf optional --- bin/buildiso.in | 16 +++++++++++----- bin/mkiso.in | 6 +++--- lib/util-iso.sh | 16 ++++++++++------ 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/bin/buildiso.in b/bin/buildiso.in index adcf32a..c0c10f0 100755 --- a/bin/buildiso.in +++ b/bin/buildiso.in @@ -56,9 +56,12 @@ display_settings(){ msg2 "addgroups: ${addgroups}" msg2 "hostname: ${hostname}" msg2 "pacman_mirrors: ${mirrors_conf}" - msg2 "startservices_systemd: ${startservices_systemd[*]}" - msg2 "startservices_openrc: ${startservices_openrc[*]}" - msg2 "startservices_livecd: ${startservices_livecd[*]}" + + if ${auto_svc_conf};then + msg2 "startservices_systemd: ${startservices_systemd[*]}" + msg2 "startservices_openrc: ${startservices_openrc[*]}" + msg2 "startservices_livecd: ${startservices_livecd[*]}" + fi msg "ISOFILE:" msg2 "iso_file: ${iso_file}" @@ -85,7 +88,7 @@ make_overlay() { #wget -O ${work_dir}/overlay/etc/pacman.d/mirrorlist http://git.manjaro.org/packages-sources/basis/blobs/raw/master/pacman-mirrorlist/mirrorlist - configure_services_livecd "${work_dir}/overlay" + ${auto_svc_conf} && configure_services_livecd "${work_dir}/overlay" # copy over manjaro-tools.conf copy_manjaro_tools_conf "${work_dir}/overlay/opt/livecd" @@ -122,6 +125,7 @@ verbose=false overwrite=false xorg_overlays=false kde_lng_packages=false +auto_svc_conf=false pacman_conf_arch='default' @@ -139,6 +143,7 @@ usage() { echo ' -z High compression' echo ' -x Xorg overlays' echo ' -k kde lng packages' + echo ' -A Let buildiso configure services(experimental)' echo ' -q Query settings and pretend build' echo ' -h This help' echo '' @@ -148,7 +153,7 @@ usage() { orig_argv=("$@") -opts='a:b:r:t:i:cvfzqxkh' +opts='a:b:r:t:i:cvfzqxkAh' while getopts "${opts}" arg; do case "${arg}" in @@ -163,6 +168,7 @@ while getopts "${opts}" arg; do x) xorg_overlays=true ;; k) kde_lng_packages=true ;; i) pacman_conf="$OPTARG" ;; + A) auto_svc_conf=true ;; q) pretend=true ;; h) usage ;; esac diff --git a/bin/mkiso.in b/bin/mkiso.in index baa1fbb..d50eff4 100755 --- a/bin/mkiso.in +++ b/bin/mkiso.in @@ -154,13 +154,13 @@ _mkchroot(){ setarch "${ARCH}" \ mkchroot -C ${PACCONFIG} \ -S ${MIRRORS} \ - "${work_dir}/${IMAGE_FOLDER}" $@ &> /dev/null + "${work_dir}/${IMAGE_FOLDER}" $@ &> /dev/null || abort "Failed to download all packages." ret=$? else setarch "${ARCH}" \ mkchroot -C ${PACCONFIG} \ -S ${MIRRORS} \ - "${work_dir}/${IMAGE_FOLDER}" $@ + "${work_dir}/${IMAGE_FOLDER}" $@ || abort "Failed to download all packages." ret=$? fi @@ -183,7 +183,7 @@ command_create () { if [ ! -z "${PKGLIST}" ]; then #msg2 "Installing packages to '${work_dir}/${IMAGE_FOLDER}/'" - _mkchroot "${PKGLIST}" + _mkchroot "${PKGLIST}" || abort "Failed to create chroot." fi clean_up diff --git a/lib/util-iso.sh b/lib/util-iso.sh index c4b2f57..6b4a628 100644 --- a/lib/util-iso.sh +++ b/lib/util-iso.sh @@ -141,11 +141,15 @@ configure_services_livecd(){ else msg2 "Congiguring SystemD ...." for svc in ${startservices_livecd[@]}; do - #if [[ -f $1/etc/systemd/system/$svc ]];then - msg2 "Setting $svc ..." [[ ! -d $1/etc/systemd/system/multi-user.target.wants ]] && mkdir -p $1/etc/systemd/system/multi-user.target.wants - ln -sf /etc/systemd/system/$svc $1/etc/systemd/system/multi-user.target.wants/$svc - #fi + if [[ -f $1/etc/systemd/system/$svc ]];then + msg2 "Setting $svc ..." + ln -sf /etc/systemd/system/$svc $1/etc/systemd/system/multi-user.target.wants/$svc + fi + if [[ -f $1/usr/lib/systemd/system/$svc ]];then + msg2 "Setting $svc ..." + ln -sf /usr/lib/systemd/system/$svc $1/etc/systemd/system/multi-user.target.wants/$svc + fi done fi } @@ -653,7 +657,7 @@ make_root_image() { # set up user and password configure_user "${work_dir}/root-image" - configure_services "${work_dir}/root-image" + ${auto_svc_conf} && configure_services "${work_dir}/root-image" configure_plymouth "${work_dir}/root-image" @@ -695,7 +699,7 @@ make_de_image() { copy_userconfig "${work_dir}/${desktop}-image" "${work_dir}/root-image" # set up auto start services - configure_services "${work_dir}/${desktop}-image" + ${auto_svc_conf} && configure_services "${work_dir}/${desktop}-image" # configure DM & accountsservice configue_displaymanager "${work_dir}/${desktop}-image"