Add Clear Linux support
This commit is contained in:
parent
09d7d2953e
commit
024815263d
45
lib-core.sh
45
lib-core.sh
@ -33,7 +33,7 @@ else
|
|||||||
GNOME_VERSION="none"
|
GNOME_VERSION="none"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Program options
|
#----------Program options-------------#
|
||||||
SASSC_OPT="-M -t expanded"
|
SASSC_OPT="-M -t expanded"
|
||||||
|
|
||||||
if [[ "$(uname -s)" =~ "BSD" || "$(uname -s)" == "Darwin" ]]; then
|
if [[ "$(uname -s)" =~ "BSD" || "$(uname -s)" == "Darwin" ]]; then
|
||||||
@ -42,7 +42,7 @@ else
|
|||||||
SED_OPT="-i"
|
SED_OPT="-i"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Directories
|
#------------Directories--------------#
|
||||||
THEME_SRC_DIR="${REPO_DIR}/src"
|
THEME_SRC_DIR="${REPO_DIR}/src"
|
||||||
DASH_TO_DOCK_SRC_DIR="${REPO_DIR}/src/other/dash-to-dock"
|
DASH_TO_DOCK_SRC_DIR="${REPO_DIR}/src/other/dash-to-dock"
|
||||||
DASH_TO_DOCK_DIR_ROOT="/usr/share/gnome-shell/extensions/dash-to-dock@micxgx.gmail.com"
|
DASH_TO_DOCK_DIR_ROOT="/usr/share/gnome-shell/extensions/dash-to-dock@micxgx.gmail.com"
|
||||||
@ -62,7 +62,7 @@ else
|
|||||||
THEME_DIR="$HOME/.themes"
|
THEME_DIR="$HOME/.themes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# GDM
|
#--------------GDM----------------#
|
||||||
WHITESUR_GS_DIR="/usr/share/gnome-shell/theme/WhiteSur"
|
WHITESUR_GS_DIR="/usr/share/gnome-shell/theme/WhiteSur"
|
||||||
COMMON_CSS_FILE="/usr/share/gnome-shell/theme/gnome-shell.css"
|
COMMON_CSS_FILE="/usr/share/gnome-shell/theme/gnome-shell.css"
|
||||||
UBUNTU_CSS_FILE="/usr/share/gnome-shell/theme/ubuntu.css"
|
UBUNTU_CSS_FILE="/usr/share/gnome-shell/theme/ubuntu.css"
|
||||||
@ -74,7 +74,7 @@ POP_OS_GR_FILE="/usr/share/gnome-shell/theme/Pop/gnome-shell-theme.gresource"
|
|||||||
MISC_GR_FILE="/usr/share/gnome-shell/gnome-shell-theme.gresource"
|
MISC_GR_FILE="/usr/share/gnome-shell/gnome-shell-theme.gresource"
|
||||||
GS_GR_XML_FILE="${THEME_SRC_DIR}/main/gnome-shell/gnome-shell-theme.gresource.xml"
|
GS_GR_XML_FILE="${THEME_SRC_DIR}/main/gnome-shell/gnome-shell-theme.gresource.xml"
|
||||||
|
|
||||||
# Theme
|
#-------------Theme---------------#
|
||||||
THEME_NAME="WhiteSur"
|
THEME_NAME="WhiteSur"
|
||||||
COLOR_VARIANTS=('light' 'dark')
|
COLOR_VARIANTS=('light' 'dark')
|
||||||
OPACITY_VARIANTS=('normal' 'solid')
|
OPACITY_VARIANTS=('normal' 'solid')
|
||||||
@ -85,7 +85,7 @@ SIDEBAR_SIZE_VARIANTS=('default' '220' '240' '260' '280')
|
|||||||
PANEL_OPACITY_VARIANTS=('default' '30' '45' '60' '75')
|
PANEL_OPACITY_VARIANTS=('default' '30' '45' '60' '75')
|
||||||
NAUTILUS_STYLE_VARIANTS=('default' 'stable' 'mojave' 'glassy')
|
NAUTILUS_STYLE_VARIANTS=('default' 'stable' 'mojave' 'glassy')
|
||||||
|
|
||||||
# Customization, default values
|
#--------Customization, default values----------#
|
||||||
dest="${THEME_DIR}"
|
dest="${THEME_DIR}"
|
||||||
name="${THEME_NAME}"
|
name="${THEME_NAME}"
|
||||||
colors=("${COLOR_VARIANTS}")
|
colors=("${COLOR_VARIANTS}")
|
||||||
@ -99,11 +99,11 @@ nautilus_style="${NAUTILUS_STYLE_VARIANTS[1]}"
|
|||||||
background="default"
|
background="default"
|
||||||
compact="true"
|
compact="true"
|
||||||
|
|
||||||
# Ambigous arguments checking and overriding default values
|
#--Ambigous arguments checking and overriding default values--#
|
||||||
declare -A has_set=([-b]="false" [-s]="false" [-p]="false" [-d]="false" [-n]="false" [-a]="false" [-o]="false" [-c]="false" [-i]="false" [-t]="false" [-N]="false")
|
declare -A has_set=([-b]="false" [-s]="false" [-p]="false" [-d]="false" [-n]="false" [-a]="false" [-o]="false" [-c]="false" [-i]="false" [-t]="false" [-N]="false")
|
||||||
declare -A need_dialog=([-b]="false" [-s]="false" [-p]="false" [-d]="false" [-n]="false" [-a]="false" [-o]="false" [-c]="false" [-i]="false" [-t]="false" [-N]="false")
|
declare -A need_dialog=([-b]="false" [-s]="false" [-p]="false" [-d]="false" [-n]="false" [-a]="false" [-o]="false" [-c]="false" [-i]="false" [-t]="false" [-N]="false")
|
||||||
|
|
||||||
# Tweaks
|
#------------Tweaks---------------#
|
||||||
need_help="false"
|
need_help="false"
|
||||||
uninstall="false"
|
uninstall="false"
|
||||||
interactive="false"
|
interactive="false"
|
||||||
@ -120,11 +120,14 @@ dash_to_dock="false"
|
|||||||
max_round="false"
|
max_round="false"
|
||||||
showapps_normal="false"
|
showapps_normal="false"
|
||||||
|
|
||||||
# Misc
|
#--------------Misc----------------#
|
||||||
msg=""
|
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
|
||||||
|
# considered the last command in 'BASH_COMMAND' variable
|
||||||
|
error_snippet=""
|
||||||
export ANIM_PID="0"
|
export ANIM_PID="0"
|
||||||
has_any_error="false"
|
has_any_error="false"
|
||||||
swupd_packages=""
|
swupd_packages=""
|
||||||
@ -132,7 +135,7 @@ 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
|
#------Colors and animation--------#
|
||||||
c_default="\033[0m"
|
c_default="\033[0m"
|
||||||
c_blue="\033[1;34m"
|
c_blue="\033[1;34m"
|
||||||
c_magenta="\033[1;35m"
|
c_magenta="\033[1;35m"
|
||||||
@ -250,11 +253,11 @@ operation_aborted() {
|
|||||||
prompt -e "FOUND :"
|
prompt -e "FOUND :"
|
||||||
|
|
||||||
for i in "${sources[@]}"; do
|
for i in "${sources[@]}"; do
|
||||||
lines=($(grep -Fn "${BASH_COMMAND}" "${REPO_DIR}/${i}" | cut -d : -f 1 || echo ""))
|
lines=($(grep -Fn "${error_snippet:-${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 >>> ${BASH_COMMAND}"
|
prompt -e "SNIPPET:\n >>> ${error_snippet:-${BASH_COMMAND}}"
|
||||||
prompt -e "TRACE :"
|
prompt -e "TRACE :"
|
||||||
|
|
||||||
for i in "${FUNCNAME[@]}"; do
|
for i in "${FUNCNAME[@]}"; do
|
||||||
@ -279,10 +282,12 @@ rootify() {
|
|||||||
trap true SIGINT
|
trap true SIGINT
|
||||||
prompt -w "Executing '$(echo "${@}" | cut -c -35 )...' as root"
|
prompt -w "Executing '$(echo "${@}" | cut -c -35 )...' as root"
|
||||||
|
|
||||||
if [[ -p /dev/stdin ]] && ! sudo "${@}" < /dev/stdin; then
|
if [[ -p /dev/stdin ]]; then
|
||||||
result=1
|
! sudo "${@}" < /dev/stdin && result=1
|
||||||
elif ! sudo "${@}"; then
|
error_snippet="${*}"
|
||||||
result=1
|
else
|
||||||
|
! sudo "${@}" && result=1
|
||||||
|
error_snippet="${*}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trap signal_exit SIGINT
|
trap signal_exit SIGINT
|
||||||
@ -295,10 +300,12 @@ userify() {
|
|||||||
|
|
||||||
trap true SIGINT
|
trap true SIGINT
|
||||||
|
|
||||||
if [[ -p /dev/stdin ]] && ! sudo -u "${MY_USERNAME}" "${@}" < /dev/stdin; then
|
if [[ -p /dev/stdin ]]; then
|
||||||
result=1
|
! sudo -u "${MY_USERNAME}" "${@}" < /dev/stdin && result=1
|
||||||
elif ! sudo -u "${MY_USERNAME}" "${@}"; then
|
error_snippet="${*}"
|
||||||
result=1
|
else
|
||||||
|
! sudo -u "${MY_USERNAME}" "${@}" && result=1
|
||||||
|
error_snippet="${*}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trap signal_exit SIGINT
|
trap signal_exit SIGINT
|
||||||
|
@ -49,11 +49,11 @@ 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"
|
prompt -w "CLEAR LINUX: You have 'dnf' installed in your system. It may break your system especially when you remove a package\n"
|
||||||
|
|
||||||
while [[ "${remove}" != "y" && "${remove}" != "n" ]]; do
|
while [[ "${remove}" != "y" && "${remove}" != "n" ]]; do
|
||||||
echo -e "${c_green}"
|
echo -e "\r${c_green}"
|
||||||
read -p "You wanna remove it? (y/n): " remove 2>&1
|
read -p " You wanna remove it? (y/n): " remove 2>&1
|
||||||
echo -e "${c_default}"
|
echo -e "${c_default}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -63,9 +63,10 @@ prepare_swupd() {
|
|||||||
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}"
|
||||||
|
|
||||||
print -w "CLEAR LINUX: Your 'swupd' is broken\n"
|
prompt -w "\nCLEAR LINUX: Your 'swupd' is broken"
|
||||||
print -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"
|
||||||
echo -e "${dist}" | rootify tee "/etc/os-release" > /dev/null
|
rootify rm -rf "/etc/os-release"; echo -e "${dist}" | rootify tee "/usr/lib/os-release" > /dev/null
|
||||||
|
rootify ln -s "/usr/lib/os-release" "/etc/os-release"
|
||||||
|
|
||||||
rootify swupd update -y
|
rootify swupd update -y
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user