diff options
Diffstat (limited to 'login.sh')
| -rw-r--r-- | login.sh | 46 |
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 |
