aboutsummaryrefslogtreecommitdiff
path: root/cmd/init-env.sh
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/init-env.sh')
-rwxr-xr-xcmd/init-env.sh67
1 files changed, 67 insertions, 0 deletions
diff --git a/cmd/init-env.sh b/cmd/init-env.sh
new file mode 100755
index 0000000..3a5bef4
--- /dev/null
+++ b/cmd/init-env.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+set -e
+
+CMD_DIR="$(realpath $(dirname $0))"
+PROJ_DIR="$(realpath $CMD_DIR/..)"
+
+export ROOT="${ROOT:=/opt/muslack64-14.2}"
+export TMP="${TMP:=/tmp}"
+
+if [ ! -d "$ROOT" ]; then
+ >&2 echo "This script expects $ROOT to exist. Maybe you should create it?"
+ exit 1
+fi
+
+(cd "$PROJ_DIR/source/a/aaa_base"
+ sh *.SlackBuild
+ )
+bwrap \
+ --unshare-all \
+ --uid 0 \
+ --gid 0 \
+ --ro-bind / / \
+ --bind /tmp /tmp \
+ --bind "$ROOT" "$ROOT" \
+ --dev-bind /dev /dev \
+installpkg "$TMP/aaa_base-*.txz"
+
+(cd "$PROJ_DIR/source/l/musl"
+ bwrap \
+ --unshare-all \
+ --uid 0 \
+ --gid 0 \
+ --ro-bind / / \
+ --bind /tmp /tmp \
+ --dev-bind /dev /dev \
+ sh *.SlackBuild
+ )
+bwrap \
+ --unshare-all \
+ --uid 0 \
+ --gid 0 \
+ --ro-bind / / \
+ --bind /tmp /tmp \
+ --bind "$ROOT" "$ROOT" \
+ --dev-bind /dev /dev \
+ installpkg "$TMP/musl-*.t*z"
+
+(cd "$PROJ_DIR/source/a/etc"
+ bwrap \
+ --unshare-all \
+ --uid 0 \
+ --gid 0 \
+ --ro-bind / / \
+ --bind /tmp /tmp \
+ --dev-bind /dev /dev \
+ sh *.SlackBuild
+ )
+bwrap \
+ --unshare-all \
+ --uid 0 \
+ --gid 0 \
+ --ro-bind / / \
+ --bind /tmp /tmp \
+ --bind "$ROOT" "$ROOT" \
+ --dev-bind /dev /dev \
+ installpkg "$TMP/etc-*.t*z"
+