From 46819f2686eb6c0b7ed7d5647ae1a3d523db6d9b Mon Sep 17 00:00:00 2001 From: kuwoyuki Date: Sun, 7 Dec 2025 15:48:12 +0600 Subject: [PATCH] fix: make shellcheck happy and use ssh agent fw --- binhost.sh | 2 +- gentoo-sync.sh | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/binhost.sh b/binhost.sh index 4f2824e..aa1db53 100755 --- a/binhost.sh +++ b/binhost.sh @@ -29,7 +29,7 @@ for type in "${CONFIGS[@]}"; do inject() { local src=$1 prefix=$2 [[ ! -e "$src" ]] && return - + if [[ -d "$src" ]]; then for f in "$src"/*; do [[ -f "$f" ]] && cp "$f" "$dest/${prefix}-$(basename "$f")" diff --git a/gentoo-sync.sh b/gentoo-sync.sh index 6027955..b8be674 100755 --- a/gentoo-sync.sh +++ b/gentoo-sync.sh @@ -7,10 +7,10 @@ HOSTNAME_TAG="${HOSTNAME:-$(hostname)}" # remote trigger SERVER_USER="mira" SERVER_IP="192.168.102.148" -SERVER_BINHOST_DIR="~/gentoo-pill" +SERVER_BINHOST_DIR="$HOME/gentoo-pill" HOST_DIR="$PILL_REPO/hosts/$HOSTNAME_TAG" -echo "> Syncing configuration for: $HOSTNAME_TAG" +echo "Syncing configuration for: $HOSTNAME_TAG" if [[ -d "$PILL_REPO/.git" ]]; then git -C "$PILL_REPO" pull --rebase --autostash @@ -21,16 +21,16 @@ fi mkdir -p "$HOST_DIR" -echo "> Syncing World file component..." +echo "Syncing World file component..." cp /var/lib/portage/world "$HOST_DIR/world" CONFIGS=(package.use package.accept_keywords package.license package.mask package.unmask package.env repos.conf) -echo "> Syncing Portage components..." +echo "Syncing Portage components..." for type in "${CONFIGS[@]}"; do local_src="/etc/portage/$type" repo_dest="$HOST_DIR/$type" - + # rm -rf "$repo_dest" if [[ -e "$local_src" ]]; then @@ -40,21 +40,21 @@ for type in "${CONFIGS[@]}"; do fi done -echo "> Pushing..." +echo "Pushing..." cd "$PILL_REPO" if [[ -n $(git status --porcelain) ]]; then git add . git commit -m "sync: $HOSTNAME_TAG $(date +'%Y-%m-%d %H:%M')" git push - echo "> Changes pushed successfully." - + echo "Changes pushed successfully." + # trigger the remote if [[ -n "$SERVER_IP" ]]; then - echo "> Triggering binhost build @ [$SERVER_IP]..." - ssh "${SERVER_USER}@${SERVER_IP}" \ - "cd ${SERVER_BINHOST_DIR} && ./binhost.sh" + echo "Triggering binhost build @ [$SERVER_IP]..." + ssh -A "${SERVER_USER}@${SERVER_IP}" \ + "cd \"${SERVER_BINHOST_DIR}\" && ./binhost.sh" fi else - echo "> No changes, binhost trig skipped" + echo "No changes, binhost trig skipped" fi