2 changed files with 78 additions and 0 deletions
@ -0,0 +1,78 @@ |
|||||||
|
#!/usr/bin/env bash |
||||||
|
set -euo pipefail |
||||||
|
|
||||||
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" |
||||||
|
|
||||||
|
MODE="${MODE:-local}" # local or ssh |
||||||
|
if [[ "${1:-}" == "--ssh" ]]; then |
||||||
|
MODE="ssh" |
||||||
|
elif [[ "${1:-}" == "--local" ]]; then |
||||||
|
MODE="local" |
||||||
|
fi |
||||||
|
|
||||||
|
ADDONS_DIR="${ADDONS_DIR:-../Games/ascension-wow/drive_c/Program Files/Ascension Launcher/resources/client/Interface/AddOns}" |
||||||
|
MOUNT_DIR="${MOUNT_DIR:-$ROOT_DIR}" |
||||||
|
LOCAL_BASE="${LOCAL_BASE:-$ROOT_DIR}" |
||||||
|
|
||||||
|
SSH_USER="${SSH_USER:-$USER}" |
||||||
|
SSH_HOST="${SSH_HOST:-sarvern.no}" |
||||||
|
SSH_PORT="${SSH_PORT:-36}" |
||||||
|
SSH_REMOTE_BASE="${SSH_REMOTE_BASE:-/home/TradeSkillMaster}" |
||||||
|
|
||||||
|
ADDONS=( |
||||||
|
"TradeSkillMaster" |
||||||
|
"TradeSkillMaster_Accounting" |
||||||
|
"TradeSkillMaster_AuctionDB" |
||||||
|
"TradeSkillMaster_Auctioning" |
||||||
|
"TradeSkillMaster_Crafting" |
||||||
|
"TradeSkillMaster_Destroying" |
||||||
|
"TradeSkillMaster_ItemTracker" |
||||||
|
"TradeSkillMaster_Mailing" |
||||||
|
"TradeSkillMaster_Shopping" |
||||||
|
"TradeSkillMaster_Warehousing" |
||||||
|
) |
||||||
|
|
||||||
|
MOUNT_ITEMS=("scripts" "${ADDONS[@]}") |
||||||
|
|
||||||
|
if [[ "$MODE" == "ssh" ]]; then |
||||||
|
mkdir -p "$MOUNT_DIR" |
||||||
|
|
||||||
|
for item in "${MOUNT_ITEMS[@]}"; do |
||||||
|
target_path="${MOUNT_DIR}/${item}" |
||||||
|
mkdir -p "$target_path" |
||||||
|
|
||||||
|
if command -v mountpoint >/dev/null && mountpoint -q "$target_path"; then |
||||||
|
echo "Already mounted: $target_path" |
||||||
|
continue |
||||||
|
fi |
||||||
|
|
||||||
|
sshfs -p "$SSH_PORT" "$SSH_USER@$SSH_HOST:$SSH_REMOTE_BASE/$item" "$target_path" |
||||||
|
echo "Mounted $item" |
||||||
|
done |
||||||
|
|
||||||
|
SOURCE_BASE="$MOUNT_DIR" |
||||||
|
else |
||||||
|
SOURCE_BASE="$LOCAL_BASE" |
||||||
|
fi |
||||||
|
|
||||||
|
if [[ ! -d "$ADDONS_DIR" ]]; then |
||||||
|
echo "AddOns directory not found: $ADDONS_DIR" >&2 |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
|
||||||
|
for addon in "${ADDONS[@]}"; do |
||||||
|
live_path="${ADDONS_DIR}/${addon}" |
||||||
|
src_path="${SOURCE_BASE}/${addon}" |
||||||
|
|
||||||
|
if [[ ! -d "$src_path" ]]; then |
||||||
|
echo "Source addon folder missing: $src_path" >&2 |
||||||
|
continue |
||||||
|
fi |
||||||
|
|
||||||
|
if [[ -L "$live_path" || -d "$live_path" ]]; then |
||||||
|
rm -rf "$live_path" |
||||||
|
fi |
||||||
|
|
||||||
|
ln -s "$src_path" "$live_path" |
||||||
|
echo "Linked ${addon}" |
||||||
|
done |
||||||
Loading…
Reference in new issue