From 268e71042b5ae7ce20689ac056da8e4fbfa697b4 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Mon, 21 Jul 2014 02:22:27 -0400 Subject: miniprokit: Add -F option to install command Also always configure packages immediately, with services disabled, unless -F is given. --- diff --git a/miniprokit.sh b/miniprokit.sh index dcac985..52f36e6 100755 --- a/miniprokit.sh +++ b/miniprokit.sh @@ -117,6 +117,7 @@ cmd_install() local arch= local plat= local mirror= + local foreign= local root= local uname_m= local uname_s= @@ -128,13 +129,14 @@ cmd_install() local package= local filename= - usage='[-a ] [-P ] [-m ] ' + usage='[-a ] [-P ] [-m ] [-F] ' - while getopts 'a:P:m:' opt; do + while getopts 'a:P:m:F' opt; do case ${opt} in a) arch="${OPTARG}";; P) plat="${OPTARG}";; m) mirror="${OPTARG}";; + F) foreign=true;; ?) printf 'Usage: %s install %s\n' \ "${0}" "${usage}" >&2 @@ -181,6 +183,10 @@ cmd_install() fi info 'Using mirror %s' "${mirror}" + if [ "x${foreign}" = 'x' ]; then + foreign=false + fi + info 'Setting up root...' mkdir -p "${root}/etc/opkg" \ "${root}/var/lib/opkg/lists" "${root}/var/lib/opkg/info" \ @@ -227,7 +233,7 @@ cmd_install() EOF - configure "${root}" "${plat}" + configure "${root}" "${foreign}" } get_pkg() @@ -300,12 +306,14 @@ get_pkg() configure() { local root="${1}" - local plat="${2}" + local foreign="${2}" - if [ "x${plat}" = 'xdev' ]; then + if ! ${foreign}; then info 'Configuring packages...' + printf 'disabled\n' >"${root}/etc/rc.policy" chroot "${root}" /bin/sh -c \ 'opkg install $(opkg list-installed | cut -d " " -f 1)' + printf 'enabled\n' >"${root}/etc/rc.policy" [ -r /etc/resolv.conf ] && cp /etc/resolv.conf "${root}/etc" [ -r /etc/hostname ] && cp /etc/hostname "${root}/etc" [ -e "${root}/etc/passwd" ] || printf \ -- cgit v0.9.1