-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_skills.sh
More file actions
58 lines (48 loc) · 1.52 KB
/
install_skills.sh
File metadata and controls
58 lines (48 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# install_skills.sh
# Deploys curated skill overrides from the hardening repo to /a0/skills/
# Backs up originals before overwriting. Safe to re-run.
#
# Layout expected in this repo:
# skills/
# create-skill/
# SKILL.md
# some-other-skill/
# SKILL.md
# helper_script.py
#
# Deployment target: /a0/skills/{skill-name}/
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILLS_SRC="$SCRIPT_DIR/skills"
SKILLS_DST="/a0/skills"
BACKUP_DIR="$SKILLS_DST/.hardening_originals"
if [ ! -d "$SKILLS_SRC" ]; then
echo "No skills/ directory found in hardening repo. Nothing to install."
exit 0
fi
echo "Installing hardening skills..."
installed=0
for skill_src_dir in "$SKILLS_SRC"/*/; do
skill_name="$(basename "$skill_src_dir")"
skill_dst_dir="$SKILLS_DST/$skill_name"
backup_skill_dir="$BACKUP_DIR/$skill_name"
if [ ! -f "$skill_src_dir/SKILL.md" ]; then
echo " SKIP: $skill_name (no SKILL.md found)"
continue
fi
# Back up existing skill directory if present and not already backed up
if [ -d "$skill_dst_dir" ] && [ ! -d "$backup_skill_dir" ]; then
mkdir -p "$backup_skill_dir"
cp -r "$skill_dst_dir/." "$backup_skill_dir/"
echo " Backed up: $skill_name → $backup_skill_dir"
fi
# Create destination directory and copy all files
mkdir -p "$skill_dst_dir"
cp -r "$skill_src_dir/." "$skill_dst_dir/"
echo " Installed: $skill_name"
installed=$((installed + 1))
done
echo ""
echo "Skills installed: $installed"
echo "Backup location: $BACKUP_DIR"