Skip to content

Commit 0c769d9

Browse files
committed
grrr
1 parent 5bd6004 commit 0c769d9

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

update.sh

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ check_package() {
44
local package_name=$1
55
local repo_url=$2
66
local egg_name=$3
7+
local needs_update=0
78

89
echo "Checking $package_name..."
910

@@ -21,36 +22,43 @@ check_package() {
2122

2223
if [ -z "$installed_commit" ]; then
2324
echo "Unable to determine installed commit hash for $package_name."
24-
return 1
25+
needs_update=1
2526
elif [ "${latest_commit:0:${#installed_commit}}" != "$installed_commit" ]; then
2627
echo "New version available for $package_name."
27-
return 1
28+
needs_update=1
2829
else
2930
echo "$package_name is up to date."
30-
return 0
31+
needs_update=0
3132
fi
33+
34+
return $needs_update
3235
}
3336

3437
# Activate the virtual environment
3538
echo "Activating virtual environment..."
3639
source ./venv/bin/activate
3740

38-
# Check both packages and update JitStreamer if needed
41+
# Initialize update flag
3942
needs_update=0
4043

41-
if ! check_package "JitStreamer" "https://github.com/jawshoeadan/JitStreamer.git" "JitStreamer" || \
42-
! check_package "pymobiledevice3" "https://github.com/jawshoeadan/pymobiledevice3.git" "pymobiledevice3"; then
43-
echo "Updates needed - installing latest JitStreamer..."
44-
pip install --upgrade "git+https://github.com/jawshoeadan/JitStreamer.git#egg=JitStreamer"
44+
# Check JitStreamer
45+
check_package "JitStreamer" "https://github.com/jawshoeadan/JitStreamer.git" "JitStreamer"
46+
if [ $? -eq 1 ]; then
47+
needs_update=1
48+
fi
49+
50+
# Check pymobiledevice3
51+
check_package "pymobiledevice3" "https://github.com/jawshoeadan/pymobiledevice3.git" "pymobiledevice3"
52+
if [ $? -eq 1 ]; then
53+
needs_update=1
4554
fi
4655

47-
# If either package needs an update, install latest JitStreamer
48-
if [ $jitstreamer_status -eq 1 ] || [ $pymd3_status -eq 1 ]; then
56+
# If either package needed an update, install latest JitStreamer
57+
if [ $needs_update -eq 1 ]; then
4958
echo "Updates needed - installing latest JitStreamer..."
5059
pip install --upgrade "git+https://github.com/jawshoeadan/JitStreamer.git#egg=JitStreamer"
5160
fi
5261

53-
# Update Tailscale
5462
echo "Updating Tailscale..."
5563
sudo tailscale update
5664
echo "All updates completed."

0 commit comments

Comments
 (0)