From 2e1898e771c1ab91796aa162b45353e79b4e23ce Mon Sep 17 00:00:00 2001
From: P. J. McDermott <pj@pehjota.net>
Date: Thu, 21 Aug 2014 12:01:14 -0400
Subject: profile_configure_system_foreign(): New function

---
diff --git a/lib/profile.sh b/lib/profile.sh
index 846b22d..b37b6f7 100644
--- a/lib/profile.sh
+++ b/lib/profile.sh
@@ -129,3 +129,10 @@ profile_configure_system_native()
 
 	"prof_${profile}_configure_system_native" "${root}"
 }
+
+profile_configure_system_foreign()
+{
+	local root="${1}"
+
+	"prof_${profile}_configure_system_foreign" "${root}"
+}
diff --git a/lib/profiles/proteanos.sh b/lib/profiles/proteanos.sh
index cddef89..822072a 100644
--- a/lib/profiles/proteanos.sh
+++ b/lib/profiles/proteanos.sh
@@ -35,6 +35,18 @@ sys    /sys     sysfs  defaults
 /dev   /dev     none   bind
 devpts /dev/pts devpts noexec,nosuid,gid=5,mode=0620
 "
+prof_proteanos_install_service=\
+'#!/bin/sh /etc/rc.common
+
+start()
+{
+	log "Configuring packages"
+	printf "disabled\n" >/etc/rc.policy
+	opkg install $(opkg list-installed | cut -d " " -f 1)
+	printf "enabled\n" >/etc/rc.policy
+	rm "${SCRIPT}"
+}
+'
 
 prof_proteanos_normalize_suite()
 {
@@ -176,3 +188,14 @@ prof_proteanos_configure_system_native()
 	[ -e "${root}/etc/passwd" ] || printf \
 		'root::0:0:root:/root:/bin/sh\n' >"${root}/etc/passwd"
 }
+
+prof_proteanos_configure_system_foreign()
+{
+	local root="${1}"
+
+	printf '%s' "${prof_proteanos_install_service}" >"${root}/etc/rc.d/S10install"
+	chmod 0755 "${root}/etc/rc.d/S10install"
+	printf 'proteanos\n' >"${root}/etc/hostname"
+	[ -e "${root}/etc/passwd" ] || printf \
+		'root::0:0:root:/root:/bin/sh\n' >"${root}/etc/passwd"
+}
--
cgit v0.9.1