Improve stability
This commit is contained in:
parent
5be548be79
commit
5cbcb74b20
4 changed files with 37 additions and 21 deletions
|
@ -5,6 +5,8 @@
|
||||||
#
|
#
|
||||||
# WARNING: Don't use "cd" in this shell, use it in a subshell instead,
|
# WARNING: Don't use "cd" in this shell, use it in a subshell instead,
|
||||||
# for example ( cd blabla && do_blabla ) or $( cd .. && do_blabla )
|
# for example ( cd blabla && do_blabla ) or $( cd .. && do_blabla )
|
||||||
|
#
|
||||||
|
# SUGGESTION: Please don't put any dependency installation here
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# VARIABLES & HELP #
|
# VARIABLES & HELP #
|
||||||
|
@ -115,10 +117,9 @@ if [[ "${uninstall}" == 'true' ]]; then
|
||||||
remove_themes
|
remove_themes
|
||||||
prompt -s "Done! All '${name}' themes has been removed."
|
prompt -s "Done! All '${name}' themes has been removed."
|
||||||
else
|
else
|
||||||
install_theme_deps; echo
|
echo
|
||||||
|
|
||||||
if [[ "${interactive}" == 'true' ]]; then
|
if [[ "${interactive}" == 'true' ]]; then
|
||||||
install_dialog_deps
|
|
||||||
show_panel_opacity_dialog; show_sidebar_size_dialog; show_nautilus_style_dialog
|
show_panel_opacity_dialog; show_sidebar_size_dialog; show_nautilus_style_dialog
|
||||||
prompt -w "DIALOG: '--size' and '--panel' parameters are ignored if exist."; echo
|
prompt -w "DIALOG: '--size' and '--panel' parameters are ignored if exist."; echo
|
||||||
else
|
else
|
||||||
|
|
|
@ -137,7 +137,6 @@ swupd_packages=""
|
||||||
swupd_url="https://cdn.download.clearlinux.org/current/x86_64/os/Packages/"
|
swupd_url="https://cdn.download.clearlinux.org/current/x86_64/os/Packages/"
|
||||||
swupd_ver_url="https://cdn.download.clearlinux.org/latest"
|
swupd_ver_url="https://cdn.download.clearlinux.org/latest"
|
||||||
swupd_prepared="false"
|
swupd_prepared="false"
|
||||||
apt_prepared="false"
|
|
||||||
xbps_prepared="false"
|
xbps_prepared="false"
|
||||||
|
|
||||||
#------------Decoration-----------#
|
#------------Decoration-----------#
|
||||||
|
|
|
@ -40,9 +40,13 @@ WHITESUR_SOURCE+=("lib-install.sh")
|
||||||
# Some apt version doesn't update the repo list before it install some app.
|
# 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
|
# It may cause "unable to fetch..." when you're trying to install them
|
||||||
|
|
||||||
|
#--------------------OTHERS--------------------#
|
||||||
# Sometimes, some Ubuntu distro doesn't enable automatic time. This can cause
|
# Sometimes, some Ubuntu distro doesn't enable automatic time. This can cause
|
||||||
# 'Release file for ... is not valid yet'
|
# 'Release file for ... is not valid yet'. This may also happen on other distros
|
||||||
|
|
||||||
|
#============================================#
|
||||||
|
|
||||||
|
#-------------------Prepare------------------#
|
||||||
installation_sorry() {
|
installation_sorry() {
|
||||||
prompt -w "WARNING: We're sorry, your distro isn't officially supported yet."
|
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"
|
prompt -i "INSTRUCTION: Please make sure you have installed all of the required dependencies. We'll continue the installation in 15 seconds"
|
||||||
|
@ -50,6 +54,19 @@ installation_sorry() {
|
||||||
start_animation; sleep 15; stop_animation
|
start_animation; sleep 15; stop_animation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prepare_deps() {
|
||||||
|
local head="$(curl -Is -o - 'time.cloudflare.com' || wget -Sq -o - --max-redirect=0 'time.cloudflare.com')"
|
||||||
|
local remote_time="$(echo "${head}" | awk -F ': ' '/Date/{print $2}')"
|
||||||
|
local remote_time_int="$(date --date "${remote_time}" +"%Y%m%d")"
|
||||||
|
local local_time_int="$(date -u +"%Y%m%d")"
|
||||||
|
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
prepare_swupd() {
|
prepare_swupd() {
|
||||||
[[ "${swupd_prepared}" == "true" ]] && return 0
|
[[ "${swupd_prepared}" == "true" ]] && return 0
|
||||||
|
|
||||||
|
@ -94,16 +111,6 @@ install_swupd_packages() {
|
||||||
done
|
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() {
|
prepare_xbps() {
|
||||||
[[ "${xbps_prepared}" == "true" ]] && return 0
|
[[ "${xbps_prepared}" == "true" ]] && return 0
|
||||||
|
|
||||||
|
@ -117,10 +124,13 @@ prepare_xbps() {
|
||||||
xbps_prepared="true"
|
xbps_prepared="true"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-----------------Deps-----------------#
|
||||||
|
|
||||||
install_theme_deps() {
|
install_theme_deps() {
|
||||||
if ! has_command glib-compile-resources || ! has_command sassc || ! has_command xmllint ||
|
if ! has_command glib-compile-resources || ! has_command sassc || ! has_command xmllint ||
|
||||||
(! is_my_distro "clear-linux" && [[ ! -r "/usr/share/gtk-engines/murrine.xml" ]]); then
|
(! is_my_distro "clear-linux" && [[ ! -r "/usr/share/gtk-engines/murrine.xml" ]]); then
|
||||||
prompt -w "'glib2.0', 'sassc', 'xmllint', and 'libmurrine' are required for theme installation."
|
prompt -w "'glib2.0', 'sassc', 'xmllint', and 'libmurrine' are required for theme installation."
|
||||||
|
prepare_deps
|
||||||
|
|
||||||
if has_command zypper; then
|
if has_command zypper; then
|
||||||
sudo zypper in -y sassc glib2-devel gtk2-engine-murrine libxml2-tools
|
sudo zypper in -y sassc glib2-devel gtk2-engine-murrine libxml2-tools
|
||||||
|
@ -128,7 +138,7 @@ install_theme_deps() {
|
||||||
# Rolling release
|
# Rolling release
|
||||||
prepare_swupd && sudo swupd bundle-add libglib libxml2 && install_swupd_packages sassc libsass
|
prepare_swupd && sudo swupd bundle-add libglib libxml2 && install_swupd_packages sassc libsass
|
||||||
elif has_command apt; then
|
elif has_command apt; then
|
||||||
prepare_apt && sudo apt install -y sassc libglib2.0-dev-bin gtk2-engines-murrine libxml2-utils
|
sudo apt update && sudo apt install -y sassc libglib2.0-dev-bin gtk2-engines-murrine libxml2-utils
|
||||||
elif has_command dnf; then
|
elif has_command dnf; then
|
||||||
sudo dnf install -y sassc glib2-devel gtk-murrine-engine libxml2
|
sudo dnf install -y sassc glib2-devel gtk-murrine-engine libxml2
|
||||||
elif has_command yum; then
|
elif has_command yum; then
|
||||||
|
@ -152,6 +162,7 @@ install_theme_deps() {
|
||||||
install_beggy_deps() {
|
install_beggy_deps() {
|
||||||
if ! has_command convert; then
|
if ! has_command convert; then
|
||||||
prompt -w "'imagemagick' are required for background editing."
|
prompt -w "'imagemagick' are required for background editing."
|
||||||
|
prepare_deps
|
||||||
|
|
||||||
if has_command zypper; then
|
if has_command zypper; then
|
||||||
sudo zypper in -y ImageMagick
|
sudo zypper in -y ImageMagick
|
||||||
|
@ -159,7 +170,7 @@ install_beggy_deps() {
|
||||||
# Rolling release
|
# Rolling release
|
||||||
prepare_swupd && sudo swupd bundle-add ImageMagick
|
prepare_swupd && sudo swupd bundle-add ImageMagick
|
||||||
elif has_command apt; then
|
elif has_command apt; then
|
||||||
prepare_apt && sudo apt install -y imagemagick
|
sudo apt update && sudo apt install -y imagemagick
|
||||||
elif has_command dnf; then
|
elif has_command dnf; then
|
||||||
sudo dnf install -y ImageMagick
|
sudo dnf install -y ImageMagick
|
||||||
elif has_command yum; then
|
elif has_command yum; then
|
||||||
|
@ -179,6 +190,7 @@ install_beggy_deps() {
|
||||||
install_dialog_deps() {
|
install_dialog_deps() {
|
||||||
if ! has_command dialog; then
|
if ! has_command dialog; then
|
||||||
prompt -w "'dialog' is required for this option."
|
prompt -w "'dialog' is required for this option."
|
||||||
|
prepare_deps
|
||||||
|
|
||||||
if has_command zypper; then
|
if has_command zypper; then
|
||||||
sudo zypper in -y dialog
|
sudo zypper in -y dialog
|
||||||
|
@ -186,7 +198,7 @@ install_dialog_deps() {
|
||||||
# Rolling release
|
# Rolling release
|
||||||
prepare_swupd && install_swupd_packages dialog
|
prepare_swupd && install_swupd_packages dialog
|
||||||
elif has_command apt; then
|
elif has_command apt; then
|
||||||
prepare_apt && sudo apt install -y dialog
|
sudo apt update && sudo apt install -y dialog
|
||||||
elif has_command dnf; then
|
elif has_command dnf; then
|
||||||
sudo dnf install -y dialog
|
sudo dnf install -y dialog
|
||||||
elif has_command yum; then
|
elif has_command yum; then
|
||||||
|
@ -281,6 +293,8 @@ install_shelly() {
|
||||||
TARGET_DIR="${6}"
|
TARGET_DIR="${6}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
install_theme_deps
|
||||||
|
|
||||||
mkdir -p "${TARGET_DIR}"
|
mkdir -p "${TARGET_DIR}"
|
||||||
mkdir -p "${TARGET_DIR}/assets"
|
mkdir -p "${TARGET_DIR}/assets"
|
||||||
cp -r "${THEME_SRC_DIR}/assets/gnome-shell/icons" "${TARGET_DIR}"
|
cp -r "${THEME_SRC_DIR}/assets/gnome-shell/icons" "${TARGET_DIR}"
|
||||||
|
@ -438,7 +452,7 @@ install_themes() {
|
||||||
# "install_theemy" and "install_shelly" require "gtk_base", so multithreading
|
# "install_theemy" and "install_shelly" require "gtk_base", so multithreading
|
||||||
# isn't possible
|
# isn't possible
|
||||||
|
|
||||||
start_animation; install_beggy
|
install_theme_deps; start_animation; install_beggy
|
||||||
|
|
||||||
for opacity in "${opacities[@]}"; do
|
for opacity in "${opacities[@]}"; do
|
||||||
for alt in "${alts[@]}"; do
|
for alt in "${alts[@]}"; do
|
||||||
|
@ -729,20 +743,21 @@ customize_theme() {
|
||||||
# values are taken from _variables.scss
|
# values are taken from _variables.scss
|
||||||
|
|
||||||
show_panel_opacity_dialog() {
|
show_panel_opacity_dialog() {
|
||||||
|
install_dialog_deps
|
||||||
dialogify panel_opacity "${THEME_NAME}" "Choose your panel opacity (Default is 15)" ${PANEL_OPACITY_VARIANTS[*]}
|
dialogify panel_opacity "${THEME_NAME}" "Choose your panel opacity (Default is 15)" ${PANEL_OPACITY_VARIANTS[*]}
|
||||||
}
|
}
|
||||||
|
|
||||||
show_sidebar_size_dialog() {
|
show_sidebar_size_dialog() {
|
||||||
|
install_dialog_deps
|
||||||
dialogify sidebar_size "${THEME_NAME}" "Choose your Nautilus minimum sidebar size (default is 200px)" ${SIDEBAR_SIZE_VARIANTS[*]}
|
dialogify sidebar_size "${THEME_NAME}" "Choose your Nautilus minimum sidebar size (default is 200px)" ${SIDEBAR_SIZE_VARIANTS[*]}
|
||||||
}
|
}
|
||||||
|
|
||||||
show_nautilus_style_dialog() {
|
show_nautilus_style_dialog() {
|
||||||
|
install_dialog_deps
|
||||||
dialogify nautilus_style "${THEME_NAME}" "Choose your Nautilus style (default is BigSur-like style)" ${NAUTILUS_STYLE_VARIANTS[*]}
|
dialogify nautilus_style "${THEME_NAME}" "Choose your Nautilus style (default is BigSur-like style)" ${NAUTILUS_STYLE_VARIANTS[*]}
|
||||||
}
|
}
|
||||||
|
|
||||||
show_needed_dialogs() {
|
show_needed_dialogs() {
|
||||||
if [[ "${need_dialog[@]}" =~ "true" ]]; then install_dialog_deps; fi
|
|
||||||
|
|
||||||
if [[ "${need_dialog["-p"]}" == "true" ]]; then show_panel_opacity_dialog; fi
|
if [[ "${need_dialog["-p"]}" == "true" ]]; then show_panel_opacity_dialog; fi
|
||||||
if [[ "${need_dialog["-s"]}" == "true" ]]; then show_sidebar_size_dialog; fi
|
if [[ "${need_dialog["-s"]}" == "true" ]]; then show_sidebar_size_dialog; fi
|
||||||
if [[ "${need_dialog["-N"]}" == "true" ]]; then show_nautilus_style_dialog; fi
|
if [[ "${need_dialog["-N"]}" == "true" ]]; then show_nautilus_style_dialog; fi
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#
|
#
|
||||||
# WARNING: Don't use "cd" in this shell, use it in a subshell instead,
|
# WARNING: Don't use "cd" in this shell, use it in a subshell instead,
|
||||||
# for example ( cd blabla && do_blabla ) or $( cd .. && do_blabla )
|
# for example ( cd blabla && do_blabla ) or $( cd .. && do_blabla )
|
||||||
|
#
|
||||||
|
# SUGGESTION: Please don't put any dependency installation here
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# VARIABLES & HELP #
|
# VARIABLES & HELP #
|
||||||
|
@ -171,7 +173,6 @@ else
|
||||||
|
|
||||||
if [[ "${gdm}" == 'true' ]]; then
|
if [[ "${gdm}" == 'true' ]]; then
|
||||||
echo; prompt -i "Installing '${name}' GDM theme..."
|
echo; prompt -i "Installing '${name}' GDM theme..."
|
||||||
install_theme_deps; install_gdm_theme
|
|
||||||
echo; prompt -s "Done! '${name}' GDM theme has been installed."
|
echo; prompt -s "Done! '${name}' GDM theme has been installed."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue