-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-latest-stage3
executable file
·42 lines (35 loc) · 1.4 KB
/
get-latest-stage3
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
#!/bin/bash
# https://codefather.tech/blog/bash-get-script-directory/
DIRNAME=$(dirname "${BASH_SOURCE[0]}")
SCRIPT_DIR=$(cd "${DIRNAME}" && pwd)
DESTINATION="${SCRIPT_DIR}/stage3"
case ${GENTOO_DESKTOP} in
"y")
function stage3Download() {
printf "\n"
mkdir -p "${SCRIPT_DIR}/stage3"
echo -e "\e[33m\xe2\x8f\xb3 Downloading the stage 3 tarball... \e[m"
LATEST=$(wget --quiet https://distfiles.gentoo.org/releases/amd64/autobuilds/latest-stage3-desktop-openrc.txt -O-| tail -n 1 | cut -d " " -f 1)
BASENAME=$(basename "${LATEST}")
wget -q --show-progress "http://distfiles.gentoo.org/releases/amd64/autobuilds/${LATEST}" -O "${DESTINATION}/${BASENAME}"
BASENAME=$(basename "${STAGE3}")
wget -q --show-progress "${STAGE3}" -O "${DESTINATION}/${BASENAME}"
}
;;
"n")
function stage3Download() {
printf "\n"
mkdir -p "${SCRIPT_DIR}/stage3"
echo -e "\e[33m\xe2\x8f\xb3 Downloading the stage 3 tarball... \e[m"
LATEST=$(wget --quiet https://distfiles.gentoo.org/releases/amd64/autobuilds/latest-stage3-amd64-openrc.txt -O-| tail -n 1 | cut -d " " -f 1)
BASENAME=$(basename "${LATEST}")
wget -q --show-progress "http://distfiles.gentoo.org/releases/amd64/autobuilds/${LATEST}" -O "${DESTINATION}/${BASENAME}"
BASENAME=$(basename "${STAGE3}")
wget -q --show-progress "${STAGE3}" -O "${DESTINATION}/${BASENAME}"
}
;;
*)
echo "Error in script: 'get-latest-stage3'"
return 1
;;
stage3Download