mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
fix: simplify beforeInstall.sh by removing OS checks and focusing on nginx backup
This commit is contained in:
parent
65040dec6f
commit
719eff3827
1 changed files with 4 additions and 36 deletions
|
|
@ -15,40 +15,8 @@ function do_and_check_cmd() {
|
|||
return 0
|
||||
}
|
||||
|
||||
# Check the os running
|
||||
if [ -f /etc/os-release ]; then
|
||||
# shellcheck disable=SC1091
|
||||
. /etc/os-release
|
||||
OS=$NAME
|
||||
if [[ "$OS" == "Ubuntu" || "$OS" == "Debian" ]]; then
|
||||
# Get the version of the package
|
||||
VERSION=$(dpkg-query -W -f='${Version}' bunkerweb)
|
||||
if dpkg --compare-versions "$VERSION" lt "1.6.0-beta" && [ -f /var/tmp/variables.env ] && [ -f /var/tmp/ui.env ]; then
|
||||
echo "ℹ️ Copy /var/tmp/variables.env to /etc/bunkerweb/variables.env"
|
||||
do_and_check_cmd cp -f /var/tmp/variables.env /etc/bunkerweb/variables.env
|
||||
echo "ℹ️ Copy /var/tmp/ui.env to /etc/bunkerweb/ui.env"
|
||||
do_and_check_cmd cp -f /var/tmp/ui.env /etc/bunkerweb/ui.env
|
||||
fi
|
||||
elif [[ "$OS" == "Red Hat Enterprise Linux" || "$OS" == "Fedora" ]]; then
|
||||
# Get the version of the package
|
||||
VERSION=$(rpm -q --queryformat '%{VERSION}' bunkerweb)
|
||||
if [ "$(printf '%s\n' "$VERSION" "$(echo '1.6.0-beta' | tr -d ' ')" | sort -V | head -n 1)" = "$VERSION" ] && [ -f /var/tmp/variables.env ] && [ -f /var/tmp/ui.env ]; then
|
||||
echo "ℹ️ Copy /var/tmp/variables.env to /etc/bunkerweb/variables.env"
|
||||
do_and_check_cmd cp -f /var/tmp/variables.env /etc/bunkerweb/variables.env
|
||||
echo "ℹ️ Copy /var/tmp/ui.env to /etc/bunkerweb/ui.env"
|
||||
do_and_check_cmd cp -f /var/tmp/ui.env /etc/bunkerweb/ui.env
|
||||
fi
|
||||
fi
|
||||
if [ -f /var/tmp/db.sqlite3 ]; then
|
||||
echo "ℹ️ Copy /var/tmp/db.sqlite3 to /var/lib/bunkerweb/db.sqlite3"
|
||||
do_and_check_cmd cp -f /var/tmp/db.sqlite3 /var/lib/bunkerweb/db.sqlite3
|
||||
fi
|
||||
if [ -d /etc/nginx ]; then
|
||||
output_path="/etc/nginx_backup_$(date +%s)"
|
||||
echo "ℹ️ Copy /etc/nginx to $output_path"
|
||||
do_and_check_cmd cp -R /etc/nginx $output_path
|
||||
fi
|
||||
else
|
||||
echo "❌ Error: /etc/os-release not found"
|
||||
exit 1
|
||||
if [ -d /etc/nginx ]; then
|
||||
output_path="/etc/nginx_backup_$(date +%s)"
|
||||
echo "ℹ️ Copy /etc/nginx to $output_path"
|
||||
do_and_check_cmd cp -R /etc/nginx "$output_path"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue