Skip to content

Commit

Permalink
Support download a specific alis version based on the commit hash
Browse files Browse the repository at this point in the history
  • Loading branch information
picodotdev committed Mar 22, 2022
1 parent 1fdb62c commit adfc7da
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -116,6 +116,7 @@ Advanced usage
# iwctl --passphrase "[WIFI_KEY]" station [WIFI_INTERFACE] connect "[WIFI_ESSID]" # (Optional) Connect to WIFI network. _ip link show_ to know WIFI_INTERFACE.
# curl -sL https://raw.githubusercontent.com/picodotdev/alis/master/download.sh | bash # Download alis scripts
# # curl -sL https://git.io/JeaH6 | bash # Alternative download URL with URL shortener
# # curl -sL https://raw.githubusercontent.com/picodotdev/alis/master/download.sh | bash -s -- -h f7f806ccd77aeec247b7a55ee7dad45f3bbbb799 # Use specific version of the script based on the commit hash
# ./alis-asciinema.sh # (Optional) Start asciinema video recording
# vim alis.conf # Edit configuration and change variables values with your preferences (system configuration)
# vim alis-packages.conf # (Optional) Edit configuration and change variables values with your preferences (packages to install)
Expand Down
23 changes: 18 additions & 5 deletions download-sid.sh
Expand Up @@ -6,10 +6,17 @@ set -eu
# Copyright (C) 2022 picodotdev

GITHUB_USER="picodotdev"
BRANCH="sid"
BRANCH="master"
HASH=""

while getopts "u:" arg; do
while getopts "b:h:u:" arg; do
case ${arg} in
b)
BRANCH="${OPTARG}"
;;
h)
HASH="${OPTARG}"
;;
u)
GITHUB_USER=${OPTARG}
;;
Expand All @@ -21,9 +28,15 @@ while getopts "u:" arg; do
done

set -o xtrace
curl -sL -o "alis-$BRANCH.zip" https://github.com/$GITHUB_USER/alis/archive/refs/heads/$BRANCH.zip
bsdtar -x -f "alis-$BRANCH.zip"
cp -R alis-$BRANCH/*.sh alis-$BRANCH/*.conf alis-$BRANCH/files/ alis-$BRANCH/configs/ ./
if [ -n "$HASH" ]; then
curl -sL -o "alis-$HASH.zip" https://github.com/$GITHUB_USER/alis/archive/$HASH.zip
bsdtar -x -f "alis-$HASH.zip"
cp -R alis-$HASH/*.sh alis-$HASH/*.conf alis-$HASH/files/ alis-$HASH/configs/ ./
else
curl -sL -o "alis-$BRANCH.zip" https://github.com/$GITHUB_USER/alis/archive/refs/heads/$BRANCH.zip
bsdtar -x -f "alis-$BRANCH.zip"
cp -R alis-$BRANCH/*.sh alis-$BRANCH/*.conf alis-$BRANCH/files/ alis-$BRANCH/configs/ ./
fi
chmod +x configs/*.sh
chmod +x *.sh

21 changes: 17 additions & 4 deletions download.sh
Expand Up @@ -7,9 +7,16 @@ set -eu

GITHUB_USER="picodotdev"
BRANCH="master"
HASH=""

while getopts "u:" arg; do
while getopts "b:h:u:" arg; do
case ${arg} in
b)
BRANCH="${OPTARG}"
;;
h)
HASH="${OPTARG}"
;;
u)
GITHUB_USER=${OPTARG}
;;
Expand All @@ -21,8 +28,14 @@ while getopts "u:" arg; do
done

set -o xtrace
curl -sL -o "alis-$BRANCH.zip" https://github.com/$GITHUB_USER/alis/archive/refs/heads/$BRANCH.zip
bsdtar -x -f "alis-$BRANCH.zip"
cp -R alis-$BRANCH/*.sh alis-$BRANCH/*.conf alis-$BRANCH/files/ alis-$BRANCH/configs/ ./
if [ -n "$HASH" ]; then
curl -sL -o "alis-$HASH.zip" https://github.com/$GITHUB_USER/alis/archive/$HASH.zip
bsdtar -x -f "alis-$HASH.zip"
cp -R alis-$HASH/*.sh alis-$HASH/*.conf alis-$HASH/files/ alis-$HASH/configs/ ./
else
curl -sL -o "alis-$BRANCH.zip" https://github.com/$GITHUB_USER/alis/archive/refs/heads/$BRANCH.zip
bsdtar -x -f "alis-$BRANCH.zip"
cp -R alis-$BRANCH/*.sh alis-$BRANCH/*.conf alis-$BRANCH/files/ alis-$BRANCH/configs/ ./
fi
chmod +x configs/*.sh
chmod +x *.sh

0 comments on commit adfc7da

Please sign in to comment.