From 2113e97e837c1ef5de9ba6a7bd62db92e644c500 Mon Sep 17 00:00:00 2001 From: Prajwal Koirala <16564273+Prajwal-Koirala@users.noreply.github.com> Date: Mon, 15 Mar 2021 02:11:28 -0400 Subject: [PATCH] Revert "Update update.bash" This reverts commit 6247d933b311d709e8cd5c569c29e7fe09a98298. --- lib/time/update.bash | 55 ++++---------------------------------------- 1 file changed, 5 insertions(+), 50 deletions(-) diff --git a/lib/time/update.bash b/lib/time/update.bash index 3aefbb4910..e088ea6b90 100755 --- a/lib/time/update.bash +++ b/lib/time/update.bash @@ -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