Update INSTALL.sh

This commit is contained in:
Stefan Pejcic 2024-11-26 20:21:47 +01:00 committed by GitHub
parent 3568aedfca
commit cd54ecef7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,45 +17,16 @@
# ======================================================================
# Constants
# COLORS
GREEN='\033[0;32m' GREEN='\033[0;32m'
YELLOW='\033[0;33m' YELLOW='\033[0;33m'
RED='\033[0;31m' RED='\033[0;31m'
RESET='\033[0m' RESET='\033[0m'
export TERM=xterm-256color # bug fix: tput: No value for $TERM and no -T specified
# tput: No value for $TERM and no -T specified # ======================================================================
export TERM=xterm-256color # Defaults for environment variables
# DEFAULTS
CUSTOM_VERSION=false # default version is latest CUSTOM_VERSION=false # default version is latest
INSTALL_TIMEOUT=600 # after 10min, consider the install failed INSTALL_TIMEOUT=600 # after 10min, consider the install failed
DEBUG=false # verbose output for debugging failed install DEBUG=false # verbose output for debugging failed install
@ -77,7 +48,8 @@ SET_ADMIN_USERNAME=false # random
SET_ADMIN_PASSWORD=false # random SET_ADMIN_PASSWORD=false # random
SCREENSHOTS_API_URL="http://screenshots-api.openpanel.com/screenshot" # default since 0.2.1 SCREENSHOTS_API_URL="http://screenshots-api.openpanel.com/screenshot" # default since 0.2.1
# PATHS # ======================================================================
# 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 LOG_FILE="openpanel_install.log" # install log
LOCK_FILE="/root/openpanel.lock" # install running LOCK_FILE="/root/openpanel.lock" # install running
@ -94,15 +66,8 @@ exec > >(tee -a "$LOG_FILE") 2>&1
# ======================================================================
# Helper functions that are not mandatory and should not be modified
#####################################################################
# #
# START helper functions #
# #
#####################################################################
# logo # logo
print_header() { print_header() {
@ -298,33 +263,11 @@ display_what_will_be_installed(){
# ======================================================================
# Core program logic
setup_progress_bar_script setup_progress_bar_script
source "$PROGRESS_BAR_FILE" # Source the progress bar script
# Source the progress bar script
source "$PROGRESS_BAR_FILE"
# Dsiplay progress bar
FUNCTIONS=( FUNCTIONS=(
detect_os_and_package_manager # detect os and package manager detect_os_and_package_manager # detect os and package manager
display_what_will_be_installed # display os, version, ip display_what_will_be_installed # display os, version, ip
@ -363,16 +306,12 @@ update_progress() {
} }
main() { main() {
# Make sure that the progress bar is cleaned up when user presses ctrl+c enable_trapping # clean on CTRL+C
enable_trapping setup_scroll_area # load progress bar
# Create progress bar
setup_scroll_area
for func in "${FUNCTIONS[@]}" for func in "${FUNCTIONS[@]}"
do do
# Execute each function $func # Execute each function
$func update_progress # update progress after each
update_progress
done done
destroy_scroll_area destroy_scroll_area
} }
@ -380,20 +319,6 @@ main() {
# END helper functions
#####################################################################
# #
# START main functions #
# #
#####################################################################
check_requirements() { check_requirements() {
if [ -z "$SKIP_REQUIREMENTS" ]; then if [ -z "$SKIP_REQUIREMENTS" ]; then
@ -431,6 +356,9 @@ check_requirements() {
parse_args() { parse_args() {
# ======================================================================
# Usage info
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."
@ -464,7 +392,8 @@ parse_args() {
# ======================================================================
# Change defaults
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
--key=*) --key=*)
@ -1686,28 +1615,48 @@ setup_swap(){
support_message() { support_message() {
echo ""
echo "🎉 Welcome aboard and thank you for choosing OpenPanel! 🎉" DISCORD_INVITE_URL="https://discord.openpanel.com/"
echo "" FORUMS_LINK="https://community.openpanel.org/"
echo "Your journey with OpenPanel has just begun, and we're here to help every step of the way." DOCS_LINK="https://openpanel.com/docs/admin/intro/"
echo "" DOCS_GET_STARTED_LINK="https://openpanel.com/docs/admin/intro/#post-install-steps"
echo "To get started, check out our Getting Started guide:" GITHUB_LINK="https://github.com/stefanpejcic/OpenPanel/"
echo "👉 https://openpanel.com/docs/admin/intro/#post-install-steps" TICKETS_URL="https://my.openpanel.com/submitticket.php?step=2&deptid=2"
echo ""
echo "Need assistance or looking to learn more? We've got you covered:" support_message_for_enterprise() {
echo "" echo ""
echo "📚 Admin Docs: Dive into our comprehensive documentation for all things OpenPanel:" echo "🎉 Welcome aboard and thank you for choosing OpenPanel Enterprise edition! 🎉"
echo "👉 https://openpanel.com/docs/admin/intro/" echo ""
echo "" echo "Need assistance or looking to learn more? We've got you covered:"
echo "💬 Forums: Join our community forum to ask questions, share tips, and connect with fellow admins:" echo " - Check the Admin Docs: $DOCS_LINK"
echo "👉 https://community.openpanel.org/" echo " - Open Support Ticket: $TICKETS_URL"
echo "" echo " - Chat with us on Discord: $DISCORD_INVITE_URL"
echo "🎮 Discord: For real-time chat and support, hop into our Discord server:" echo ""
echo "👉 https://discord.openpanel.com/" }
echo ""
echo "We're thrilled to have you with us. Let's make something amazing together! 🚀" support_message_for_community() {
echo "" echo ""
echo "🎉 Welcome aboard and thank you for choosing OpenPanel! 🎉"
echo ""
echo "To get started, check out our Post Install Steps:"
echo "👉 $DOCS_GET_STARTED_LINK"
echo ""
echo "Join our community and connect with us on::"
echo " - Github: $GITHUB_LINK"
echo " - Discord: $DISCORD_INVITE_URL"
echo " - Our community forums: $FORUMS_LINK"
echo ""
}
if [[ "$LICENSE" == "Enterprise" ]]; then
support_message_for_enterprise
else
support_message_for_community
fi
} }
panel_customize(){ panel_customize(){
@ -1860,63 +1809,25 @@ create_admin_and_show_logins_success_message() {
} }
# END main functions
# ======================================================================
# Main program
# shellcheck disable=SC2068
#####################################################################
# #
# START main script execution #
# #
#####################################################################
parse_args "$@" parse_args "$@"
get_server_ipv4 get_server_ipv4
detect_filesystem detect_filesystem
set_version_to_install set_version_to_install
print_header print_header
check_requirements check_requirements
detect_installed_panels detect_installed_panels
check_lock_file_age check_lock_file_age
install_started_message install_started_message
main main
rm_helpers rm_helpers
print_space_and_line print_space_and_line
support_message support_message
print_space_and_line print_space_and_line
send_install_log send_install_log
create_admin_and_show_logins_success_message create_admin_and_show_logins_success_message
run_custom_postinstall_script run_custom_postinstall_script
# END main script execution