aboutsummaryrefslogtreecommitdiff
path: root/install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..acac130
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+PKG="$1"
+
+DESTDIR="$2"
+
+SVDIR="${DESTDIR}"/etc/s6/sv
+ADMINSVDIR="${DESTDIR}"/etc/s6/adminsv
+FALLBACKSVDIR="${DESTDIR}"/etc/s6/fallbacksv
+CONFDIR="${DESTDIR}"/etc/s6/config
+
+for dir in "$PKG"/*; do
+ if [ -d "$dir" ]; then
+ dirname=$(basename "$dir")
+ # This needs to go to adminsv and fallbacksv.
+ if [ "$dirname" = "mount-filesystems" ]; then
+ TOPDIR="${ADMINSVDIR}"
+ else
+ TOPDIR="${SVDIR}"
+ fi
+ for subdir in "$dir"/*; do
+ if [ -d "$subdir" ]; then
+ subdirname=$(basename "$subdir")
+ install -v -d "${TOPDIR}"/"$dirname"/"$subdirname"
+ for file in "$subdir"/*; do
+ install -v -m644 "$file" "${TOPDIR}"/"$dirname"/"$subdirname"
+ done
+ fi
+ done
+ install -v -d "${TOPDIR}"/"$dirname"
+ for file in "$dir"/*; do
+ install -v -m644 "$file" "${TOPDIR}"/"$dirname"
+ done
+ if [ ${TOPDIR} = ${ADMINSVDIR} ]; then
+ install -v -d "${FALLBACKSVDIR}"/"$dirname"
+ cp -ar ${TOPDIR}/"$dirname" ${FALLBACKSVDIR}/"$dirname"
+ fi
+ fi
+done
+
+if [ -e "$PKG"/*.conf ]; then
+ for conf in "$PKG"/*.conf; do
+ install -v -d "${CONFDIR}"
+ install -v -m644 "$conf" "${CONFDIR}"/"$PKG".conf
+ done
+fi