Add Clear Linux support
This commit is contained in:
		
							parent
							
								
									99d5b82bc0
								
							
						
					
					
						commit
						9597331eac
					
				
							
								
								
									
										38
									
								
								lib-core.sh
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								lib-core.sh
									
									
									
									
									
								
							| @ -128,6 +128,8 @@ process_ids=() | |||||||
| error_snippet="" | error_snippet="" | ||||||
| export ANIM_PID="0" | export ANIM_PID="0" | ||||||
| has_any_error="false" | has_any_error="false" | ||||||
|  | swupd_packages="" | ||||||
|  | swupd_url="https://cdn.download.clearlinux.org/current/x86_64/os/Packages" | ||||||
| 
 | 
 | ||||||
| # Colors and animation | # Colors and animation | ||||||
| c_default="\033[0m" | c_default="\033[0m" | ||||||
| @ -266,48 +268,34 @@ operation_aborted() { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| rootify() { | rootify() { | ||||||
|  |   local result=0 | ||||||
|  | 
 | ||||||
|   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 ! sudo "${@}"; then |   if [[ -p /dev/stdin ]] && ! sudo "${@}" < /dev/stdin || ! sudo "${@}"; then | ||||||
|     error_snippet="${*}" |     error_snippet="${*}" | ||||||
|     operation_aborted |     result=1 | ||||||
|   fi |   fi | ||||||
| 
 | 
 | ||||||
|   trap signal_exit SIGINT |   trap signal_exit SIGINT | ||||||
|  | 
 | ||||||
|  |   return "${result}" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| userify() { | userify() { | ||||||
|  |   local result=0 | ||||||
|  | 
 | ||||||
|   trap true SIGINT |   trap true SIGINT | ||||||
| 
 | 
 | ||||||
|   if ! sudo -u "${MY_USERNAME}" "${@}"; then |   if [[ -p /dev/stdin ]] && ! sudo -u "${MY_USERNAME}" "${@}" < /dev/stdin || ! sudo -u "${MY_USERNAME}" "${@}"; then | ||||||
|     error_snippet="${*}" |     error_snippet="${*}" | ||||||
|     operation_aborted |     result=1 | ||||||
|   fi |   fi | ||||||
| 
 | 
 | ||||||
|   trap signal_exit SIGINT |   trap signal_exit SIGINT | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| write_as_root() { |   return "${result}" | ||||||
|   trap true SIGINT |  | ||||||
| 
 |  | ||||||
|   if ! echo -e "${1}" | sudo tee "${2}" > /dev/null; then |  | ||||||
|     error_snippet="${*}" |  | ||||||
|     operation_aborted |  | ||||||
|   fi |  | ||||||
| 
 |  | ||||||
|   trap signal_exit SIGINT |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| write_as_user() { |  | ||||||
|   trap true SIGINT |  | ||||||
| 
 |  | ||||||
|   if ! echo -e "${1}" | sudo -u "${MY_USERNAME}" tee "${2}" > /dev/null; then |  | ||||||
|     error_snippet="${*}" |  | ||||||
|     operation_aborted |  | ||||||
|   fi |  | ||||||
| 
 |  | ||||||
|   trap signal_exit SIGINT |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| trap 'operation_aborted' ERR | trap 'operation_aborted' ERR | ||||||
|  | |||||||
| @ -17,6 +17,24 @@ WHITESUR_SOURCE+=("lib-install.sh") | |||||||
| #                              DEPENDENCIES                                   # | #                              DEPENDENCIES                                   # | ||||||
| ############################################################################### | ############################################################################### | ||||||
| 
 | 
 | ||||||
|  | # Be careful of some distro mechanism, some of them use rolling-release | ||||||
|  | # based installation instead of point-release, e.g., Arch Linux | ||||||
|  | 
 | ||||||
|  | # Rolling-release based distro doesn't have a seprate repo for each different | ||||||
|  | # build. This can cause a system call error since an app require the compatible | ||||||
|  | # version of dependencies. In other words, if you install an new app (which you | ||||||
|  | # definitely reinstall/upgrade the dependency for that app), but your other | ||||||
|  | # dependencies are old/expired, you'll end up with broken system. | ||||||
|  | 
 | ||||||
|  | # That's why we need a full system upgrade there | ||||||
|  | 
 | ||||||
|  | #---------------------SWUPD--------------------# | ||||||
|  | # 'swupd' bundles just don't make any sense. It takes about 30GB of space only | ||||||
|  | # for installing a util, e.g. 'sassc' (from 'desktop-dev' bundle, or | ||||||
|  | # 'os-utils-gui-dev' bundle, or any other 'sassc' provider bundle) | ||||||
|  | 
 | ||||||
|  | # Manual package installation is needed for that, but don't use 'dnf' | ||||||
|  | 
 | ||||||
| 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" | ||||||
| @ -25,21 +43,44 @@ installation_sorry() { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| prepare_swupd() { | prepare_swupd() { | ||||||
|   # 'swupd' bundles just don't make any sense. It takes about 30GB of space only |   local remove="" | ||||||
|   # for installing a util, e.g. 'sassc' (from 'desktop-dev' bundle, or |   local ver="" | ||||||
|   # 'os-utils-gui-dev' bundle, or any other 'sassc' provider bundle) |   local conf="" | ||||||
|  |   local dist="" | ||||||
| 
 | 
 | ||||||
|   rootify swupd update -y && rootify swupd bundle-add -y dnf wget |   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" | ||||||
| 
 | 
 | ||||||
|   local ver="$(wget -qO- "https://cdn.download.clearlinux.org/latest")" |     while [[ "${remove}" != "y" && "${remove}" != "n" ]]; do | ||||||
|   local conf="[clear]\nname=Clear\nbaseurl=https://cdn.download.clearlinux.org/releases/${ver}/clear/x86_64/os/\ngpgcheck=0" |       read -p "You wanna remove it? (y/n): " remove | ||||||
|   local dist="NAME=\"Clear Linux OS\"\nVERSION=1\nID=clear-linux-os\nID_LIKE=clear-linux-os\n" |     done | ||||||
|   dist+="VERSION_ID=${ver}\nANSI_COLOR=\"1;35\"\nSUPPORT_URL=\"https://clearlinux.org\"\nBUILD_ID=${ver}" |   fi | ||||||
| 
 | 
 | ||||||
|   rootify mkdir -p                                                                          "/etc/dnf" |   if ! rootify swupd update -y; then | ||||||
|   write_as_root "${conf}"                                                                   "/etc/dnf/dnf.conf" |     ver="$(curl -s "https://cdn.download.clearlinux.org/latest")" | ||||||
|   rootify rpm --initdb && rootify dnf upgrade |     dist="NAME=\"Clear Linux OS\"\nVERSION=1\nID=clear-linux-os\nID_LIKE=clear-linux-os\n" | ||||||
|   write_as_root "${dist}"                                                                   "/etc/os-release" |     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" | ||||||
|  |     print -i "CLEAR LINUX: Patching 'swupd' distro version detection and try again...\n" | ||||||
|  |     echo -e "${dist}" | rootify tee                                                           "/etc/os-release" > /dev/null | ||||||
|  | 
 | ||||||
|  |     rootify swupd update -y | ||||||
|  |   fi | ||||||
|  | 
 | ||||||
|  |   [[ "${remove}" == "y" ]] && rootify swupd bundle-remove -y dnf | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | install_swupd_packages() { | ||||||
|  |   if [[ ! "${swupd_packages}" ]]; then | ||||||
|  |     swupd_packages="$(curl -s "${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 "/" | ||||||
|  |     done | ||||||
|  |   done | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| prepare_xbps() { | prepare_xbps() { | ||||||
| @ -55,22 +96,11 @@ install_theme_deps() { | |||||||
|   (! 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 "\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" | ||||||
| 
 | 
 | ||||||
|     # Be careful of some distro mechanism, some of them use rolling-release |  | ||||||
|     # based installation instead of point-release, e.g., Arch Linux |  | ||||||
| 
 |  | ||||||
|     # Rolling-release based distro doesn't have a seprate repo for each different |  | ||||||
|     # build. This can cause a system call error since an app require the compatible |  | ||||||
|     # version of dependencies. In other words, if you install an new app (which you |  | ||||||
|     # definitely reinstall/upgrade the dependency for that app), but your other |  | ||||||
|     # dependencies are old/expired, you'll end up with broken system. |  | ||||||
| 
 |  | ||||||
|     # That's why we need a full system upgrade here |  | ||||||
| 
 |  | ||||||
|     if has_command zypper; then |     if has_command zypper; then | ||||||
|       rootify zypper in -y sassc glib2-devel gtk2-engine-murrine libxml2-tools |       rootify 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 dnf install -y sassc glib-bin libxml2-bin |       prepare_swupd && rootify swupd bundle-add libglib libxml2 && install_swupd_packages sassc | ||||||
|     elif has_command apt; then |     elif has_command apt; then | ||||||
|       rootify apt install -y sassc libglib2.0-dev-bin gtk2-engines-murrine libxml2-utils |       rootify apt install -y sassc libglib2.0-dev-bin gtk2-engines-murrine libxml2-utils | ||||||
|     elif has_command dnf; then |     elif has_command dnf; then | ||||||
| @ -99,7 +129,7 @@ install_beggy_deps() { | |||||||
|       rootify zypper in -y ImageMagick |       rootify zypper in -y ImageMagick | ||||||
|     elif has_command swupd; then |     elif has_command swupd; then | ||||||
|       # Rolling release |       # Rolling release | ||||||
|       prepare_swupd && rootify dnf install -y ImageMagick |       prepare_swupd && rootify swupd bundle-add ImageMagick | ||||||
|     elif has_command apt; then |     elif has_command apt; then | ||||||
|       rootify apt install -y imagemagick |       rootify apt install -y imagemagick | ||||||
|     elif has_command dnf; then |     elif has_command dnf; then | ||||||
| @ -126,7 +156,7 @@ install_dialog_deps() { | |||||||
|       rootify zypper in -y dialog |       rootify zypper in -y dialog | ||||||
|     elif has_command swupd; then |     elif has_command swupd; then | ||||||
|       # Rolling release |       # Rolling release | ||||||
|       prepare_swupd && rootify dnf install -y dialog |       prepare_swupd && install_swupd_packages dialog | ||||||
|     elif has_command apt; then |     elif has_command apt; then | ||||||
|       rootify apt install -y dialog |       rootify apt install -y dialog | ||||||
|     elif has_command dnf; then |     elif has_command dnf; then | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ | |||||||
| /* Active tab high contrast */ | /* Active tab high contrast */ | ||||||
| /*@import "WhiteSur/active-tab-contrast.css"; /**/ | /*@import "WhiteSur/active-tab-contrast.css"; /**/ | ||||||
| 
 | 
 | ||||||
| /* Use system theme icons instead of Adwaita icons included by theme */ | /* Use system theme icons instead of Adwaita icons included by theme [BUGGED] */ | ||||||
| /*@import "WhiteSur/system-icons.css"; /**/ | /*@import "WhiteSur/system-icons.css"; /**/ | ||||||
| 
 | 
 | ||||||
| /* Allow drag window from headerbar buttons (GNOMISH) [BUGGED]  | /* Allow drag window from headerbar buttons (GNOMISH) [BUGGED]  | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Muhammad Rivan
						Muhammad Rivan