From 55d80d62c2d102412302222c7d18762763c4ac38 Mon Sep 17 00:00:00 2001 From: Danny Sonnenschein Date: Tue, 5 Feb 2019 21:08:22 +0000 Subject: Disable services (sysfixtime, sysntpd, led) These services aren't necessary in a container, because there are no leds and time is kept in sync inside the hypervisor system. --- build.sh | 2 +- scripts/build_rootfs.sh | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index e5b88a9..1ac2143 100755 --- a/build.sh +++ b/build.sh @@ -250,7 +250,7 @@ build_tarball() { esac fi - $cmd $rootfs $opts -o $tarball --arch=${arch} --subarch=${subarch} --packages="${allpkgs}" --files="${files}" + $cmd $rootfs $opts -o $tarball --disable-services="sysfixtime sysntpd led" --arch=${arch} --subarch=${subarch} --packages="${allpkgs}" --files="${files}" } build_metadata() { diff --git a/scripts/build_rootfs.sh b/scripts/build_rootfs.sh index b4f6ce9..ac31541 100755 --- a/scripts/build_rootfs.sh +++ b/scripts/build_rootfs.sh @@ -3,7 +3,7 @@ set -e usage() { - echo "Usage: $0 [-a|--arch ] [-s|--subarch ] [-o|--output ] [-p|--packages ] [-f|--files ] [-m|--metadata ] [-u|--upgrade] " + echo "Usage: $0 [-a|--arch ] [-d|--disable-services ] [-s|--subarch ] [-o|--output ] [-p|--packages ] [-f|--files ] [-m|--metadata ] [-u|--upgrade] " exit 1 } @@ -12,16 +12,19 @@ subarch=64 packages= dst_file=/dev/stdout files= +services= metadata= metadata_dir= upgrade= -temp=$(getopt -o "a:o:p:s:f:m:u:" -l "arch:,output:,packages:,subarch:,files:,metadata:,upgrade,help" -- "$@") +temp=$(getopt -o "a:d:o:p:s:f:m:u:" -l "arch:,disable-services:,output:,packages:,subarch:,files:,metadata:,upgrade,help" -- "$@") eval set -- "$temp" while true; do case "$1" in -a|--arch) arch="$2"; shift 2;; + -d|--disable-services) + services="$2"; shift 2;; -s|--subarch) subarch="$2"; shift 2;; -p|--packages) @@ -143,6 +146,14 @@ install_packages() { done } +disable_services() { + local services="$1" + for service in $services; do + echo Disabling $service + env IPKG_INSTROOT=$instroot sh $instroot/etc/rc.common $instroot/etc/init.d/$service disable + done +} + unpack disable_root if test -n "$metadata"; then @@ -154,6 +165,7 @@ if test -n "$upgrade"; then update_packages fi install_packages "$packages" +disable_services "$services" add_files $files_dir $instroot if test -n "$files"; then add_files $files $instroot -- cgit v1.2.3