summaryrefslogtreecommitdiffstats
path: root/login.sh
diff options
context:
space:
mode:
authorJesper Jensen <jesper@jnsn.dev>2026-11-16 20:03:42 +0100
committerJesper Jensen <jesper@jnsn.dev>2026-11-16 20:03:42 +0100
commit87f0b4288fcc2de193732e7c0e96181e68bc502c (patch)
treeb1829aba14cf0ba354927746b291af6fded7f706 /login.sh
downloaddevbox-87f0b4288fcc2de193732e7c0e96181e68bc502c.tar.gz
devbox-87f0b4288fcc2de193732e7c0e96181e68bc502c.zip
INITIAL COMMIT
Diffstat (limited to 'login.sh')
-rw-r--r--login.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/login.sh b/login.sh
new file mode 100644
index 0000000..cb83408
--- /dev/null
+++ b/login.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+set -Eeuo pipefail
+
+if [[ -d "/secrets" ]]; then
+ /usr/local/bin/devbox-template
+fi
+
+# Add some /dev devices
+[ -e /dev/loop-control ] || mknod /dev/loop-control c 10 237
+for i in {0..7}; do
+ [ -e "/dev/loop$i" ] || mknod "/dev/loop$i" b 7 $i
+done
+
+# Allocate a space for containers
+function overlay_fs() {
+ STORAGE="$1"
+ IMG="$2"
+ SIZE=40G
+
+ if [ "$(df -PT "$STORAGE" | tail -1 | cut -d' ' -f2)" = "virtiofs" ]; then
+ mkdir -p "$STORAGE"
+
+ # Create a sparse file for the fs
+ truncate -s "$SIZE" "$IMG"
+ mkfs.ext4 -qF -O dir_index,extent,has_journal "$IMG"
+
+ LOOP=$(losetup -f --show "$IMG")
+ mount -o noatime "$LOOP" "$STORAGE"
+
+ mount --make-rshared "$STORAGE" || true
+ fi
+}
+
+overlay_fs "/var/lib/containers/storage" "/var/tmp/containers.img"
+overlay_fs "/home/dev/.local/share/containers/storage" "/home/dev/.local/share/containers/img"
+
+su dev
+
+# if [[ -z "${PASEO_PASSWORD:-}" ]]; then
+# echo "PASEO_PASSWORD is required" >&2
+# exit 1
+# fi
+
+# echo "[devbox] starting Paseo daemon on ${PASEO_LISTEN} (web UI: ${PASEO_WEB_UI_ENABLED})"
+# exec paseo daemon run
+exec /bin/bash