From dd0b3c6538642c99f1e25a26276fe72293d5c273 Mon Sep 17 00:00:00 2001 From: MickLesk Date: Mon, 18 May 2026 14:27:58 +0200 Subject: [PATCH] fix(fleet): downgrade version from 13 to 12 in configuration files and scripts fix(invidious): correct indentation in version retrieval fix(fleet-install): switch from MariaDB to MySQL setup and update database creation logic fix(tools): add MySQL repository handling in helper functions --- ct/fleet.sh | 2 +- ct/invidious.sh | 2 +- install/fleet-install.sh | 21 +++++++++++------ json/fleet.json | 2 +- misc/tools.func | 49 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 66 insertions(+), 10 deletions(-) diff --git a/ct/fleet.sh b/ct/fleet.sh index d6af25b5..05b7904c 100644 --- a/ct/fleet.sh +++ b/ct/fleet.sh @@ -11,7 +11,7 @@ var_cpu="${var_cpu:-2}" var_ram="${var_ram:-2048}" var_disk="${var_disk:-8}" var_os="${var_os:-debian}" -var_version="${var_version:-13}" +var_version="${var_version:-12}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" diff --git a/ct/invidious.sh b/ct/invidious.sh index 816a1601..35da1a48 100644 --- a/ct/invidious.sh +++ b/ct/invidious.sh @@ -46,7 +46,7 @@ function update_script() { msg_info "Rebuilding Invidious" cd /opt/invidious - INVIDIOUS_VERSION="$(cat ~/.invidious 2>/dev/null || echo "unknown")" + INVIDIOUS_VERSION="$(cat ~/.invidious 2>/dev/null || echo "unknown")" INVIDIOUS_VERSION="${INVIDIOUS_VERSION#v}" sed -i \ -e "s~^\(\s*CURRENT_BRANCH\s*=\).*~\1 \"master\"~" \ diff --git a/install/fleet-install.sh b/install/fleet-install.sh index b026e89f..ad657947 100644 --- a/install/fleet-install.sh +++ b/install/fleet-install.sh @@ -13,8 +13,15 @@ setting_up_container network_check update_os -setup_mariadb -MARIADB_DB_NAME="fleet" MARIADB_DB_USER="fleet" setup_mariadb_db +setup_mysql + +msg_info "Setting up MySQL Database" +DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +mysql -uroot -e "CREATE DATABASE IF NOT EXISTS fleet CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" +mysql -uroot -e "CREATE USER IF NOT EXISTS 'fleet'@'localhost' IDENTIFIED BY '${DB_PASS}';" +mysql -uroot -e "GRANT ALL PRIVILEGES ON fleet.* TO 'fleet'@'localhost';" +mysql -uroot -e "FLUSH PRIVILEGES;" +msg_ok "Set up MySQL Database" msg_info "Installing Dependencies" $STD apt install -y redis-server @@ -27,9 +34,9 @@ chmod +x /opt/fleet/fleet PRIVATE_KEY=$(openssl rand -hex 32) cat </opt/fleet/.env FLEET_MYSQL_ADDRESS=127.0.0.1:3306 -FLEET_MYSQL_DATABASE=${MARIADB_DB_NAME} -FLEET_MYSQL_USERNAME=${MARIADB_DB_USER} -FLEET_MYSQL_PASSWORD=${MARIADB_DB_PASS} +FLEET_MYSQL_DATABASE=fleet +FLEET_MYSQL_USERNAME=fleet +FLEET_MYSQL_PASSWORD=${DB_PASS} FLEET_SERVER_ADDRESS=0.0.0.0:8080 FLEET_SERVER_TLS=false FLEET_SERVER_PRIVATE_KEY=${PRIVATE_KEY} @@ -47,8 +54,8 @@ msg_info "Creating Service" cat </etc/systemd/system/fleet.service [Unit] Description=Fleet -After=network.target mariadb.service redis-server.service -Requires=mariadb.service redis-server.service +After=network.target mysql.service redis-server.service +Requires=mysql.service redis-server.service [Service] Type=simple diff --git a/json/fleet.json b/json/fleet.json index 7b503307..423cd14f 100644 --- a/json/fleet.json +++ b/json/fleet.json @@ -23,7 +23,7 @@ "ram": 2048, "hdd": 8, "os": "Debian", - "version": "13" + "version": "12" } } ], diff --git a/misc/tools.func b/misc/tools.func index 9c62c7ee..18538e87 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -894,6 +894,55 @@ Suites: $distro_codename-pgdg Components: main Architectures: $(dpkg --print-architecture) Signed-By: /etc/apt/keyrings/postgresql.gpg +EOF + return 0 + ;; + + mysql) + if [[ -z "$repo_url" || -z "$gpg_key_url" ]]; then + msg_error "MySQL repository requires repo_url and gpg_key_url" + return 65 + fi + + cleanup_old_repo_files "mysql" + + if ! download_gpg_key "$gpg_key_url" "/etc/apt/keyrings/mysql.gpg" "dearmor"; then + msg_error "Failed to import MySQL GPG key" + return 7 + fi + chmod 644 "/etc/apt/keyrings/mysql.gpg" + + local distro_codename + distro_codename=$(awk -F= '/^VERSION_CODENAME=/{print $2}' /etc/os-release) + + if [[ "$distro_id" == "debian" ]]; then + case "$distro_codename" in + bookworm | bullseye) suite="$distro_codename" ;; + *) suite="bookworm" ;; + esac + elif [[ "$distro_id" == "ubuntu" ]]; then + case "$distro_codename" in + noble | jammy) suite="$distro_codename" ;; + *) suite="noble" ;; + esac + else + suite=$(get_fallback_suite "$distro_id" "$distro_codename" "$repo_url") + fi + + local component + if [[ "$version" == "8.4" ]]; then + component="mysql-8.4-lts" + else + component="mysql-${version}" + fi + + cat >/etc/apt/sources.list.d/mysql.sources <