-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·126 lines (110 loc) · 4.52 KB
/
Copy pathupdate.sh
File metadata and controls
executable file
·126 lines (110 loc) · 4.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/env bash
# ─────────────────────────────────────────────────────────────────────
# HELLHOUND — Updater v12.5 (Cinematic)
# Pulls the latest changes from Git and refreshes the installation.
# ─────────────────────────────────────────────────────────────────────
set -e
RED="\033[91m"
GRN="\033[92m"
CYN="\033[96m"
YLW="\033[93m"
RST="\033[0m"
BLD="\033[1m"
info() { echo -e "${CYN}[*]${RST} $1"; }
success() { echo -e "${GRN}${BLD}[✓]${RST} $1"; }
warn() { echo -e "${YLW}[!]${RST} $1"; }
error() { echo -e "${RED}[✗]${RST} $1"; stop_animation; exit 1; }
# ── Animator Logic (Cinematic) ────────────────────────────────────────────────
ANIM_PID=0
start_animation() {
local label="$1"
stop_animation
# T31: Case-Wave for Label
# P33: Braille-Wave for Progress (Scaled to 'Ultra-Wide' 50 character bar)
python3 -c "
import math, time, sys
label = \"$label\"
def wave(label, t):
res = ''
for i, c in enumerate(label):
if not c.isalpha(): res += c; continue
v = math.sin(t * 10 + i * 0.4)
if v > 0: res += f'\033[91m\033[1m{c.upper()}\033[0m'
else: res += f'\033[31m{c.lower()}\033[0m'
return res
def braille(t):
chars = '⡀⡄⡆⡇⣇⣧⣷⣿'
bar = ''
for i in range(50):
idx = int((math.sin(t * 5 + i * 0.2) + 1) / 2 * (len(chars) - 1))
bar += f'\033[91m{chars[idx]}\033[0m'
return bar
start = time.time()
try:
while True:
t = time.time() - start
sys.stdout.write(f'\r {wave(label, t):<35} {braille(t)} ')
sys.stdout.flush()
time.sleep(0.06)
except:
pass
" &
ANIM_PID=$!
disown $ANIM_PID 2>/dev/null || true
}
stop_animation() {
if [ "$ANIM_PID" -ne 0 ]; then
kill -9 "$ANIM_PID" &>/dev/null || true
wait "$ANIM_PID" 2>/dev/null || true
# Clean the line thoroughly
printf "\r\033[2K\r"
ANIM_PID=0
fi
}
trap "stop_animation" EXIT INT TERM
# ── Check if Git repository ───────────────────────────────────────────────────
start_animation "VERIFYING SOURCE"
if [ ! -d ".git" ]; then
stop_animation
error "Not a git repository. Download the source via \"git clone\" to use the updater."
fi
# ── Remote Sync (Ensure Org URL) ──────────────────────────────────────────────
REMOTE_URL=$(git remote get-url origin 2>/dev/null || echo "")
if [[ "$REMOTE_URL" == *"l4zz3rj0d"* ]]; then
NEW_URL=$(echo "$REMOTE_URL" | sed "s/l4zz3rj0d/project-hellhound-org/g")
git remote set-url origin "$NEW_URL" &>/dev/null || true
fi
# ── Pull latest changes ───────────────────────────────────────────────────────
stop_animation
start_animation "FETCHING UPDATES"
LOCAL_CHANGES=$(git status --porcelain)
if [ -n "$LOCAL_CHANGES" ]; then
stop_animation
warn "Local changes detected — stashing to ensure a clean update..."
git stash
start_animation "FETCHING UPDATES"
fi
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "main")
stop_animation
info "Fetching updates from branch: $CURRENT_BRANCH..."
if git pull origin "$CURRENT_BRANCH"; then
success "Source code updated"
else
warn "Standard pull failed — attempting emergency fetch/reset..."
git fetch --all
git reset --hard origin/"$CURRENT_BRANCH" || warn "Could not pull latest changes."
fi
if [ -n "$LOCAL_CHANGES" ]; then
info "Restoring your local changes..."
git stash pop &>/dev/null || warn "Could not auto-apply local changes."
fi
# ── Run installer ─────────────────────────────────────────────────────────────
stop_animation
info "Synchronizing system configuration..."
chmod +x install.sh
if [ -f "install.sh" ]; then
./install.sh || true
fi
echo ""
echo -e " ${GRN}${BLD}Update complete.${RST} HELLHOUND is now on the latest version.\n"
echo ""