]>
Commit | Line | Data |
---|---|---|
51b255f0 TG |
1 | #!/bin/sh |
2 | # SPDX-License-Identifier: MIT | |
3 | ||
4 | set -e | |
5 | ||
6 | export LC_ALL=en_US.UTF-8 | |
7 | export LANG=en_US.UTF-8 | |
8 | export PATH="/usr/bin:/bin:/usr/sbin:/sbin:$PATH" | |
9 | ||
10 | export VERSION_FLAG=https://cdn.asahilinux.org/installer/latest | |
11 | export INSTALLER_BASE=https://cdn.asahilinux.org/installer | |
12 | export INSTALLER_DATA=https://tg.st/u/installer_data.json | |
13 | export REPO_BASE=https://tg.st/u | |
14 | ||
15 | #TMP="$(mktemp -d)" | |
16 | TMP=/tmp/asahi-install | |
17 | ||
18 | echo | |
19 | echo "Bootstrapping installer:" | |
20 | ||
21 | if [ -e "$TMP" ]; then | |
22 | mv "$TMP" "$TMP-$(date +%Y%m%d-%H%M%S)" | |
23 | fi | |
24 | ||
25 | mkdir -p "$TMP" | |
26 | cd "$TMP" | |
27 | ||
28 | echo " Checking version..." | |
29 | ||
30 | PKG_VER="$(curl --no-progress-meter -L "$VERSION_FLAG")" | |
31 | echo " Version: $PKG_VER" | |
32 | ||
33 | PKG="installer-$PKG_VER.tar.gz" | |
34 | ||
35 | echo " Downloading..." | |
36 | ||
37 | curl --no-progress-meter -L -o "$PKG" "$INSTALLER_BASE/$PKG" | |
38 | if ! curl --no-progress-meter -L -O "$INSTALLER_DATA"; then | |
39 | echo " Error downloading installer_data.json." | |
40 | exit 1 | |
41 | fi | |
42 | ||
43 | echo " Extracting..." | |
44 | ||
45 | tar xf "$PKG" | |
46 | ||
47 | echo " Initializing..." | |
48 | echo | |
49 | ||
50 | if [ "$USER" != "root" ]; then | |
51 | echo "The installer needs to run as root." | |
52 | echo "Please enter your sudo password if prompted." | |
53 | exec caffeinate -dis sudo -E ./install.sh "$@" | |
54 | else | |
55 | exec caffeinate -dis ./install.sh "$@" | |
56 | fi |