Add Clear Linux support

This commit is contained in:
Muhammad Rivan 2021-06-09 16:48:52 +07:00
parent 9597331eac
commit 238178e303
No known key found for this signature in database
GPG key ID: C56A200FD936FAAA
2 changed files with 11 additions and 7 deletions

View file

@ -129,7 +129,9 @@ error_snippet=""
export ANIM_PID="0"
has_any_error="false"
swupd_packages=""
swupd_url="https://cdn.download.clearlinux.org/current/x86_64/os/Packages"
# '/' ending is required in 'swupd_url'
swupd_url="https://cdn.download.clearlinux.org/current/x86_64/os/Packages/"
swupd_ver_url="https://cdn.download.clearlinux.org/latest"
# Colors and animation
c_default="\033[0m"
@ -217,6 +219,8 @@ signal_exit() {
}
operation_aborted() {
# TODO: make this more accurate
IFS=$'\n'
local sources=($(basename -a "${WHITESUR_SOURCE[@]}" "${BASH_SOURCE[@]}" | sort -u))
local dist_ids=($(awk -F '=' '/ID/{print $2}' "/etc/os-release" | sort -Vru))
@ -236,7 +240,7 @@ operation_aborted() {
prompt -e "\n\n Oops! Operation has been aborted or failed...\n"
prompt -e "=========== ERROR LOG ==========="
if ! awk '{printf "\033[1;31m >>> %s\n", $0}' "${WHITESUR_TMP_DIR}/error_log.txt"; then
if [[ "$(awk '{printf "\033[1;31m >>> %s\n", $0}' "${WHITESUR_TMP_DIR}/error_log.txt" || echo "")" == "" ]] ; then
prompt -e ">>>>>>> No error log found <<<<<<"
fi

View file

@ -57,7 +57,7 @@ prepare_swupd() {
fi
if ! rootify swupd update -y; then
ver="$(curl -s "https://cdn.download.clearlinux.org/latest")"
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+="VERSION_ID=${ver}\nANSI_COLOR=\"1;35\"\nSUPPORT_URL=\"https://clearlinux.org\"\nBUILD_ID=${ver}"
@ -68,17 +68,17 @@ prepare_swupd() {
rootify swupd update -y
fi
[[ "${remove}" == "y" ]] && rootify swupd bundle-remove -y dnf
if [[ "${remove}" == "y" ]]; then rootify swupd bundle-remove -y dnf; fi
}
install_swupd_packages() {
if [[ ! "${swupd_packages}" ]]; then
swupd_packages="$(curl -s "${swupd_url}" | awk -F '"' '/-bin-|-lib-/{print $2}')"
swupd_packages="$(curl -s -o - "${swupd_url}" | awk -F '"' '/-bin-|-lib-/{print $2}')"
fi
for key in "${@}"; do
for pkg in $(echo "${swupd_packages}" | grep -F "${key}"); do
curl "${swupd_url}/${pkg}" -o - | rootify bsdtar -xf - -C "/"
curl -s -o - "${swupd_url}/${pkg}" | rootify bsdtar -xf - -C "/"
done
done
}
@ -100,7 +100,7 @@ install_theme_deps() {
rootify zypper in -y sassc glib2-devel gtk2-engine-murrine libxml2-tools
elif has_command swupd; then
# Rolling release
prepare_swupd && rootify swupd bundle-add libglib libxml2 && install_swupd_packages sassc
prepare_swupd && rootify swupd bundle-add libglib libxml2 && install_swupd_packages sassc libsass
elif has_command apt; then
rootify apt install -y sassc libglib2.0-dev-bin gtk2-engines-murrine libxml2-utils
elif has_command dnf; then