From 3912767cd0c9278bd7f16ea8ca604087690e21f6 Mon Sep 17 00:00:00 2001 From: Muhammad Rivan Date: Fri, 11 Jun 2021 20:48:43 +0700 Subject: [PATCH] Improve stability --- install.sh | 2 +- lib-core.sh | 1 + lib-install.sh | 22 +++++++++++++++++----- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 664d0e0..7aed090 100755 --- a/install.sh +++ b/install.sh @@ -121,7 +121,7 @@ else if [[ "${interactive}" == 'true' ]]; then show_panel_opacity_dialog; show_sidebar_size_dialog; show_nautilus_style_dialog - prompt -w "DIALOG: '--size' and '--panel' parameters are ignored if exist."; echo + echo; prompt -w "DIALOG: '--size' and '--panel' parameters are ignored if exist."; echo else show_needed_dialogs fi diff --git a/lib-core.sh b/lib-core.sh index 349c809..52b70d2 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 9a98522..cd9f53c 100755 --- a/lib-install.sh +++ b/lib-install.sh @@ -62,8 +62,8 @@ prepare_deps() { if (( remote_time_int > local_time_int )); then prompt -w "\n DEPS: Your system clock is wrong" - prompt -i "DEPS: Updating your system clock and try again...\n" - sudo date -s "${remote_time}"; sudo hwclock --systohc + prompt -i "DEPS: Updating your system clock...\n" + sudo date -s "${remote_time}" &> /dev/null; sudo hwclock --systohc fi } @@ -111,6 +111,18 @@ install_swupd_packages() { done } +prepare_apt() { + [[ "${apt_prepared}" == "true" ]] && return 0 + + if ! sudo apt update; then + prompt -w "\n APT: Your repo lists are broken" + prompt -i "APT: Full-cleaning your repo lists and try again...\n" + sudo apt clean; sudo rm -rf /var/lib/apt/lists; sudo apt update + fi + + apt_prepared="true" +} + prepare_xbps() { [[ "${xbps_prepared}" == "true" ]] && return 0 @@ -138,7 +150,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 @@ -170,7 +182,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 @@ -198,7 +210,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