forked from picodotdev/alis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
download.sh
executable file
·46 lines (42 loc) · 1.15 KB
/
download.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
#shellcheck disable=SC2034
#SC2034: foo appears unused. Verify it or export it.
set -eu
# Arch Linux Install Script (alis) installs unattended, automated
# and customized Arch Linux system.
# Copyright (C) 2022 picodotdev
GITHUB_USER="picodotdev"
BRANCH="master"
HASH=""
ARTIFACT="alis-${BRANCH}"
while getopts "b:h:u:" arg; do
case ${arg} in
b)
BRANCH="${OPTARG}"
ARTIFACT="alis-${BRANCH}"
;;
h)
HASH="${OPTARG}"
ARTIFACT="alis-${HASH}"
;;
u)
GITHUB_USER=${OPTARG}
;;
?)
echo "Invalid option: -${OPTARG}."
exit 1
;;
esac
done
set -o xtrace
if [ -n "$HASH" ]; then
curl -sL -o "${ARTIFACT}.zip" "https://github.com/${GITHUB_USER}/alis/archive/${HASH}.zip"
bsdtar -x -f "${ARTIFACT}.zip"
cp -R "${ARTIFACT}"/*.sh "${ARTIFACT}"/*.conf "${ARTIFACT}"/files/ "${ARTIFACT}"/configs/ ./
else
curl -sL -o "${ARTIFACT}.zip" "https://github.com/${GITHUB_USER}/alis/archive/refs/heads/${BRANCH}.zip"
bsdtar -x -f "${ARTIFACT}.zip"
cp -R "${ARTIFACT}"/*.sh "${ARTIFACT}"/*.conf "${ARTIFACT}"/files/ "${ARTIFACT}"/configs/ ./
fi
chmod +x configs/*.sh
chmod +x ./*.sh