From 48e228adad4138e6e8114d6d8af128479275f838 Mon Sep 17 00:00:00 2001 From: Elara Musayelyan Date: Wed, 9 Aug 2023 19:49:57 -0700 Subject: [PATCH] Redirect to gitea instead of using static install script --- src/routes/install/+page.server.js | 5 ++ static/install | 82 ------------------------------ 2 files changed, 5 insertions(+), 82 deletions(-) create mode 100644 src/routes/install/+page.server.js delete mode 100644 static/install diff --git a/src/routes/install/+page.server.js b/src/routes/install/+page.server.js new file mode 100644 index 0000000..fd9b813 --- /dev/null +++ b/src/routes/install/+page.server.js @@ -0,0 +1,5 @@ +import { redirect } from '@sveltejs/kit'; + +export function load() { + throw redirect(302, 'https://gitea.elara.ws/Elara6331/lure/raw/branch/master/scripts/install.sh'); +} \ No newline at end of file diff --git a/static/install b/static/install deleted file mode 100644 index a64e0bd..0000000 --- a/static/install +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash - -info() { - echo $'\x1b[32m[INFO]\x1b[0m' $@ -} - -warn() { - echo $'\x1b[31m[WARN]\x1b[0m' $@ -} - -error() { - echo $'\x1b[31;1m[ERR]\x1b[0m' $@ - exit 1 -} - -installPkg() { - rootCmd="" - if command -v doas &>/dev/null; then - rootCmd="doas" - elif command -v sudo &>/dev/null; then - rootCmd="sudo" - else - warn "No privilege elevation command (e.g. sudo, doas) detected" - fi - - case $1 in - pacman) $rootCmd pacman --noconfirm -U ${@:2} ;; - apk) $rootCmd apk add --allow-untrusted ${@:2} ;; - *) $rootCmd $1 install -y ${@:2} ;; - esac -} - -if ! command -v curl &>/dev/null; then - error "This script requires the curl command. Please install it and run again." -fi - -pkgFormat="" -pkgMgr="" -if command -v pacman &>/dev/null; then - info "Detected pacman" - pkgFormat="pkg.tar.zst" - pkgMgr="pacman" -elif command -v apt &>/dev/null; then - info "Detected apt" - pkgFormat="deb" - pkgMgr="apt" -elif command -v dnf &>/dev/null; then - info "Detected dnf" - pkgFormat="rpm" - pkgMgr="dnf" -elif command -v yum &>/dev/null; then - info "Detected yum" - pkgFormat="rpm" - pkgMgr="yum" -elif command -v zypper &>/dev/null; then - info "Detected zypper" - pkgFormat="rpm" - pkgMgr="zypper" -elif command -v apk &>/dev/null; then - info "Detected apk" - pkgFormat="apk" - pkgMgr="apk" -else - error "No supported package manager detected!" -fi - -latestVersion=$(curl -sI 'https://gitea.elara.ws/Elara6331/lure/releases/latest' | grep -io 'location: .*' | rev | cut -d '/' -f1 | rev | tr -d '[:space:]') -info "Found latest LURE version:" $latestVersion - -fname="$(mktemp -u -p /tmp "lure.XXXXXXXXXX").${pkgFormat}" -url="https://gitea.elara.ws/Elara6331/lure/releases/download/${latestVersion}/linux-user-repository-${latestVersion#v}-linux-$(uname -m).${pkgFormat}" - -info "Downloading LURE package" -curl -L $url -o $fname - -info "Installing LURE package" -installPkg $pkgMgr $fname - -info "Cleaning up" -rm $fname - -info "Done!"