summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-06-08 16:45:47 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-06-08 16:45:47 (EDT)
commitb26bd5ee53daed43609cd44f474c26442f5ba742 (patch)
tree89cfcf335098a663281b1a844405142ca6696129
parentb2600736ac8db08428ac1d220f62e064939b4a47 (diff)
miniprokit.sh: Write install service init script.
-rwxr-xr-xminiprokit.sh37
1 files changed, 29 insertions, 8 deletions
diff --git a/miniprokit.sh b/miniprokit.sh
index 381daf4..d06720a 100755
--- a/miniprokit.sh
+++ b/miniprokit.sh
@@ -33,6 +33,17 @@ c93dc8608cf9a435b920c9cc9590c9d274c8193b709845cc5409692f00d8b05d src_all_base
PKGS=' base-files busybox '\
'libc-bin libc.6 libopkg.1 opkg '
+INSTALL_SERVICE=\
+'#!/bin/sh /etc/rc.common
+
+start()
+{
+ log "Configuring packages"
+ opkg install $(opkg list-installed | cut -d " " -f 1)
+ rm "${SCRIPT}"
+}
+'
+
main()
{
local cmd=
@@ -201,14 +212,7 @@ cmd_install()
EOF
- if [ "x${plat}" = 'xdev' ]; then
- chroot "${root}" /bin/sh -c \
- 'opkg install $(opkg list-installed | cut -d " " -f 1)'
- [ -r /etc/resolv.conf ] && cp /etc/resolv.conf "${root}/etc"
- [ -r /etc/hostname ] && cp /etc/hostname "${root}/etc"
- else
- printf 'proteanos\n' >"${root}/etc/hostname"
- fi
+ configure "${root}" "${plat}"
}
get_pkg()
@@ -278,6 +282,23 @@ get_pkg()
rm -f "${root}/${filename}"
}
+configure()
+{
+ local root="${1}"
+ local plat="${2}"
+
+ if [ "x${plat}" = 'xdev' ]; then
+ chroot "${root}" /bin/sh -c \
+ 'opkg install $(opkg list-installed | cut -d " " -f 1)'
+ [ -r /etc/resolv.conf ] && cp /etc/resolv.conf "${root}/etc"
+ [ -r /etc/hostname ] && cp /etc/hostname "${root}/etc"
+ else
+ printf '%s' "${INSTALL_SERVICE}" >"${root}/etc/rc.d/S10install"
+ chmod 0755 "${root}/etc/rc.d/S10install"
+ printf 'proteanos\n' >"${root}/etc/hostname"
+ fi
+}
+
cmd_shell()
{
local root=