Skip to content

Commit 5ea6a44

Browse files
committed
fix: use $HOME instead of hardcoded /root in scripts
Replace all hardcoded /root paths with $HOME so scripts are portable across different environments and don't leak local path info.
1 parent 1705272 commit 5ea6a44

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

.codebuddy/scripts/install-cron.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Install cron job for Loop Engineering
44
# Runs all 5 loops sequentially once daily at 01:00 (Beijing time, UTC+8).
55
#
6-
# The crontab is written to a persistent path (/root/.local/share/loop-crontab)
6+
# The crontab is written to a persistent path ($HOME/.local/share/loop-crontab)
77
# so it survives container restarts. rc.local loads it on boot.
88
#
99
# Usage: ./install-cron.sh
@@ -14,7 +14,7 @@ set -euo pipefail
1414
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1515
RUN_SCRIPT="${SCRIPT_DIR}/run-loop.sh"
1616
MARKER="# loop-engineering-req"
17-
PERSIST_DIR="/root/.local/share"
17+
PERSIST_DIR="${HOME}/.local/share"
1818
PERSIST_FILE="${PERSIST_DIR}/loop-crontab"
1919

2020
# Remove existing loop cron jobs from current crontab

.codebuddy/scripts/run-loop.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
set -euo pipefail
1717

1818
# cron has a minimal PATH — set full PATH so codebuddy, gh, go, etc. are found
19-
export PATH="/root/.linuxbrew/bin:/root/.linuxbrew/sbin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/root/.bin:/root/.local/bin:/root/.cargo/bin:/root/go/bin:/root/.krew/bin:/root/.fzf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
20-
21-
# Also load NVM, Cargo, Go env if available
2219
export HOME="${HOME:-/root}"
23-
export GOPATH="${GOPATH:-/root/go}"
24-
[ -f /root/.cargo/env ] && . /root/.cargo/env 2>/dev/null || true
20+
export PATH="${HOME}/.linuxbrew/bin:${HOME}/.linuxbrew/sbin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${HOME}/.bin:${HOME}/.local/bin:${HOME}/.cargo/bin:${HOME}/go/bin:${HOME}/.krew/bin:${HOME}/.fzf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
21+
22+
# Also load Cargo, Go env if available
23+
export GOPATH="${GOPATH:-${HOME}/go}"
24+
[ -f "${HOME}/.cargo/env" ] && . "${HOME}/.cargo/env" 2>/dev/null || true
2525

2626
LOOP_TYPE="${1:?Usage: run-loop.sh <ci-fix|issue-triage|pr-review|dependency-upgrade|upstream-sync|all>}"
2727
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

.codebuddy/scripts/start-loops.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
set -euo pipefail
99

1010
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11-
PERSIST_FILE="/root/.local/share/loop-crontab"
11+
PERSIST_FILE="${HOME}/.local/share/loop-crontab"
1212

1313
# 1. Ensure cron daemon is running
1414
if ! pgrep -x cron >/dev/null 2>&1; then

0 commit comments

Comments
 (0)