diff options
| author | Xiao Pan <xyz@flylightning.xyz> | 2025-05-21 04:53:05 -0700 | 
|---|---|---|
| committer | Xiao Pan <xyz@flylightning.xyz> | 2025-05-21 04:55:18 -0700 | 
| commit | 77f1d24fec74383d58258c6b2ca1dc69d428c22e (patch) | |
| tree | 9dada21e1eac46edd1046f0b118cd16e77245a9a /sh/upd | |
| parent | fce8ba19a0118e2f4f21cfc84c6ba08cc92aa564 (diff) | |
upd auto update zoom-firejail with new zoom MIME
Everytime upd is ran, I usually do this every two days, it will also
auto update aur/zoom-firejail files if aur/zoom desktop entry has new
MIME types. I prefer manually read the changes then build and test to
make sure it works before aurpublish.
Diffstat (limited to 'sh/upd')
| -rwxr-xr-x | sh/upd | 40 | 
1 files changed, 40 insertions, 0 deletions
| @@ -206,6 +206,45 @@ pac () {  	pacman -Qqne > "$XDG_CONFIG_HOME/myconf/pacman_Qqne"  	systemctl list-unit-files --state=enabled > "$XDG_CONFIG_HOME/myconf/sye"  	systemctl --user list-unit-files --state=enabled > "$XDG_CONFIG_HOME/myconf/syue" + +	if echo "$aurpacs" | grep -q 'zoom-[0-9]'; then +		new_schemes="$(grep -m1 '^X-KDE-Protocols=' /usr/share/applications/Zoom.desktop)" +		old_schemes="$(grep -m1 '^X-KDE-Protocols=' "$HOME/programs/repos/aur/zoom-firejail/ZoomFirejail.desktop")" + +		if [ "$new_schemes" != "$old_schemes" ]; then +			zoom_firejail_log="zoom-firejail updated MIME type, test then aurpublish" +			# aur/zoom-firejail author snowball did not include +			# application/x-zoom in MimeType, not sure why, I decided to follow +			# what he did anyway +			new_mime="$(awk -F';' ' +			/^MimeType=/ { +				for(i=1;i<=NF;i++) +					if($i != "application/x-zoom" && $i != "") +						printf("%s;",$i) +				exit +			}' /usr/share/applications/Zoom.desktop)" +			schemes="$(echo "$new_schemes" | awk -F'[=;]' ' +			{ +				for(i=2;i<=NF;i++) +					if($i != "") +						printf(" %s",$i) +			} +			')" + +			sed -i -e "s/^X-KDE-Protocols=.*/$new_schemes/" \ +				-e "s#^MimeType=.*#$new_mime#" \ +				"$HOME/programs/repos/aur/zoom-firejail/ZoomFirejail.desktop" +			sed -i "s/^\(    for scheme in\).*\(; do\)$/\1${schemes}\2/" "$HOME/programs/repos/aur/zoom-firejail/zoom-firejail.install" +			desktop_sum="$(sha512sum "$HOME/programs/repos/aur/zoom-firejail/ZoomFirejail.desktop" | awk '{printf("%s",$1)}')" +			old_pkgrel="$(awk -F= '/^pkgrel=/{printf("%d",$2);exit}' "$HOME/programs/repos/aur/zoom-firejail/PKGBUILD")" +			sed -i "s/^\(    if \[ \$(vercmp \$2 [0-9]\+\.[0-9]\+\.[0-9]\+-\)[0-9]\+\() -le 0 \]; then\)$/\1${old_pkgrel}\2/" \ +				"$HOME/programs/repos/aur/zoom-firejail/zoom-firejail.install" +			sed -i -e "s/^pkgrel=.*/pkgrel=$((old_pkgrel+1))/" \ +				-e "s/^sha512sums=.*/sha512sums=('$desktop_sum'/" \ +				"$HOME/programs/repos/aur/zoom-firejail/PKGBUILD" +		fi +	fi +  	# pacdiff default use pacman database, so no need `sudo -E` for find, but will be a little bit slower  	# [^-] consider util-linux; \(^\|[^-]\) consider linux is the first package, ex: pacout is only 'linux-6.6.6'  	log="$log @@ -214,6 +253,7 @@ updated aur packages: $aurpacs  pacdiff: $(pacdiff -o | tr '\n' ' ')  checkrebuild: $checkrebuild_pacs  $(if echo "$pacpacs" | grep -q '\(^\|[^-]\)linux-\(megi-\)\?[0-9]'; then echo 'kernel upgraded, need reboot'; fi) +$zoom_firejail_log  "  } | 
