From b26bd5ee53daed43609cd44f474c26442f5ba742 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 08 Jun 2014 16:45:47 -0400 Subject: miniprokit.sh: Write install service init script. --- 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= -- cgit v0.9.1