diff options
-rwxr-xr-x | miniprokit.sh | 18 |
1 files changed, 13 insertions, 5 deletions
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 <arch>] [-P <plat>] [-m <mirror>] <root>' + usage='[-a <arch>] [-P <plat>] [-m <mirror>] [-F] <root>' - 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 \ |