d / setup_storage.sh
pabla1322's picture
Upload 14 files
e5de808 verified
Raw
History Blame Contribute Delete
1.41 kB
#!/bin/bash
# ============================================================
# setup_storage.sh – Create /data directory structure
# All state lives here so it survives HF Space restarts
# ============================================================
set -euo pipefail
log() { echo "[STORAGE] $*"; }
# ── Directory layout ─────────────────────────────────────────
declare -a DIRS=(
/data/home # ubuntu user home (replaces /home/ubuntu)
/data/home/.config # XDG config
/data/home/.local/share
/data/home/Desktop
/data/home/Downloads
/data/home/.mozilla/firefox
/data/workspace # user project files
/data/vnc # VNC server state + xstartup
/data/firefox # persistent Firefox profile
/data/xfce # XFCE session config
/data/downloads # download folder
/data/logs # all service logs
/data/cache # app cache
)
for dir in "${DIRS[@]}"; do
if [ ! -d "$dir" ]; then
mkdir -p "$dir"
log "Created $dir"
fi
done
# ── Permissions ──────────────────────────────────────────────
chown -R ubuntu:ubuntu /data
chmod 755 /data
chmod 700 /data/vnc # VNC passwd must be protected
log "Persistent storage ready."