#!/bin/bash set -e # # Froxlor for Linux installation script # # !!! EXPERIMENTAL VERSION AHEAD !!! # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # # This script is meant for quick & easy install via: # $ curl -fsSL https://get.froxlor.dev | sudo bash # SCRIPT_VERSION="develop" source /etc/os-release # test if the terminal supports colors if test -t 1; then ncolors=$(which tput >/dev/null && tput colors) if test -n "$ncolors" && test "$ncolors" -ge 8; then termcols=$(tput cols) bold="$(tput bold)" underline="$(tput smul)" standout="$(tput smso)" normal="$(tput sgr0)" black="$(tput setaf 0)" red="$(tput setaf 1)" green="$(tput setaf 2)" yellow="$(tput setaf 3)" blue="$(tput setaf 4)" magenta="$(tput setaf 5)" cyan="$(tput setaf 6)" white="$(tput setaf 7)" fi fi # # The main installation script # do_install() { # Root Check if [ "$EUID" -ne 0 ]; then alert "Please run as root (e.g. with sudo)" exit 1 fi # Variables LOG_FILE="/var/log/froxlor-install.log" INSTALL_DIR="/opt/froxlor" COMPOSE_FILE="$INSTALL_DIR/docker-compose.yml" ENV_FILE="$INSTALL_DIR/froxlor.env" mkdir -p /var/log touch "$LOG_FILE" # Logging aktivieren exec > >(tee -a "$LOG_FILE") 2>&1 intro echo step "Installation started at $(date)" step "Checking prerequisites" export DEBIAN_FRONTEND=noninteractive apt-get update -qq >>$log 2>&1 # Server IP while [[ -z $serveripv4 ]]; do serveripv4="$(curl -fsSL4 https://get.froxlor.org/ip.php)" if [[ $noninteractive == 0 ]]; then read -r -e -p " Enter the public server IPv4: " -i "$serveripv4" serveripv4 /dev/null; then step "Docker not found, installing" apt update apt install -y ca-certificates curl gnupg lsb-release install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg chmod a+r /etc/apt/keyrings/docker.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \ https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo $VERSION_CODENAME) stable" \ > /etc/apt/sources.list.d/docker.list apt update apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin systemctl enable docker systemctl start docker else step "Docker already installed" fi # Docker Compose prüfen if ! docker compose version &> /dev/null; then step "Install Docker Compose Plugin" apt update apt install -y docker-compose-plugin fi step "Create directory $INSTALL_DIR" mkdir -p "$INSTALL_DIR" # Starke Passwörter generieren if [ ! -f "$ENV_FILE" ]; then step "Create froxlor envinonment file $ENV_FILE" MYSQL_PASSWORD=$(openssl rand -base64 16) cat > "$ENV_FILE" < <| | (_) | | ${normal}" echo -e " ${bold}${green}|_| |_| \___/_/\_\_|\___/|_| ${normal}" echo echo -e " ${bold}${green}Welcome to the froxlor for Linux installation script ($SCRIPT_VERSION)${normal}" echo echo -e " We guide you through the installation steps and setup your system :)" echo if [[ $noninteractive == 1 ]]; then echo -e " ${bold}${green}Running in noninteractive mode. ${normal}" echo fi echo "${green}================================================================================${normal}" } alert() { echo echo "${red}================================================================================${normal}" echo echo -e " ${bold}${yellow}${1}${normal}" echo echo -e " ${2}" echo echo "${red}================================================================================${normal}" } section() { echo echo "${white}================================================================================${normal}" echo echo -e " ${bold}${white}${1}${normal}" echo echo "${white}================================================================================${normal}" } finish() { echo echo "${green}================================================================================${normal}" echo echo -e " ${bold}${green}The installation of froxlor was successful!${normal}" echo echo -e " ${bold}${green}Your environment variables are stored in: ${2}${normal}" echo -e " ${bold}${green}Log file is stored in: ${3}${normal}" echo echo -e " ${bold}${green}You can enter http://${4}:8000 to access your panel!${normal}" echo echo "${green}================================================================================${normal}" } # # Call the installer at the end of the script, so we make sure all functions # are defined and not got cut off by curl, wget or something else... # do_install