mirror of https://github.com/golang/go.git
parent
27772eb00d
commit
2113e97e83
|
|
@ -7,60 +7,15 @@
|
||||||
# downloaded from the ICANN/IANA distribution.
|
# downloaded from the ICANN/IANA distribution.
|
||||||
# Consult https://www.iana.org/time-zones for the latest versions.
|
# Consult https://www.iana.org/time-zones for the latest versions.
|
||||||
|
|
||||||
# Detect Operating System
|
|
||||||
function dist-check() {
|
|
||||||
if [ -e /etc/os-release ]; then
|
|
||||||
# shellcheck disable=SC1091
|
|
||||||
source /etc/os-release
|
|
||||||
DISTRO=${ID}
|
|
||||||
DISTRO_VERSION=${VERSION_ID}
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check Operating System
|
|
||||||
dist-check
|
|
||||||
|
|
||||||
# Pre-Checks system requirements
|
|
||||||
function installing-system-requirements() {
|
|
||||||
if { [ "${DISTRO}" == "ubuntu" ] || [ "${DISTRO}" == "debian" ] || [ "${DISTRO}" == "raspbian" ] || [ "${DISTRO}" == "pop" ] || [ "${DISTRO}" == "kali" ] || [ "${DISTRO}" == "linuxmint" ] || [ "${DISTRO}" == "fedora" ] || [ "${DISTRO}" == "centos" ] || [ "${DISTRO}" == "rhel" ] || [ "${DISTRO}" == "arch" ] || [ "${DISTRO}" == "archarm" ] || [ "${DISTRO}" == "manjaro" ] || [ "${DISTRO}" == "alpine" ] || [ "${DISTRO}" == "freebsd" ]; }; then
|
|
||||||
if { [ ! -x "$(command -v curl)" ] || [ ! -x "$(command -v iptables)" ] || [ ! -x "$(command -v bc)" ] || [ ! -x "$(command -v jq)" ] || [ ! -x "$(command -v cron)" ] || [ ! -x "$(command -v sed)" ] || [ ! -x "$(command -v zip)" ] || [ ! -x "$(command -v unzip)" ] || [ ! -x "$(command -v grep)" ] || [ ! -x "$(command -v awk)" ] || [ ! -x "$(command -v shuf)" ] || [ ! -x "$(command -v openssl)" ]; }; then
|
|
||||||
if { [ "${DISTRO}" == "ubuntu" ] || [ "${DISTRO}" == "debian" ] || [ "${DISTRO}" == "raspbian" ] || [ "${DISTRO}" == "pop" ] || [ "${DISTRO}" == "kali" ] || [ "${DISTRO}" == "linuxmint" ]; }; then
|
|
||||||
apt-get update && apt-get install iptables curl coreutils bc jq sed e2fsprogs zip unzip grep gawk iproute2 systemd openssl cron -y
|
|
||||||
elif { [ "${DISTRO}" == "fedora" ] || [ "${DISTRO}" == "centos" ] || [ "${DISTRO}" == "rhel" ]; }; then
|
|
||||||
yum update -y && yum install iptables curl coreutils bc jq sed e2fsprogs zip unzip grep gawk systemd openssl cron -y
|
|
||||||
elif { [ "${DISTRO}" == "arch" ] || [ "${DISTRO}" == "archarm" ] || [ "${DISTRO}" == "manjaro" ]; }; then
|
|
||||||
pacman -Syu --noconfirm --needed iptables curl bc jq sed zip unzip grep gawk iproute2 systemd coreutils openssl cron
|
|
||||||
elif [ "${DISTRO}" == "alpine" ]; then
|
|
||||||
apk update && apk add iptables curl bc jq sed zip unzip grep gawk iproute2 systemd coreutils openssl cron
|
|
||||||
elif [ "${DISTRO}" == "freebsd" ]; then
|
|
||||||
pkg update && pkg install curl jq zip unzip gawk openssl cron
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Error: ${DISTRO} not supported."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Run the function and check for requirements
|
|
||||||
installing-system-requirements
|
|
||||||
|
|
||||||
# Versions to use.
|
# Versions to use.
|
||||||
WORK_DIRECTORY_PATH="/tmp/Go-Time/work"
|
|
||||||
ZONE_INFO_DIRECTORY_PATH="$WORK_DIRECTORY_PATH/zoneinfo"
|
|
||||||
CODE=2021a
|
CODE=2021a
|
||||||
DATA=2021a
|
DATA=2021a
|
||||||
|
|
||||||
if [ -d "${WORK_DIRECTORY_PATH}" ]; then
|
set -e
|
||||||
rm -rf ${WORK_DIRECTORY_PATH}
|
rm -rf work
|
||||||
fi
|
mkdir work
|
||||||
if [ ! -d "${WORK_DIRECTORY_PATH}" ]; then
|
cd work
|
||||||
mkdir -p ${WORK_DIRECTORY_PATH}
|
mkdir zoneinfo
|
||||||
fi
|
|
||||||
if [ ! -d "${ZONE_INFO_DIRECTORY_PATH}" ]; then
|
|
||||||
mkdir -p ${ZONE_INFO_DIRECTORY_PATH}
|
|
||||||
fi
|
|
||||||
|
|
||||||
curl -L -O https://www.iana.org/time-zones/repository/releases/tzcode$CODE.tar.gz
|
curl -L -O https://www.iana.org/time-zones/repository/releases/tzcode$CODE.tar.gz
|
||||||
curl -L -O https://www.iana.org/time-zones/repository/releases/tzdata$DATA.tar.gz
|
curl -L -O https://www.iana.org/time-zones/repository/releases/tzdata$DATA.tar.gz
|
||||||
tar xzf tzcode$CODE.tar.gz
|
tar xzf tzcode$CODE.tar.gz
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue