-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsnapshot_container.sh
More file actions
60 lines (48 loc) · 1.85 KB
/
snapshot_container.sh
File metadata and controls
60 lines (48 loc) · 1.85 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
59
60
#!/bin/bash
# snapshot_container.sh - Snapshot Codex container structure and metadata
set -e
echo "[*] Creating container snapshot folder..."
mkdir -p container-snapshot
echo "[*] Copying current workspace (excluding build artifacts)..."
rsync -av --progress /workspace/ ./container-snapshot \
--exclude .git \
--exclude node_modules \
--exclude bin \
--exclude obj \
--exclude __pycache__
echo "[*] Exporting system information..."
{
echo "## SYSTEM INFO"
uname -a
echo ""
echo "## OS RELEASE"
cat /etc/os-release 2>/dev/null || echo "No /etc/os-release found."
} > container-snapshot/SYSTEM_INFO.md
echo "[*] Dumping environment variables..."
printenv > container-snapshot/ENV_VARS.md
echo "[*] Generating directory tree..."
if ! command -v tree &> /dev/null; then
echo "[*] 'tree' command not found, attempting to install it..."
apt-get update && apt-get install -y tree
fi
tree -a -L 4 /workspace > container-snapshot/FILESYSTEM_TREE.md
echo "[*] Writing README.md for context..."
cat <<EOF > container-snapshot/README.md
# Container Snapshot
This folder contains a snapshot of the current Codex environment.
## Included:
- SYSTEM_INFO.md – Kernel and OS info
- ENV_VARS.md – All environment variables
- FILESYSTEM_TREE.md – Hierarchical view of the workspace
- Codebase – All source files from /workspace
## Purpose:
This snapshot can be reused to recreate the current environment, build new features (like offline .NET SDK), or run isolated analysis outside the sandbox.
EOF
echo "[*] Git staging and commit (if git is present)..."
if command -v git &> /dev/null; then
git add container-snapshot
git commit -m "Snapshot current Codex container into container-snapshot directory"
else
echo "[!] Git not found. Skipping version control."
fi
echo "[✅] Snapshot complete. Ready for inspection or extension!"