Differenciate between error and abort signal
This commit is contained in:
parent
8886bea5c6
commit
b36a11b8c9
@ -3,8 +3,6 @@
|
|||||||
# WARNING: Please make this shell not working-directory dependant, for example
|
# WARNING: Please make this shell not working-directory dependant, for example
|
||||||
# instead of using 'ls blabla', use 'ls "${REPO_DIR}/blabla"'
|
# instead of using 'ls blabla', use 'ls "${REPO_DIR}/blabla"'
|
||||||
#
|
#
|
||||||
# WARNING: Please don't use sudo directly here since it steals our EXIT trap
|
|
||||||
#
|
|
||||||
# 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 )
|
||||||
|
|
||||||
|
94
lib-core.sh
94
lib-core.sh
@ -3,8 +3,6 @@
|
|||||||
#
|
#
|
||||||
# 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 )
|
||||||
#
|
|
||||||
# WARNING: Please don't use sudo directly here since it steals our EXIT trap
|
|
||||||
|
|
||||||
set -Eeo pipefail
|
set -Eeo pipefail
|
||||||
|
|
||||||
@ -20,8 +18,10 @@ WHITESUR_SOURCE=("lib-core.sh")
|
|||||||
# VARIABLES #
|
# VARIABLES #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
#--------------System--------------#
|
||||||
|
|
||||||
export WHITESUR_PID=$$
|
export WHITESUR_PID=$$
|
||||||
MY_USERNAME="$(logname 2> /dev/null || echo ${SUDO_USER:-${USER}})"
|
export MY_USERNAME="$(logname 2> /dev/null || echo ${SUDO_USER:-${USER}})"
|
||||||
|
|
||||||
if command -v gnome-shell &> /dev/null; then
|
if command -v gnome-shell &> /dev/null; then
|
||||||
if (( $(gnome-shell --version | cut -d ' ' -f 3 | cut -d . -f 1) >= 4 )); then
|
if (( $(gnome-shell --version | cut -d ' ' -f 3 | cut -d . -f 1) >= 4 )); then
|
||||||
@ -125,9 +125,9 @@ msg=""
|
|||||||
final_msg="Run '${0} --help' to explore more customization features!"
|
final_msg="Run '${0} --help' to explore more customization features!"
|
||||||
notif_msg=""
|
notif_msg=""
|
||||||
process_ids=()
|
process_ids=()
|
||||||
# This is important for 'rootify' and 'userify' because 'return "${result}"' is
|
# This is important for 'udu' because 'return "${result}"' is considered the
|
||||||
# considered the last command in 'BASH_COMMAND' variable
|
# last command in 'BASH_COMMAND' variable
|
||||||
error_snippet=""
|
WHITESUR_COMMAND=""
|
||||||
export ANIM_PID="0"
|
export ANIM_PID="0"
|
||||||
has_any_error="false"
|
has_any_error="false"
|
||||||
swupd_packages=""
|
swupd_packages=""
|
||||||
@ -135,14 +135,14 @@ 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"
|
||||||
|
|
||||||
#------Colors and animation--------#
|
#------------Decoration-----------#
|
||||||
c_default="\033[0m"
|
export c_default="\033[0m"
|
||||||
c_blue="\033[1;34m"
|
export c_blue="\033[1;34m"
|
||||||
c_magenta="\033[1;35m"
|
export c_magenta="\033[1;35m"
|
||||||
c_cyan="\033[1;36m"
|
export c_cyan="\033[1;36m"
|
||||||
c_green="\033[1;32m"
|
export c_green="\033[1;32m"
|
||||||
c_red="\033[1;31m"
|
export c_red="\033[1;31m"
|
||||||
c_yellow="\033[1;33m"
|
export c_yellow="\033[1;33m"
|
||||||
|
|
||||||
anim=(
|
anim=(
|
||||||
"${c_blue}•${c_green}•${c_red}•${c_magenta}• "
|
"${c_blue}•${c_green}•${c_red}•${c_magenta}• "
|
||||||
@ -152,6 +152,8 @@ anim=(
|
|||||||
" ${c_blue}•${c_green}•${c_red}•${c_magenta}• "
|
" ${c_blue}•${c_green}•${c_red}•${c_magenta}• "
|
||||||
)
|
)
|
||||||
|
|
||||||
|
export SUDO_PROMPT="${c_yellow} SUDO: Authentication is required\n${c_green} SUDO: Password (${MY_USERNAME}): "
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# CORE UTILITIES #
|
# CORE UTILITIES #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -259,11 +261,11 @@ signal_error() {
|
|||||||
prompt -e "FOUND :"
|
prompt -e "FOUND :"
|
||||||
|
|
||||||
for i in "${sources[@]}"; do
|
for i in "${sources[@]}"; do
|
||||||
lines=($(grep -Fn "${error_snippet:-${BASH_COMMAND}}" "${REPO_DIR}/${i}" | cut -d : -f 1 || echo ""))
|
lines=($(grep -Fn "${WHITESUR_COMMAND:-${BASH_COMMAND}}" "${REPO_DIR}/${i}" | cut -d : -f 1 || echo ""))
|
||||||
prompt -e " >>> ${i}$(IFS=';'; [[ "${lines[*]}" ]] && echo " at ${lines[*]}")"
|
prompt -e " >>> ${i}$(IFS=';'; [[ "${lines[*]}" ]] && echo " at ${lines[*]}")"
|
||||||
done
|
done
|
||||||
|
|
||||||
prompt -e "SNIPPET:\n >>> ${error_snippet:-${BASH_COMMAND}}"
|
prompt -e "SNIPPET:\n >>> ${WHITESUR_COMMAND:-${BASH_COMMAND}}"
|
||||||
prompt -e "TRACE :"
|
prompt -e "TRACE :"
|
||||||
|
|
||||||
for i in "${FUNCNAME[@]}"; do
|
for i in "${FUNCNAME[@]}"; do
|
||||||
@ -282,32 +284,6 @@ signal_error() {
|
|||||||
rm -rf "${WHITESUR_TMP_DIR}"; exit 1
|
rm -rf "${WHITESUR_TMP_DIR}"; exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
rootify() {
|
|
||||||
local result="0"
|
|
||||||
|
|
||||||
prompt -w "Executing '$(echo "${@}" | cut -c -35 )...' as root"
|
|
||||||
|
|
||||||
if [[ -p /dev/stdin ]]; then
|
|
||||||
! sudo "${@}" < /dev/stdin && result="1"; error_snippet="${*}"
|
|
||||||
else
|
|
||||||
! sudo "${@}" && result="1"; error_snippet="${*}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return "${result}"
|
|
||||||
}
|
|
||||||
|
|
||||||
userify() {
|
|
||||||
local result="0"
|
|
||||||
|
|
||||||
if [[ -p /dev/stdin ]]; then
|
|
||||||
! sudo -u "${MY_USERNAME}" "${@}" < /dev/stdin && result="1"; error_snippet="${*}"
|
|
||||||
else
|
|
||||||
! sudo -u "${MY_USERNAME}" "${@}" && result="1"; error_snippet="${*}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return "${result}"
|
|
||||||
}
|
|
||||||
|
|
||||||
trap 'signal_exit' EXIT
|
trap 'signal_exit' EXIT
|
||||||
trap 'signal_error' ERR
|
trap 'signal_error' ERR
|
||||||
trap 'signal_abort' INT TERM TSTP
|
trap 'signal_abort' INT TERM TSTP
|
||||||
@ -569,10 +545,10 @@ avoid_variant_duplicates() {
|
|||||||
restore_file() {
|
restore_file() {
|
||||||
if [[ -f "${1}.bak" ]]; then
|
if [[ -f "${1}.bak" ]]; then
|
||||||
case "${2}" in
|
case "${2}" in
|
||||||
rootify)
|
sudo)
|
||||||
rootify rm -rf "${1}"; rootify mv "${1}"{".bak",""} ;;
|
sudo rm -rf "${1}"; sudo mv "${1}"{".bak",""} ;;
|
||||||
userify)
|
udo)
|
||||||
userify rm -rf "${1}"; userify mv "${1}"{".bak",""} ;;
|
udo rm -rf "${1}"; udo mv "${1}"{".bak",""} ;;
|
||||||
*)
|
*)
|
||||||
rm -rf "${1}"; mv "${1}"{".bak",""} ;;
|
rm -rf "${1}"; mv "${1}"{".bak",""} ;;
|
||||||
esac
|
esac
|
||||||
@ -582,19 +558,19 @@ restore_file() {
|
|||||||
backup_file() {
|
backup_file() {
|
||||||
if [[ -f "${1}" ]]; then
|
if [[ -f "${1}" ]]; then
|
||||||
case "${2}" in
|
case "${2}" in
|
||||||
rootify)
|
sudo)
|
||||||
rootify mv -n "${1}"{"",".bak"} ;;
|
sudo mv -n "${1}"{"",".bak"} ;;
|
||||||
userify)
|
udo)
|
||||||
userify mv -n "${1}"{"",".bak"} ;;
|
udo mv -n "${1}"{"",".bak"} ;;
|
||||||
*)
|
*)
|
||||||
mv -n "${1}"{"",".bak"} ;;
|
mv -n "${1}"{"",".bak"} ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
userify_file() {
|
udoify_file() {
|
||||||
if [[ -f "${1}" && "$(ls -ld "${1}" | awk '{print $3}')" != "${MY_USERNAME}" ]]; then
|
if [[ -f "${1}" && "$(ls -ld "${1}" | awk '{print $3}')" != "${MY_USERNAME}" ]]; then
|
||||||
rootify chown "${MY_USERNAME}:" "${1}"
|
sudo chown "${MY_USERNAME}:" "${1}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,7 +586,19 @@ remind_relative_path() {
|
|||||||
# MISC #
|
# MISC #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
full_rootify() {
|
udo() {
|
||||||
|
local result="0"
|
||||||
|
|
||||||
|
if [[ -p /dev/stdin ]]; then
|
||||||
|
! sudo -u "${MY_USERNAME}" "${@}" < /dev/stdin && result="1"; WHITESUR_COMMAND="${*}"
|
||||||
|
else
|
||||||
|
! sudo -u "${MY_USERNAME}" "${@}" && result="1"; WHITESUR_COMMAND="${*}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
return "${result}"
|
||||||
|
}
|
||||||
|
|
||||||
|
full_sudo() {
|
||||||
if [[ ! -w "/root" ]]; then
|
if [[ ! -w "/root" ]]; then
|
||||||
prompt -e "ERROR: '${1}' needs a root priviledge. Please run this '${0}' as root"
|
prompt -e "ERROR: '${1}' needs a root priviledge. Please run this '${0}' as root"
|
||||||
has_any_error="true"
|
has_any_error="true"
|
||||||
|
118
lib-install.sh
118
lib-install.sh
@ -3,8 +3,6 @@
|
|||||||
#
|
#
|
||||||
# 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 )
|
||||||
#
|
|
||||||
# WARNING: Please don't use sudo directly here since it steals our EXIT trap
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# VARIABLES #
|
# VARIABLES #
|
||||||
@ -52,30 +50,30 @@ prepare_swupd() {
|
|||||||
local dist=""
|
local dist=""
|
||||||
|
|
||||||
if has_command dnf; then
|
if has_command dnf; then
|
||||||
prompt -w "CLEAR LINUX: You have 'dnf' installed in your system. It may break your system especially when you remove a package\n"
|
prompt -w "CLEAR LINUX: You have 'dnf' installed in your system. It may break your system especially when you remove a package"
|
||||||
|
|
||||||
while [[ "${remove}" != "y" && "${remove}" != "n" ]]; do
|
while [[ "${remove}" != "y" && "${remove}" != "n" ]]; do
|
||||||
echo -e "\r${c_green}"
|
echo -e "\r${c_green}"
|
||||||
read -p " You wanna remove it? (y/n): " remove 2>&1
|
read -p " CLEAR LINUX: You wanna remove it? (y/n): " remove 2>&1
|
||||||
echo -e "${c_default}"
|
echo -e "${c_default}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! rootify swupd update -y; then
|
if ! sudo swupd update -y; then
|
||||||
ver="$(curl -s -o - "${swupd_ver_url}")"
|
ver="$(curl -s -o - "${swupd_ver_url}")"
|
||||||
dist="NAME=\"Clear Linux OS\"\nVERSION=1\nID=clear-linux-os\nID_LIKE=clear-linux-os\n"
|
dist="NAME=\"Clear Linux OS\"\nVERSION=1\nID=clear-linux-os\nID_LIKE=clear-linux-os\n"
|
||||||
dist+="VERSION_ID=${ver}\nANSI_COLOR=\"1;35\"\nSUPPORT_URL=\"https://clearlinux.org\"\nBUILD_ID=${ver}"
|
dist+="VERSION_ID=${ver}\nANSI_COLOR=\"1;35\"\nSUPPORT_URL=\"https://clearlinux.org\"\nBUILD_ID=${ver}"
|
||||||
|
|
||||||
prompt -w "\n CLEAR LINUX: Your 'swupd' is broken"
|
prompt -w "\n CLEAR LINUX: Your 'swupd' is broken"
|
||||||
prompt -i "CLEAR LINUX: Patching 'swupd' distro version detection and try again...\n"
|
prompt -i "CLEAR LINUX: Patching 'swupd' distro version detection and try again...\n"
|
||||||
rootify rm -rf "/etc/os-release"; echo -e "${dist}" | rootify tee "/usr/lib/os-release" > /dev/null
|
sudo rm -rf "/etc/os-release"; echo -e "${dist}" | sudo tee "/usr/lib/os-release" > /dev/null
|
||||||
rootify ln -s "/usr/lib/os-release" "/etc/os-release"
|
sudo ln -s "/usr/lib/os-release" "/etc/os-release"
|
||||||
|
|
||||||
rootify swupd update -y
|
sudo swupd update -y
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! has_command bsdtar; then rootify swupd bundle-add libarchive; fi
|
if ! has_command bsdtar; then sudo swupd bundle-add libarchive; fi
|
||||||
if [[ "${remove}" == "y" ]]; then rootify swupd bundle-remove -y dnf; fi
|
if [[ "${remove}" == "y" ]]; then sudo swupd bundle-remove -y dnf; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_swupd_packages() {
|
install_swupd_packages() {
|
||||||
@ -85,17 +83,17 @@ install_swupd_packages() {
|
|||||||
|
|
||||||
for key in "${@}"; do
|
for key in "${@}"; do
|
||||||
for pkg in $(echo "${swupd_packages}" | grep -F "${key}"); do
|
for pkg in $(echo "${swupd_packages}" | grep -F "${key}"); do
|
||||||
curl -s -o - "${swupd_url}/${pkg}" | rootify bsdtar -xf - -C "/"
|
curl -s -o - "${swupd_url}/${pkg}" | sudo bsdtar -xf - -C "/"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_xbps() {
|
prepare_xbps() {
|
||||||
# 'xbps-install' requires 'xbps' to be always up-to-date
|
# 'xbps-install' requires 'xbps' to be always up-to-date
|
||||||
rootify xbps-install -Syu xbps
|
sudo xbps-install -Syu xbps
|
||||||
# System upgrading can't remove the old kernel files by it self. It eats the
|
# System upgrading can't remove the old kernel files by it self. It eats the
|
||||||
# boot partition and may cause kernel panic when there is no enough space
|
# boot partition and may cause kernel panic when there is no enough space
|
||||||
rootify vkpurge rm all
|
sudo vkpurge rm all
|
||||||
}
|
}
|
||||||
|
|
||||||
install_theme_deps() {
|
install_theme_deps() {
|
||||||
@ -104,24 +102,24 @@ install_theme_deps() {
|
|||||||
prompt -w "\n 'glib2.0', 'sassc', 'xmllint', and 'libmurrine' are required for theme installation.\n"
|
prompt -w "\n 'glib2.0', 'sassc', 'xmllint', and 'libmurrine' are required for theme installation.\n"
|
||||||
|
|
||||||
if has_command zypper; then
|
if has_command zypper; then
|
||||||
rootify zypper in -y sassc glib2-devel gtk2-engine-murrine libxml2-tools
|
sudo zypper in -y sassc glib2-devel gtk2-engine-murrine libxml2-tools
|
||||||
elif has_command swupd; then
|
elif has_command swupd; then
|
||||||
# Rolling release
|
# Rolling release
|
||||||
prepare_swupd && rootify 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
|
||||||
rootify apt install -y sassc libglib2.0-dev-bin gtk2-engines-murrine libxml2-utils
|
sudo apt install -y sassc libglib2.0-dev-bin gtk2-engines-murrine libxml2-utils
|
||||||
elif has_command dnf; then
|
elif has_command dnf; then
|
||||||
rootify 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
|
||||||
rootify yum install -y sassc glib2-devel gtk-murrine-engine libxml2
|
sudo yum install -y sassc glib2-devel gtk-murrine-engine libxml2
|
||||||
elif has_command pacman; then
|
elif has_command pacman; then
|
||||||
# Rolling release
|
# Rolling release
|
||||||
rootify pacman -Syu --noconfirm --needed sassc glib2 gtk-engine-murrine libxml2
|
sudo pacman -Syu --noconfirm --needed sassc glib2 gtk-engine-murrine libxml2
|
||||||
elif has_command xbps-install; then
|
elif has_command xbps-install; then
|
||||||
# Rolling release
|
# Rolling release
|
||||||
# 'libxml2' is already included here, and it's gonna broke the installation
|
# 'libxml2' is already included here, and it's gonna broke the installation
|
||||||
# if you add it
|
# if you add it
|
||||||
prepare_xbps && rootify xbps-install -Sy sassc glib-devel gtk-engine-murrine
|
prepare_xbps && sudo xbps-install -Sy sassc glib-devel gtk-engine-murrine
|
||||||
else
|
else
|
||||||
installation_sorry
|
installation_sorry
|
||||||
fi
|
fi
|
||||||
@ -133,22 +131,22 @@ install_beggy_deps() {
|
|||||||
prompt -w "\n 'imagemagick' are required for background editing.\n"
|
prompt -w "\n 'imagemagick' are required for background editing.\n"
|
||||||
|
|
||||||
if has_command zypper; then
|
if has_command zypper; then
|
||||||
rootify zypper in -y ImageMagick
|
sudo zypper in -y ImageMagick
|
||||||
elif has_command swupd; then
|
elif has_command swupd; then
|
||||||
# Rolling release
|
# Rolling release
|
||||||
prepare_swupd && rootify swupd bundle-add ImageMagick
|
prepare_swupd && sudo swupd bundle-add ImageMagick
|
||||||
elif has_command apt; then
|
elif has_command apt; then
|
||||||
rootify apt install -y imagemagick
|
sudo apt install -y imagemagick
|
||||||
elif has_command dnf; then
|
elif has_command dnf; then
|
||||||
rootify dnf install -y ImageMagick
|
sudo dnf install -y ImageMagick
|
||||||
elif has_command yum; then
|
elif has_command yum; then
|
||||||
rootify yum install -y ImageMagick
|
sudo yum install -y ImageMagick
|
||||||
elif has_command pacman; then
|
elif has_command pacman; then
|
||||||
# Rolling release
|
# Rolling release
|
||||||
rootify pacman -Syu --noconfirm --needed imagemagick
|
sudo pacman -Syu --noconfirm --needed imagemagick
|
||||||
elif has_command xbps-install; then
|
elif has_command xbps-install; then
|
||||||
# Rolling release
|
# Rolling release
|
||||||
prepare_xbps && rootify xbps-install -Sy ImageMagick
|
prepare_xbps && sudo xbps-install -Sy ImageMagick
|
||||||
else
|
else
|
||||||
installation_sorry
|
installation_sorry
|
||||||
fi
|
fi
|
||||||
@ -160,22 +158,22 @@ install_dialog_deps() {
|
|||||||
prompt -w "\n 'dialog' is required for this option.\n"
|
prompt -w "\n 'dialog' is required for this option.\n"
|
||||||
|
|
||||||
if has_command zypper; then
|
if has_command zypper; then
|
||||||
rootify zypper in -y dialog
|
sudo zypper in -y dialog
|
||||||
elif has_command swupd; then
|
elif has_command swupd; then
|
||||||
# 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
|
||||||
rootify apt install -y dialog
|
sudo apt install -y dialog
|
||||||
elif has_command dnf; then
|
elif has_command dnf; then
|
||||||
rootify dnf install -y dialog
|
sudo dnf install -y dialog
|
||||||
elif has_command yum; then
|
elif has_command yum; then
|
||||||
rootify yum install -y dialog
|
sudo yum install -y dialog
|
||||||
elif has_command pacman; then
|
elif has_command pacman; then
|
||||||
# Rolling release
|
# Rolling release
|
||||||
rootify pacman -Syu --noconfirm --needed dialog
|
sudo pacman -Syu --noconfirm --needed dialog
|
||||||
elif has_command xbps-install; then
|
elif has_command xbps-install; then
|
||||||
# Rolling release
|
# Rolling release
|
||||||
prepare_xbps && rootify xbps-install -Sy dialog
|
prepare_xbps && sudo xbps-install -Sy dialog
|
||||||
else
|
else
|
||||||
installation_sorry
|
installation_sorry
|
||||||
fi
|
fi
|
||||||
@ -518,8 +516,8 @@ install_firefox_theme() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
remove_firefox_theme
|
remove_firefox_theme
|
||||||
userify mkdir -p "${TARGET_DIR}"
|
udo mkdir -p "${TARGET_DIR}"
|
||||||
userify cp -rf "${FIREFOX_SRC_DIR}"/* "${TARGET_DIR}"
|
udo cp -rf "${FIREFOX_SRC_DIR}"/* "${TARGET_DIR}"
|
||||||
config_firefox
|
config_firefox
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -539,14 +537,14 @@ config_firefox() {
|
|||||||
|
|
||||||
for d in "${FIREFOX_DIR}/"*"default"*; do
|
for d in "${FIREFOX_DIR}/"*"default"*; do
|
||||||
if [[ -f "${d}/prefs.js" ]]; then
|
if [[ -f "${d}/prefs.js" ]]; then
|
||||||
rm -rf "${d}/chrome"
|
rm -rf "${d}/chrome"
|
||||||
userify ln -sf "${TARGET_DIR}" "${d}/chrome"
|
udo ln -sf "${TARGET_DIR}" "${d}/chrome"
|
||||||
userify_file "${d}/prefs.js"
|
udoify_file "${d}/prefs.js"
|
||||||
echo "user_pref(\"toolkit.legacyUserProfileCustomizations.stylesheets\", true);" >> "${d}/prefs.js"
|
echo "user_pref(\"toolkit.legacyUserProfileCustomizations.stylesheets\", true);" >> "${d}/prefs.js"
|
||||||
echo "user_pref(\"browser.tabs.drawInTitlebar\", true);" >> "${d}/prefs.js"
|
echo "user_pref(\"browser.tabs.drawInTitlebar\", true);" >> "${d}/prefs.js"
|
||||||
echo "user_pref(\"browser.uidensity\", 0);" >> "${d}/prefs.js"
|
echo "user_pref(\"browser.uidensity\", 0);" >> "${d}/prefs.js"
|
||||||
echo "user_pref(\"layers.acceleration.force-enabled\", true);" >> "${d}/prefs.js"
|
echo "user_pref(\"layers.acceleration.force-enabled\", true);" >> "${d}/prefs.js"
|
||||||
echo "user_pref(\"mozilla.widget.use-argb-visuals\", true);" >> "${d}/prefs.js"
|
echo "user_pref(\"mozilla.widget.use-argb-visuals\", true);" >> "${d}/prefs.js"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -561,8 +559,8 @@ edit_firefox_theme_prefs() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
[[ ! -d "${TARGET_DIR}" ]] && install_firefox_theme ; config_firefox
|
[[ ! -d "${TARGET_DIR}" ]] && install_firefox_theme ; config_firefox
|
||||||
userify ${EDITOR:-nano} "${TARGET_DIR}/userChrome.css"
|
udo ${EDITOR:-nano} "${TARGET_DIR}/userChrome.css"
|
||||||
userify ${EDITOR:-nano} "${TARGET_DIR}/customChrome.css"
|
udo ${EDITOR:-nano} "${TARGET_DIR}/customChrome.css"
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_firefox_theme() {
|
remove_firefox_theme() {
|
||||||
@ -583,22 +581,22 @@ install_dash_to_dock_theme() {
|
|||||||
gtk_base "${colors[0]}" "${opacities[0]}" "${themes[0]}"
|
gtk_base "${colors[0]}" "${opacities[0]}" "${themes[0]}"
|
||||||
|
|
||||||
if [[ -d "${DASH_TO_DOCK_DIR_HOME}" ]]; then
|
if [[ -d "${DASH_TO_DOCK_DIR_HOME}" ]]; then
|
||||||
backup_file "${DASH_TO_DOCK_DIR_HOME}/stylesheet.css" "userify"
|
backup_file "${DASH_TO_DOCK_DIR_HOME}/stylesheet.css" "udo"
|
||||||
userify_file "${DASH_TO_DOCK_DIR_HOME}/stylesheet.css"
|
udoify_file "${DASH_TO_DOCK_DIR_HOME}/stylesheet.css"
|
||||||
userify sassc ${SASSC_OPT} "${DASH_TO_DOCK_SRC_DIR}/stylesheet$(destify ${colors[0]}).scss" "${DASH_TO_DOCK_DIR_HOME}/stylesheet.css"
|
udo sassc ${SASSC_OPT} "${DASH_TO_DOCK_SRC_DIR}/stylesheet$(destify ${colors[0]}).scss" "${DASH_TO_DOCK_DIR_HOME}/stylesheet.css"
|
||||||
elif [[ -d "${DASH_TO_DOCK_DIR_ROOT}" ]]; then
|
elif [[ -d "${DASH_TO_DOCK_DIR_ROOT}" ]]; then
|
||||||
backup_file "${DASH_TO_DOCK_DIR_ROOT}/stylesheet.css" "rootify"
|
backup_file "${DASH_TO_DOCK_DIR_ROOT}/stylesheet.css" "sudo"
|
||||||
rootify sassc ${SASSC_OPT} "${DASH_TO_DOCK_SRC_DIR}/stylesheet$(destify ${colors[0]}).scss" "${DASH_TO_DOCK_DIR_ROOT}/stylesheet.css"
|
sudo sassc ${SASSC_OPT} "${DASH_TO_DOCK_SRC_DIR}/stylesheet$(destify ${colors[0]}).scss" "${DASH_TO_DOCK_DIR_ROOT}/stylesheet.css"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
userify dbus-launch dconf write /org/gnome/shell/extensions/dash-to-dock/apply-custom-theme true
|
udo dbus-launch dconf write /org/gnome/shell/extensions/dash-to-dock/apply-custom-theme true
|
||||||
}
|
}
|
||||||
|
|
||||||
revert_dash_to_dock_theme() {
|
revert_dash_to_dock_theme() {
|
||||||
if [[ -d "${DASH_TO_DOCK_DIR_HOME}" ]]; then
|
if [[ -d "${DASH_TO_DOCK_DIR_HOME}" ]]; then
|
||||||
restore_file "${DASH_TO_DOCK_DIR_HOME}/stylesheet.css" "userify"
|
restore_file "${DASH_TO_DOCK_DIR_HOME}/stylesheet.css" "udo"
|
||||||
elif [[ -d "${DASH_TO_DOCK_DIR_ROOT}" ]]; then
|
elif [[ -d "${DASH_TO_DOCK_DIR_ROOT}" ]]; then
|
||||||
restore_file "${DASH_TO_DOCK_DIR_ROOT}/stylesheet.css" "rootify"
|
restore_file "${DASH_TO_DOCK_DIR_ROOT}/stylesheet.css" "sudo"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,26 +605,26 @@ revert_dash_to_dock_theme() {
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
connect_flatpak() {
|
connect_flatpak() {
|
||||||
rootify flatpak override --filesystem=~/.themes
|
sudo flatpak override --filesystem=~/.themes
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnect_flatpak() {
|
disconnect_flatpak() {
|
||||||
rootify flatpak override --nofilesystem=~/.themes
|
sudo flatpak override --nofilesystem=~/.themes
|
||||||
}
|
}
|
||||||
|
|
||||||
connect_snap() {
|
connect_snap() {
|
||||||
rootify snap install whitesur-gtk-theme
|
sudo snap install whitesur-gtk-theme
|
||||||
|
|
||||||
for i in $(snap connections | grep gtk-common-themes | awk '{print $2}' | cut -f1 -d: | sort -u); do
|
for i in $(snap connections | grep gtk-common-themes | awk '{print $2}' | cut -f1 -d: | sort -u); do
|
||||||
rootify snap connect "${i}:gtk-3-themes" "whitesur-gtk-theme:gtk-3-themes"
|
sudo snap connect "${i}:gtk-3-themes" "whitesur-gtk-theme:gtk-3-themes"
|
||||||
rootify snap connect "${i}:icon-themes" "whitesur-gtk-theme:icon-themes"
|
sudo snap connect "${i}:icon-themes" "whitesur-gtk-theme:icon-themes"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnect_snap() {
|
disconnect_snap() {
|
||||||
for i in $(snap connections | grep gtk-common-themes | awk '{print $2}' | cut -f1 -d: | sort -u); do
|
for i in $(snap connections | grep gtk-common-themes | awk '{print $2}' | cut -f1 -d: | sort -u); do
|
||||||
rootify snap disconnect "${i}:gtk-3-themes" "whitesur-gtk-theme:gtk-3-themes"
|
sudo snap disconnect "${i}:gtk-3-themes" "whitesur-gtk-theme:gtk-3-themes"
|
||||||
rootify snap disconnect "${i}:icon-themes" "whitesur-gtk-theme:icon-themes"
|
sudo snap disconnect "${i}:icon-themes" "whitesur-gtk-theme:icon-themes"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
# WARNING: Please make this shell not working-directory dependant, for example
|
# WARNING: Please make this shell not working-directory dependant, for example
|
||||||
# instead of using 'ls blabla', use 'ls "${REPO_DIR}/blabla"'
|
# instead of using 'ls blabla', use 'ls "${REPO_DIR}/blabla"'
|
||||||
#
|
#
|
||||||
# WARNING: Please don't use sudo directly here since it steals our EXIT trap
|
|
||||||
#
|
|
||||||
# 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 )
|
||||||
|
|
||||||
@ -93,7 +91,7 @@ while [[ $# -gt 0 ]]; do
|
|||||||
has_any_error="true"
|
has_any_error="true"
|
||||||
fi; shift ;;
|
fi; shift ;;
|
||||||
-g|--gdm)
|
-g|--gdm)
|
||||||
gdm="true"; full_rootify "${1}"
|
gdm="true"; full_sudo "${1}"
|
||||||
|
|
||||||
if ! has_command gdm && ! has_command gdm3 && [[ ! -e /usr/sbin/gdm3 ]]; then
|
if ! has_command gdm && ! has_command gdm3 && [[ ! -e /usr/sbin/gdm3 ]]; then
|
||||||
prompt -e "'${1}' ERROR: There's no GDM installed in your system"
|
prompt -e "'${1}' ERROR: There's no GDM installed in your system"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user