Skip to content

Commit

Permalink
grrr
Browse files Browse the repository at this point in the history
  • Loading branch information
jawshoeadan committed Jan 11, 2025
1 parent 5bd6004 commit 0c769d9
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ check_package() {
local package_name=$1
local repo_url=$2
local egg_name=$3
local needs_update=0

echo "Checking $package_name..."

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

if [ -z "$installed_commit" ]; then
echo "Unable to determine installed commit hash for $package_name."
return 1
needs_update=1
elif [ "${latest_commit:0:${#installed_commit}}" != "$installed_commit" ]; then
echo "New version available for $package_name."
return 1
needs_update=1
else
echo "$package_name is up to date."
return 0
needs_update=0
fi

return $needs_update
}

# Activate the virtual environment
echo "Activating virtual environment..."
source ./venv/bin/activate

# Check both packages and update JitStreamer if needed
# Initialize update flag
needs_update=0

if ! check_package "JitStreamer" "https://github.com/jawshoeadan/JitStreamer.git" "JitStreamer" || \
! check_package "pymobiledevice3" "https://github.com/jawshoeadan/pymobiledevice3.git" "pymobiledevice3"; then
echo "Updates needed - installing latest JitStreamer..."
pip install --upgrade "git+https://github.com/jawshoeadan/JitStreamer.git#egg=JitStreamer"
# Check JitStreamer
check_package "JitStreamer" "https://github.com/jawshoeadan/JitStreamer.git" "JitStreamer"
if [ $? -eq 1 ]; then
needs_update=1
fi

# Check pymobiledevice3
check_package "pymobiledevice3" "https://github.com/jawshoeadan/pymobiledevice3.git" "pymobiledevice3"
if [ $? -eq 1 ]; then
needs_update=1
fi

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

# Update Tailscale
echo "Updating Tailscale..."
sudo tailscale update
echo "All updates completed."

0 comments on commit 0c769d9

Please sign in to comment.