403Webshell
Server IP : 104.129.129.72  /  Your IP : 216.73.216.229
Web Server : LiteSpeed
System : Linux 123answers 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64
User : answe8064 ( 1002)
PHP Version : 8.2.28
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /opt/installer/apps/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/installer/apps/cloudron-latest-offirepo-24.04
#!/bin/bash


if [ -f "include/startup.sh" ]; then
    . include/startup.sh
	
elif [ -f "../include/startup.sh" ]; then
    . ../include/startup.sh
fi

rootDir="$(rootDir)"
updateStatus="$rootDir/include/updateInstallStatus.sh"
LOG_PATH="/var/log/cloudron-setup.log"
WEB_PATH="/var/www/html"
HTML_PATH="/var/www/html/index.html"


updateAndFinalize() {
    local rootDir="$1"
    local CWM_DOMAIN="$2"

    # Target directories and files
    local html_target="/home/yellowtent/box/dashboard/dist/setupdns.html"
	local setup_target="/home/yellowtent/box/dashboard/dist/setup.html"
    local js_target_dir="/home/yellowtent/box/dashboard/dist/js"
    local js_target="${js_target_dir}/setupdns.js"

    # Check every if the directories and files exist
    while [[ ! -d "/home/yellowtent/box/dashboard/dist" || ! -d "$js_target_dir" ]]; do
        sleep 2
    done

    # Perform operations once the directories exist
    echo "Cloud-Ron Directories found. Performing operations..." | log

    # Replace placeholders in HTML and JS files
	sed -i "s/example.com/${CWM_DOMAIN}/g" "$setup_target"
    sed -i "s/example.com/${CWM_DOMAIN}/g" "$html_target"
    sed -i "s/example.com/${CWM_DOMAIN}/g" "$js_target"

    echo "Setup DNS files have been updated." | log
	
	# Touchups
	bash tweaks/motd-description-append
	bash tweaks/cwm-description-autoconfig
	
	echo "Adding descriptions" | log
	descriptionAppend "CloudRon Web UI: https://${CWM_DOMAIN}"
	descriptionAppend "SSL will be configured after the first step."
	
	# Cleanup
	echo "Cleaning up..." | log
	sleep 5
	systemctl stop apache2
	apt-get purge apache2 apache2-utils apache2-bin apache2.2-common
	rm -rf /etc/apache2
	apt-get autoremove -y
	apt-get autoclean -y
	
	end_time=$(date +%s)
	duration=$((end_time - start_time))
	echo "Installation completed in $duration seconds." | log
	
	tagScript success
	exit 0
}

#clear
echo "Downloading and installing CloudRon" | log
curlDownload https://cloudron.io/cloudron-setup
chmod u+x cloudron-setup

# Run the Cloudron setup and tee the output to both stdout and the log file
if [ ! -f "$LOG_PATH" ]; then
	touch "$LOG_PATH"
fi

echo "Enabling and starting cron service..." | log
sudo systemctl enable cron
sudo systemctl start cron

ubuntu_version=$(lsb_release -rs)
if [[ "$ubuntu_version" == "24.04" ]]; then
    echo "Adding shutdown cron job to root's crontab for Ubuntu 24..." | log
    CRON_JOB="@reboot ( /sbin/shutdown now; crontab -l | grep -v '@reboot /sbin/shutdown now' | crontab - )"
    (crontab -l 2>/dev/null | grep -F "$CRON_JOB") || (crontab -l 2>/dev/null; echo "$CRON_JOB") | sudo crontab -
    echo "Shutdown cron job added successfully. The system will shut down on next reboot." | log

else
    echo "This is not Ubuntu 24. Shutdown cron job will not be added." | log
fi

# Wait for App dir and replace files
echo "Starting listener for Cloud-Ron app dirs & DNS update..." | log
updateAndFinalize "$rootDir" "${CWM_DOMAIN}" &

echo "Running CloudRon setup..." | log
# Define lists to hold log messages
declare -a pre_display_list=()

start_time=$(date +%s)
echo Y | bash cloudron-setup | while IFS= read -r line; do
    # Check if the line contains "=>"
    if [[ "$line" == *"=>"* ]]; then
        # Process each line that contains "=>"
        line=$(echo "$line" | sed -e 's/installer://g' -e 's/start://g' -e 's/"$//' -e 's/  \+.*//')
        pre_display_list+=("$line")
        "$updateStatus" "$HTML_PATH" -cp
        
        for stage in "${pre_display_list[@]}"; do
            # Clean and append dots to the output
            cleaned_stage=$(echo "$stage" | sed 's/\.*$//')
            final_stage="${cleaned_stage}..."
            
            # Update the installation landing page
            "$updateStatus" "$HTML_PATH" -ap "${final_stage}"
        done
    fi
done

Youez - 2016 - github.com/yon3zu
LinuXploit