Update install.sh

This commit is contained in:
Stefan Pejcic 2025-04-17 13:45:27 +02:00 committed by GitHub
parent e80fe5fec9
commit 2915f34e9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,7 +10,7 @@
# Usage: bash <(curl -sSL https://openpanel.org)
# Author: Stefan Pejcic <stefan@pejcic.rs>
# Created: 11.07.2023
# Last Modified: 11.05.2025
# Last Modified: 17.05.2025
#
################################################################################
@ -27,7 +27,6 @@ export DEBIAN_FRONTEND=noninteractive
# ======================================================================
# Defaults for environment variables
CUSTOM_VERSION=false # default version is latest
INSTALL_TIMEOUT=600 # after 10min, consider the install failed
DEBUG=false # verbose output for debugging failed install
SKIP_APT_UPDATE=false # they are auto-pulled on account creation
SKIP_DNS_SERVER=false
@ -38,7 +37,7 @@ SET_HOSTNAME_NOW=false # must be
SETUP_SWAP_ANYWAY=false
CORAZA=true # install CorazaWAF, unless user provices --no-waf flag
SWAP_FILE="1" # calculated based on ram
SEND_EMAIL_AFTER_INSTALL=false
SEND_EMAIL_AFTER_INSTALL=false # send admin logins to specified email
SET_PREMIUM=false # added in 0.2.1
UFW_SETUP=false # previous default on <0.2.3
CSF_SETUP=true # default since >0.2.2
@ -172,7 +171,6 @@ get_server_ipv4(){
! [[ $ip =~ ^192\.168\. ]]
}
if ! is_valid_ipv4 "$current_ip"; then
echo "Invalid or private IPv4 address: $current_ip. OpenPanel requires a public IPv4 address to bind Nginx configuration files."
fi
@ -590,19 +588,13 @@ docker_compose_up(){
source "$config_file"
fi
cp /etc/openpanel/mysql/initialize/1.1/plans.sql /root/initialize.sql > /dev/null 2>&1
# compose doesnt alllow /
cd /root
cd /root || radovan 1 "ERROR: Failed to change directory to /root. OpenPanel needs to be installed by the root user and have write access to the /root directory."
rm -rf /etc/my.cnf .env > /dev/null 2>&1 # on centos we get default my.cnf, and on repair we already have symlink and .env
cp /etc/openpanel/docker/compose/docker-compose.yml /root/docker-compose.yml > /dev/null 2>&1
cp /etc/openpanel/docker/compose/.env /root/.env > /dev/null 2>&1
sed -i "s/^VERSION=.*$/VERSION=\"$PANEL_VERSION\"/" /root/.env
@ -617,7 +609,6 @@ docker_compose_up(){
sed -i 's/password = .*/password = '"${MYSQL_ROOT_PASSWORD}"'/g' ${ETC_DIR}mysql/host_my.cnf > /dev/null 2>&1
sed -i 's/password = .*/password = '"${MYSQL_ROOT_PASSWORD}"'/g' ${ETC_DIR}mysql/container_my.cnf > /dev/null 2>&1
# added in 0.2.9
# fix for bug with mysql-server image on Almalinux 9.2
os_name=$(grep ^ID= /etc/os-release | cut -d'=' -f2 | tr -d '"')
@ -641,7 +632,6 @@ docker_compose_up(){
# todo: replace in docker-compose.yml if needed!
fi
# from 0.2.5 we only start mysql by default
cd /root && docker compose up -d openpanel_mysql > /dev/null 2>&1
@ -661,9 +651,7 @@ docker_compose_up(){
echo -e "[${GREEN}OK${RESET}] MySQL service started successfully."
fi
# needed from 1.0.0 for docker contexts to work both inside openpanel ui contianer nad host os
# needed from 1.0.0 for docker contexts to work both inside openpanel ui container and host os
ln -s / /hostfs > /dev/null 2>&1
}
@ -1557,6 +1545,14 @@ panel_customize(){
}
check_permissions_in_root_dir() {
local root_dir="/root"
# Check if user has read and write permissions
if ! [ -r "$root_dir" ] || ! [ -w "$root_dir" ]; then
radovan 1 "User $(whoami) does NOT have read and write permissions on $root_dir"
exit 1
fi
}
install_python312() {
OS=$(grep '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"')
@ -1817,6 +1813,7 @@ create_admin_and_show_logins_success_message() {
flock -n 200 || { echo "Error: Another instance of the install script is already running. Exiting."; exit 1; }
# shellcheck disable=SC2068
parse_args "$@"
check_permissions_in_root_dir
get_server_ipv4
set_version_to_install
print_header