summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-07-21 02:22:27 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-07-21 02:22:27 (EDT)
commit268e71042b5ae7ce20689ac056da8e4fbfa697b4 (patch)
tree049665d4adf558bb5dc762a45f07285504f1716a
parenta77328c3251f7c20205acdf4dffa04650ffbda1f (diff)
miniprokit: Add -F option to install command
Also always configure packages immediately, with services disabled, unless -F is given.
-rwxr-xr-xminiprokit.sh18
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 \