Last active
September 2, 2018 20:50
-
-
Save axelrindle/2cc58e451b25e31d148e6e60fa754997 to your computer and use it in GitHub Desktop.
phpMyAdmin Updater Shell Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Directories | |
BASE_PATH="/mnt/1TBHDD/www" | |
BACKUP_DIR="$BASE_PATH/backup" | |
DOCROOT="$BASE_PATH/docroot" | |
APP_DIR="$DOCROOT/phpmyadmin" | |
# Ask for the latest version | |
printf " > Enter the latest phpMyAdmin version: " | |
read version | |
echo " > Create a backup of the config file..." | |
cp "$APP_DIR/config.inc.php" $BACKUP_DIR | |
echo " > Delete the old directory..." | |
rm -rf $APP_DIR | |
DL_DIR="phpMyAdmin-$version-all-languages" | |
DL_FILE="$DL_DIR.tar.gz" | |
DL_FILE_ABSOLUTE="$BASE_PATH/$DL_FILE" | |
DL_URL="https://files.phpmyadmin.net/phpMyAdmin/$version/$DL_FILE" | |
echo " > Download $DL_URL..." | |
wget -q $DL_URL -O $DL_FILE_ABSOLUTE | |
echo " > Extract new version to $APP_DIR..." | |
tar -xzf $DL_FILE_ABSOLUTE -C $DOCROOT | |
echo " > Rename extracted directory..." | |
mv "$DOCROOT/$DL_DIR" $APP_DIR | |
echo " > Restore config backup..." | |
cp "$BACKUP_DIR/config.inc.php" "$APP_DIR/config.inc.php" | |
echo " > Delete downloaded archive..." | |
rm $DL_FILE_ABSOLUTE | |
echo " > Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment