From bd957b48d07994ce3691e8f00e3ab34b33cc6fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=BCmel=20Branko?= Date: Sun, 28 Dec 2025 15:50:04 +0100 Subject: [PATCH] feat(setup): sync role scripts from missions repo to core app --- native_crumbcore_v1/setup_missions.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/native_crumbcore_v1/setup_missions.sh b/native_crumbcore_v1/setup_missions.sh index 84aa8f4..7e9e694 100755 --- a/native_crumbcore_v1/setup_missions.sh +++ b/native_crumbcore_v1/setup_missions.sh @@ -64,6 +64,33 @@ else sudo -u "$USER_NAME" git pull || true fi +# 3b. Sync Roles to Core +# We assume the repo has a 'crumbforest_roles' directory compatible with our app +# The roles are needed in /opt/crumbforest/app/crumbforest_roles for the wrapper to find them +REPO_ROLES_DIR="$HOME_DIR/missions/crumbforest_roles" +APP_ROLES_DIR="/opt/crumbforest/app/crumbforest_roles" + +if [ -d "$REPO_ROLES_DIR" ]; then + print_info "Syncing roles from $REPO_ROLES_DIR to $APP_ROLES_DIR..." + + # Ensure target exists + mkdir -p "$APP_ROLES_DIR" + + # Copy scripts, overwrite existing (force update) + # We use cp -f to overwrite. + cp -f "$REPO_ROLES_DIR"/*_zero.sh "$APP_ROLES_DIR/" 2>/dev/null || print_info "No zero scripts found to sync." + + # Ensure they are executable and owned correctly + chmod +x "$APP_ROLES_DIR"/*.sh + chown root:crumbforest "$APP_ROLES_DIR"/*.sh + # Ensure group can read/exec (wrapper runs as user in group crumbforest, eventually via sudo or direct exec) + chmod 750 "$APP_ROLES_DIR"/*.sh + + print_info "Roles synced and permissions set." +else + print_info "No 'crumbforest_roles' directory found in mission repo. Skipping role sync." +fi + # 4. Setup .bashrc for the Codex # We append a customized welcome message if not present if ! grep -q "CrumbCodex" "$HOME_DIR/.bashrc"; then