mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 10:13:58 +00:00
53 lines
1.2 KiB
Bash
53 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# etc/init_min.sh
|
|
# Purpose: Initialize minimal containerd environment for knoe-db development
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
|
|
# shellcheck disable=SC1090
|
|
source "$SCRIPT_DIR/knoe_cfg.sh"
|
|
|
|
log() { echo "==> $*"; }
|
|
|
|
ACTION=${1:-initialize}
|
|
|
|
case "$ACTION" in
|
|
initialize)
|
|
log "Initializing minimal environment..."
|
|
|
|
# Ensure containerd is running (if on macOS via brew)
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
if ! pgrep containerd >/dev/null; then
|
|
log "Starting containerd via brew services..."
|
|
brew services start containerd
|
|
sleep 2
|
|
fi
|
|
fi
|
|
|
|
# Create start.sh and stop.sh aliases to knoe.sh
|
|
log "Generating start.sh and stop.sh as wrappers to knoe.sh..."
|
|
|
|
cat > "$PROJECT_ROOT/start.sh" <<EOF
|
|
#!/usr/bin/env bash
|
|
exec "\$(dirname "\$0")/knoe.sh" --min start "\$@"
|
|
EOF
|
|
chmod +x "$PROJECT_ROOT/start.sh"
|
|
|
|
cat > "$PROJECT_ROOT/stop.sh" <<EOF
|
|
#!/usr/bin/env bash
|
|
exec "\$(dirname "\$0")/knoe.sh" --min stop "\$@"
|
|
EOF
|
|
chmod +x "$PROJECT_ROOT/stop.sh"
|
|
|
|
log "Minimal environment initialized successfully."
|
|
;;
|
|
|
|
*)
|
|
log "Unknown action: $ACTION"
|
|
exit 1
|
|
;;
|
|
esac
|