mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
Update INSTALL.sh
This commit is contained in:
parent
32c3d167eb
commit
7c00fa42bf
@ -35,42 +35,40 @@ RED='\033[0;31m'
|
|||||||
RESET='\033[0m'
|
RESET='\033[0m'
|
||||||
|
|
||||||
# Defaults
|
# Defaults
|
||||||
CUSTOM_VERSION=false
|
CUSTOM_VERSION=false #default is latest
|
||||||
INSTALL_TIMEOUT=600 # 10 min
|
INSTALL_TIMEOUT=600 # 10 min max
|
||||||
DEBUG=false
|
DEBUG=false #verbose output
|
||||||
SKIP_APT_UPDATE=false
|
SKIP_APT_UPDATE=false
|
||||||
SKIP_IMAGES=false
|
SKIP_IMAGES=false #downloaded on acc creation
|
||||||
REPAIR=false
|
REPAIR=false
|
||||||
LOCALES=true
|
LOCALES=true #only en
|
||||||
NO_SSH=false
|
NO_SSH=false #deny port 22
|
||||||
INSTALL_FTP=false
|
INSTALL_FTP=false #no ui
|
||||||
INSTALL_MAIL=false
|
INSTALL_MAIL=false #no ui
|
||||||
OVERLAY=false
|
OVERLAY=false # needed for ubuntu24 and debian12
|
||||||
IPSETS=true
|
IPSETS=true #currently only with ufw
|
||||||
SET_HOSTNAME_NOW=false
|
SET_HOSTNAME_NOW=false #FQDN
|
||||||
SETUP_SWAP_ANYWAY=false
|
SETUP_SWAP_ANYWAY=false
|
||||||
SWAP_FILE="1"
|
SWAP_FILE="1" #calculated based on ram
|
||||||
SELFHOSTED_SCREENSHOTS=false
|
SELFHOSTED_SCREENSHOTS=false
|
||||||
SEND_EMAIL_AFTER_INSTALL=false
|
SEND_EMAIL_AFTER_INSTALL=false
|
||||||
SET_PREMIUM=false
|
SET_PREMIUM=false #added in 0.2.1
|
||||||
UFW_SETUP=false
|
UFW_SETUP=false #previous default on <0.2.3
|
||||||
CSF_SETUP=true
|
CSF_SETUP=true #default since >0.2.2
|
||||||
|
SET_ADMIN_USERNAME=false #random
|
||||||
|
SET_ADMIN_PASSWORD=false #random
|
||||||
|
SCREENSHOTS_API_URL="http://screenshots-api.openpanel.co/screenshot" #default since 0.2.1
|
||||||
|
|
||||||
# Paths
|
# Paths
|
||||||
ETC_DIR="/etc/openpanel/"
|
ETC_DIR="/etc/openpanel/" #comf files
|
||||||
LOG_FILE="openpanel_install.log"
|
LOG_FILE="openpanel_install.log" #install log
|
||||||
LOCK_FILE="/root/openpanel.lock"
|
LOCK_FILE="/root/openpanel.lock" # install running
|
||||||
OPENPANEL_DIR="/usr/local/panel/"
|
OPENPANEL_DIR="/usr/local/panel/" #openpanel running successfully
|
||||||
OPENPADMIN_DIR="/usr/local/admin/"
|
OPENPADMIN_DIR="/usr/local/admin/" #openadmin files
|
||||||
OPENCLI_DIR="/usr/local/admin/scripts/"
|
OPENCLI_DIR="/usr/local/admin/scripts/" #opencli scripts
|
||||||
OPENPANEL_ERR_DIR="/var/log/openpanel/"
|
OPENPANEL_ERR_DIR="/var/log/openpanel/" #logs
|
||||||
SERVICES_DIR="/etc/systemd/system/"
|
SERVICES_DIR="/etc/systemd/system/" #services
|
||||||
TEMP_DIR="/tmp/"
|
TEMP_DIR="/tmp/" #cleaned at the end
|
||||||
|
|
||||||
# Domains
|
|
||||||
SCREENSHOTS_API_URL="http://screenshots-api.openpanel.co/screenshot"
|
|
||||||
|
|
||||||
# Redirect output to the log file
|
# Redirect output to the log file
|
||||||
exec > >(tee -a "$LOG_FILE") 2>&1
|
exec > >(tee -a "$LOG_FILE") 2>&1
|
||||||
@ -325,7 +323,9 @@ parse_args() {
|
|||||||
show_help() {
|
show_help() {
|
||||||
echo "Available options:"
|
echo "Available options:"
|
||||||
echo " --key=<key_here> Set the license key for OpenPanel Enterprise edition."
|
echo " --key=<key_here> Set the license key for OpenPanel Enterprise edition."
|
||||||
echo " --hostname=<hostname> Set the hostname."
|
echo " --hostname=<hostname> Set the hostname - must be FQDN, example: server.example.net."
|
||||||
|
echo " --username=<username> Set Admin username - random generated if not provided."
|
||||||
|
echo " --password=<password> Set Admin Password - random generated if not provided."
|
||||||
echo " --version=<version> Set a custom OpenPanel version to be installed."
|
echo " --version=<version> Set a custom OpenPanel version to be installed."
|
||||||
echo " --email=<stefan@example.net> Set email address to receive email with admin credentials and future notifications."
|
echo " --email=<stefan@example.net> Set email address to receive email with admin credentials and future notifications."
|
||||||
echo " --skip-requirements Skip the requirements check."
|
echo " --skip-requirements Skip the requirements check."
|
||||||
@ -366,6 +366,14 @@ while [[ $# -gt 0 ]]; do
|
|||||||
SET_HOSTNAME_NOW=true
|
SET_HOSTNAME_NOW=true
|
||||||
new_hostname="${1#*=}"
|
new_hostname="${1#*=}"
|
||||||
;;
|
;;
|
||||||
|
--username=*)
|
||||||
|
SET_ADMIN_USERNAME=true
|
||||||
|
custom_username="${1#*=}"
|
||||||
|
;;
|
||||||
|
--password=*)
|
||||||
|
SET_ADMIN_PASSWORD=true
|
||||||
|
custom_password="${1#*=}"
|
||||||
|
;;
|
||||||
--skip-requirements)
|
--skip-requirements)
|
||||||
SKIP_REQUIREMENTS=true
|
SKIP_REQUIREMENTS=true
|
||||||
;;
|
;;
|
||||||
@ -1325,11 +1333,21 @@ create_admin_and_show_logins_success_message() {
|
|||||||
exec > /dev/tty
|
exec > /dev/tty
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
# not saved in log!
|
# added in 0.2.3
|
||||||
|
# option to specify logins
|
||||||
|
if [ "$SET_ADMIN_USERNAME" = true ]; then
|
||||||
|
new_username=($custom_username)
|
||||||
|
else
|
||||||
wget -O /tmp/generate.sh https://gist.githubusercontent.com/stefanpejcic/905b7880d342438e9a2d2ffed799c8c6/raw/a1cdd0d2f7b28f4e9c3198e14539c4ebb9249910/random_username_generator_docker.sh > /dev/null 2>&1
|
wget -O /tmp/generate.sh https://gist.githubusercontent.com/stefanpejcic/905b7880d342438e9a2d2ffed799c8c6/raw/a1cdd0d2f7b28f4e9c3198e14539c4ebb9249910/random_username_generator_docker.sh > /dev/null 2>&1
|
||||||
source /tmp/generate.sh
|
source /tmp/generate.sh
|
||||||
new_username=($random_name)
|
new_username=($random_name)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$SET_ADMIN_PASSWORD" = true ]; then
|
||||||
|
new_password=($custom_password)
|
||||||
|
else
|
||||||
new_password=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16)
|
new_password=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16)
|
||||||
|
fi
|
||||||
|
|
||||||
sqlite3 /etc/openpanel/openadmin/users.db "CREATE TABLE IF NOT EXISTS user (id INTEGER PRIMARY KEY, username TEXT UNIQUE NOT NULL, password_hash TEXT NOT NULL, role TEXT NOT NULL DEFAULT 'user', is_active BOOLEAN DEFAULT 1 NOT NULL);" > /dev/null 2>&1 &&
|
sqlite3 /etc/openpanel/openadmin/users.db "CREATE TABLE IF NOT EXISTS user (id INTEGER PRIMARY KEY, username TEXT UNIQUE NOT NULL, password_hash TEXT NOT NULL, role TEXT NOT NULL DEFAULT 'user', is_active BOOLEAN DEFAULT 1 NOT NULL);" > /dev/null 2>&1 &&
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user