From 51b255f00ad59a0b7d10fe1954d3e1c2045306ef Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Tue, 25 Jul 2023 04:24:19 +0200 Subject: [PATCH 1/1] document installer file --- asahi-installer-bootstrap.sh | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 asahi-installer-bootstrap.sh diff --git a/asahi-installer-bootstrap.sh b/asahi-installer-bootstrap.sh new file mode 100644 index 0000000..22009a1 --- /dev/null +++ b/asahi-installer-bootstrap.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# SPDX-License-Identifier: MIT + +set -e + +export LC_ALL=en_US.UTF-8 +export LANG=en_US.UTF-8 +export PATH="/usr/bin:/bin:/usr/sbin:/sbin:$PATH" + +export VERSION_FLAG=https://cdn.asahilinux.org/installer/latest +export INSTALLER_BASE=https://cdn.asahilinux.org/installer +export INSTALLER_DATA=https://tg.st/u/installer_data.json +export REPO_BASE=https://tg.st/u + +#TMP="$(mktemp -d)" +TMP=/tmp/asahi-install + +echo +echo "Bootstrapping installer:" + +if [ -e "$TMP" ]; then + mv "$TMP" "$TMP-$(date +%Y%m%d-%H%M%S)" +fi + +mkdir -p "$TMP" +cd "$TMP" + +echo " Checking version..." + +PKG_VER="$(curl --no-progress-meter -L "$VERSION_FLAG")" +echo " Version: $PKG_VER" + +PKG="installer-$PKG_VER.tar.gz" + +echo " Downloading..." + +curl --no-progress-meter -L -o "$PKG" "$INSTALLER_BASE/$PKG" +if ! curl --no-progress-meter -L -O "$INSTALLER_DATA"; then + echo " Error downloading installer_data.json." + exit 1 +fi + +echo " Extracting..." + +tar xf "$PKG" + +echo " Initializing..." +echo + +if [ "$USER" != "root" ]; then + echo "The installer needs to run as root." + echo "Please enter your sudo password if prompted." + exec caffeinate -dis sudo -E ./install.sh "$@" +else + exec caffeinate -dis ./install.sh "$@" +fi -- 2.39.5