mirror of
https://github.com/golang/go
synced 2024-09-18 15:32:18 +00:00
parent
27772eb00d
commit
2113e97e83
|
@ -7,60 +7,15 @@
|
|||
# downloaded from the ICANN/IANA distribution.
|
||||
# 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.
|
||||
WORK_DIRECTORY_PATH="/tmp/Go-Time/work"
|
||||
ZONE_INFO_DIRECTORY_PATH="$WORK_DIRECTORY_PATH/zoneinfo"
|
||||
CODE=2021a
|
||||
DATA=2021a
|
||||
|
||||
if [ -d "${WORK_DIRECTORY_PATH}" ]; then
|
||||
rm -rf ${WORK_DIRECTORY_PATH}
|
||||
fi
|
||||
if [ ! -d "${WORK_DIRECTORY_PATH}" ]; then
|
||||
mkdir -p ${WORK_DIRECTORY_PATH}
|
||||
fi
|
||||
if [ ! -d "${ZONE_INFO_DIRECTORY_PATH}" ]; then
|
||||
mkdir -p ${ZONE_INFO_DIRECTORY_PATH}
|
||||
fi
|
||||
|
||||
set -e
|
||||
rm -rf work
|
||||
mkdir work
|
||||
cd work
|
||||
mkdir zoneinfo
|
||||
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
|
||||
tar xzf tzcode$CODE.tar.gz
|
||||
|
|
Loading…
Reference in a new issue