From 5be548be7900759936c2c158870bcce3095a2f9d Mon Sep 17 00:00:00 2001 From: Muhammad Rivan Date: Fri, 11 Jun 2021 15:04:34 +0700 Subject: [PATCH] Improve stability --- lib-core.sh | 1 + lib-install.sh | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib-core.sh b/lib-core.sh index 349c8098..52b70d22 100755 --- a/lib-core.sh +++ b/lib-core.sh @@ -137,6 +137,7 @@ swupd_packages="" swupd_url="https://cdn.download.clearlinux.org/current/x86_64/os/Packages/" swupd_ver_url="https://cdn.download.clearlinux.org/latest" swupd_prepared="false" +apt_prepared="false" xbps_prepared="false" #------------Decoration-----------# diff --git a/lib-install.sh b/lib-install.sh index f1840e29..8cd7e49a 100755 --- a/lib-install.sh +++ b/lib-install.sh @@ -40,6 +40,9 @@ WHITESUR_SOURCE+=("lib-install.sh") # Some apt version doesn't update the repo list before it install some app. # It may cause "unable to fetch..." when you're trying to install them +# Sometimes, some Ubuntu distro doesn't enable automatic time. This can cause +# 'Release file for ... is not valid yet' + installation_sorry() { prompt -w "WARNING: We're sorry, your distro isn't officially supported yet." prompt -i "INSTRUCTION: Please make sure you have installed all of the required dependencies. We'll continue the installation in 15 seconds" @@ -91,6 +94,16 @@ install_swupd_packages() { done } +prepare_apt() { + [[ "${apt_prepared}" == "true" ]] && return 0 + + if ! sudo apt update && [[ "${?}" == "100" ]]; then + prompt -w "\n APT: Your system clock might be wrong" + prompt -i "APT: Updating your system clock and try again...\n" + sudo systemctl restart systemd-timesyncd; sudo apt update + fi +} + prepare_xbps() { [[ "${xbps_prepared}" == "true" ]] && return 0 @@ -115,7 +128,7 @@ install_theme_deps() { # Rolling release prepare_swupd && sudo swupd bundle-add libglib libxml2 && install_swupd_packages sassc libsass elif has_command apt; then - sudo apt update && sudo apt install -y sassc libglib2.0-dev-bin gtk2-engines-murrine libxml2-utils + prepare_apt && sudo apt install -y sassc libglib2.0-dev-bin gtk2-engines-murrine libxml2-utils elif has_command dnf; then sudo dnf install -y sassc glib2-devel gtk-murrine-engine libxml2 elif has_command yum; then @@ -146,7 +159,7 @@ install_beggy_deps() { # Rolling release prepare_swupd && sudo swupd bundle-add ImageMagick elif has_command apt; then - sudo apt update && sudo apt install -y imagemagick + prepare_apt && sudo apt install -y imagemagick elif has_command dnf; then sudo dnf install -y ImageMagick elif has_command yum; then @@ -173,7 +186,7 @@ install_dialog_deps() { # Rolling release prepare_swupd && install_swupd_packages dialog elif has_command apt; then - sudo apt update && sudo apt install -y dialog + prepare_apt && sudo apt install -y dialog elif has_command dnf; then sudo dnf install -y dialog elif has_command yum; then