Update install.sh

This commit is contained in:
Stefan Pejcic 2025-02-16 15:13:48 +01:00 committed by GitHub
parent 54c05d18a7
commit d3316e0b8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,10 +48,6 @@ post_install_path="" # not to r
# PATHs used throughout the script # PATHs used throughout the script
ETC_DIR="/etc/openpanel/" # https://github.com/stefanpejcic/openpanel-configuration ETC_DIR="/etc/openpanel/" # https://github.com/stefanpejcic/openpanel-configuration
LOG_FILE="openpanel_install.log" # install log # install running LOG_FILE="openpanel_install.log" # install log # install running
OPENPANEL_DIR="/usr/local/panel" # currently only used to store version
OPENPADMIN_DIR="/usr/local/admin/" # https://github.com/stefanpejcic/openadmin/branches
OPENCLI_DIR="/usr/local/admin/scripts/" # https://dev.openpanel.com/cli/commands.html
OPENPANEL_ERR_DIR="/var/log/openpanel/" # https://dev.openpanel.com/logs.html
SERVICES_DIR="/etc/systemd/system/" # used for admin, sentinel and floatingip services SERVICES_DIR="/etc/systemd/system/" # used for admin, sentinel and floatingip services
CONFIG_FILE="${ETC_DIR}openpanel/conf/openpanel.config" # main config file for openpanel CONFIG_FILE="${ETC_DIR}openpanel/conf/openpanel.config" # main config file for openpanel
@ -488,7 +484,7 @@ detect_installed_panels() {
if [ -z "$SKIP_PANEL_CHECK" ]; then if [ -z "$SKIP_PANEL_CHECK" ]; then
# Define an associative array with key as the directory path and value as the error message # Define an associative array with key as the directory path and value as the error message
declare -A paths=( declare -A paths=(
["$OPENPANEL_DIR"]="You already have OpenPanel installed. ${RESET}\nInstead, did you want to update? Run ${GREEN}'opencli update --force' to update OpenPanel." ["/usr/local/admin/"]="You already have OpenPanel installed. ${RESET}\nInstead, did you want to update? Run ${GREEN}'opencli update --force' to update OpenPanel."
["/usr/local/cpanel/whostmgr"]="cPanel WHM is installed. OpenPanel only supports servers without any hosting control panel installed." ["/usr/local/cpanel/whostmgr"]="cPanel WHM is installed. OpenPanel only supports servers without any hosting control panel installed."
["/opt/psa/version"]="Plesk is installed. OpenPanel only supports servers without any hosting control panel installed." ["/opt/psa/version"]="Plesk is installed. OpenPanel only supports servers without any hosting control panel installed."
["/usr/local/psa/version"]="Plesk is installed. OpenPanel only supports servers without any hosting control panel installed." ["/usr/local/psa/version"]="Plesk is installed. OpenPanel only supports servers without any hosting control panel installed."
@ -968,7 +964,7 @@ set_logrotate(){
echo "Setting Logrotate for Nginx.." echo "Setting Logrotate for Nginx.."
bash /usr/local/admin/scripts/server/logrotate opencli server-logrotate
echo "Setting Logrotate for OpenPanel logs.." echo "Setting Logrotate for OpenPanel logs.."
@ -1194,17 +1190,9 @@ set_custom_hostname(){
opencli_setup(){ opencli_setup(){
echo "Downloading OpenCLI and adding to path.." echo "Downloading OpenCLI and adding to path.."
mkdir -p /usr/local/admin cd /usr/local
wget --timeout=30 -O /tmp/opencli.tar.gz "https://storage.googleapis.com/openpanel/${PANEL_VERSION}/opencli-main.tar.gz" > /dev/null 2>&1 || curl --silent --max-time 20 -4 -o /tmp/opencli.tar.gz "https://storage.googleapis.com/openpanel/${PANEL_VERSION}/opencli-main.tar.gz" || radovan 1 "download failed for https://storage.googleapis.com/openpanel/${PANEL_VERSION}/opencli-main.tar.gz" git clone https://github.com/stefanpejcic/opencli
mkdir -p /tmp/opencli ln -s /usr/local/opencli/opencli /usr/local/bin/opencli
cd /tmp/ && tar -xzf opencli.tar.gz -C /tmp/opencli
mkdir -p /usr/local/admin/scripts
cp -r /tmp/opencli/* /usr/local/admin/scripts > /dev/null 2>&1 || cp -r /tmp/opencli/opencli-main /usr/local/admin/scripts > /dev/null 2>&1 || radovan 1 "Fatal error extracting OpenCLI.."
rm /tmp/opencli.tar.gz > /dev/null 2>&1
rm -rf /tmp/opencli > /dev/null 2>&1
cp /usr/local/admin/scripts/opencli /usr/local/bin/opencli
chmod +x /usr/local/bin/opencli > /dev/null 2>&1
chmod +x -R /usr/local/admin/scripts/ > /dev/null 2>&1
echo "# opencli aliases echo "# opencli aliases
ALIASES_FILE=\"${OPENCLI_DIR}aliases.txt\" ALIASES_FILE=\"${OPENCLI_DIR}aliases.txt\"
generate_autocomplete() { generate_autocomplete() {
@ -1215,7 +1203,6 @@ opencli_setup(){
# Fix for: The command could not be located because '/usr/local/bin' is not included in the PATH environment variable. # Fix for: The command could not be located because '/usr/local/bin' is not included in the PATH environment variable.
export PATH="/usr/bin:$PATH" export PATH="/usr/bin:$PATH"
source ~/.bashrc source ~/.bashrc
echo "Testing 'opencli' commands:" echo "Testing 'opencli' commands:"
@ -1247,8 +1234,9 @@ set_premium_features(){
log_dirs() { log_dirs() {
mkdir -p ${OPENPANEL_ERR_DIR} ${OPENPANEL_ERR_DIR}user ${OPENPANEL_ERR_DIR}admin local error_dir="/var/log/openpanel/" # https://dev.openpanel.com/logs.html
chmod -R 755 $OPENPANEL_ERR_DIR mkdir -p ${error_dir} ${error_dir}user ${error_dir}admin
chmod -R 755 $error_dir
} }
@ -1622,19 +1610,21 @@ install_openadmin(){
# #
echo "Setting up OpenAdmin panel.." echo "Setting up OpenAdmin panel.."
local openadmin_dir="/usr/local/admin/"
if [ "$REPAIR" = true ]; then if [ "$REPAIR" = true ]; then
rm -rf $OPENPADMIN_DIR rm -rf $openadmin_dir
fi fi
mkdir -p $OPENPADMIN_DIR mkdir -p $openadmin_dir
debug_log echo "Downloading OpenAdmin files" debug_log echo "Downloading OpenAdmin files"
git clone -b 100 --single-branch https://github.com/stefanpejcic/openadmin $OPENPADMIN_DIR git clone -b 100 --single-branch https://github.com/stefanpejcic/openadmin $openadmin_dir
cd $OPENPADMIN_DIR cd $openadmin_dir
python3.12 -m venv ${OPENPADMIN_DIR}venv python3.12 -m venv ${openadmin_dir}venv
source ${OPENPADMIN_DIR}venv/bin/activate source ${openadmin_dir}venv/bin/activate
pip install --default-timeout=3600 --force-reinstall --ignore-installed -r requirements.txt > /dev/null 2>&1 || pip install --default-timeout=3600 --force-reinstall --ignore-installed -r requirements.txt --break-system-packages > /dev/null 2>&1 pip install --default-timeout=3600 --force-reinstall --ignore-installed -r requirements.txt > /dev/null 2>&1 || pip install --default-timeout=3600 --force-reinstall --ignore-installed -r requirements.txt --break-system-packages > /dev/null 2>&1
# on debian12 yaml is also needed to read conf files! # on debian12 yaml is also needed to read conf files!
@ -1678,10 +1668,7 @@ create_admin_and_show_logins_success_message() {
ln -s ${ETC_DIR}ssh/admin_welcome.sh /etc/profile.d/welcome.sh ln -s ${ETC_DIR}ssh/admin_welcome.sh /etc/profile.d/welcome.sh
chmod +x /etc/profile.d/welcome.sh chmod +x /etc/profile.d/welcome.sh
#cp version file echo -e "${GREEN}OpenPanel ${LICENSE} $PANEL_VERSION installation complete.${RESET}"
mkdir -p $OPENPANEL_DIR > /dev/null 2>&1
echo "$PANEL_VERSION" > $OPENPANEL_DIR/version
echo -e "${GREEN}OpenPanel ${LICENSE} [$(cat $OPENPANEL_DIR/version)] installation complete.${RESET}"
echo "" echo ""
# added in 0.2.3 # added in 0.2.3