36 lines
958 B
Bash
36 lines
958 B
Bash
#!/bin/bash
|
|
|
|
# Define directories and files
|
|
REPO_DIR="$HOME/GR-Jukebox"
|
|
VERSION_FILE_PATH="$REPO_DIR/version.txt"
|
|
INSTALLED_VERSION_FILE="$HOME/version.txt"
|
|
|
|
# Function to get version from a file
|
|
get_version() {
|
|
if [[ -f "$1" ]]; then
|
|
cat "$1"
|
|
else
|
|
echo "0"
|
|
fi
|
|
}
|
|
|
|
# Read the currently installed version and the version in the repository
|
|
INSTALLED_VERSION=$(get_version "$INSTALLED_VERSION_FILE")
|
|
REPO_VERSION=$(get_version "$VERSION_FILE_PATH")
|
|
|
|
echo "Installed version: $INSTALLED_VERSION"
|
|
|
|
# Check if installed version matches the version in the repository directory
|
|
if [[ "$INSTALLED_VERSION" != "$REPO_VERSION" ]]; then
|
|
echo "Version mismatch. Running install script and exiting updater."
|
|
echo "New version: $REPO_VERSION"
|
|
/bin/bash "$REPO_DIR/install.sh"
|
|
( /bin/bash "$HOME/update.sh" & )
|
|
exit 0
|
|
fi
|
|
|
|
( /bin/bash "$HOME/pull_from_cloud.sh" & )
|
|
|
|
source "$HOME/jukebox/bin/activate"
|
|
python3 "$HOME/main1.py"
|