diff options
author | sinanmohd <pcmsinan@gmail.com> | 2022-09-05 12:04:12 +0530 |
---|---|---|
committer | sinanmohd <pcmsinan@gmail.com> | 2022-09-05 12:13:29 +0530 |
commit | 6dbf4ea4c5249774c84e7c31588bc3d0834fb1e1 (patch) | |
tree | c35458acf2586e41e61405c618bcf1792f48f1f3 | |
parent | 89ef4ef3fa3673f3bcc89fd4a939c0f0902362c0 (diff) |
add installation script
-rwxr-xr-x | install.sh | 46 |
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 |