Files
fdroid-frajul/hosting/update.sh
T

55 lines
1.1 KiB
Bash

#! /bin/bash
if [ ! -d "/code/.git" ]; then
echo "Performing initial setup!"
mkdir /code
echo "Cloning repository..."
git clone --branch "$BRANCH" "$REPO_URL" "/code"
echo "Decrypting secrets..."
cd /code
./scripts/decrypt.sh
echo "Done"
fi
echo "Running regular repo update..."
echo ""
cd "/code"
git fetch origin
LOCAL=$(git rev-parse HEAD)
REMOTE=$(git rev-parse "origin/$BRANCH")
NEED_FDROID_UPDATE=false
# Update repo
if [ "$LOCAL" != "$REMOTE" ]; then
NEED_FDROID_UPDATE=true
echo "Pulling repo..."
git pull "origin/$BRANCH"
echo "Pull complete"
echo "Decrypting secrets..."
./scripts/decrypt.sh
echo "Done"
else
echo "No changes in repo."
fi
# Update apks
echo "Updating apks..."
./scripts/update-apks.sh
if [ $? -eq 10 ]; then
NEED_FDROID_UPDATE=true
fi
# Run fdroid update if needed
if [ "$NEED_FDROID_UPDATE" = true ]; then
echo "Running fdroid update..."
fdroid update -c
fdroid update
echo "Done"
else
echo "No changes made so no fdroid update necessary."
echo "Done"
fi