morristech
11/24/2018 - 8:36 PM

The script for updating all Systemless Xposed Modules

The script for updating all Systemless Xposed Modules

# /usr/bin/env bash

oxver=89     # The original version on official server
xver=89.3    # Our own version
xcode=8930   # Our own version code for Magisk module

progress() {
	echo -e "\n\033[44m${1}\033[0m\n"
}

dl_ext() {
	if [ ! -f source/$zip ]; then
		progress "Downloading $zip"
		curl -o source/$zip -L http://dl-xda.xposed.info/framework/sdk${sdk}/${arch}/$zip
	fi
	progress "Extracting $zip"
	unzip -o source/$zip 'system/bin/*' -d $dir
	unzip -o source/$zip 'system/lib*' -d $dir
}

patch_bin() {
	progress "Patching files"
	for app_process in $dir/system/bin/app_process*_xposed; do
		mv -vf $app_process ${app_process%_xposed} 2>/dev/null
		sed -i 's/\/system\/xposed.prop\x0/\/xposed.prop\x0\x0\x0\x0\x0\x0\x0\x0/g' ${app_process%_xposed} && echo "Patching ${app_process%_xposed}"
	done
	sed -i "s/version=.*/version=${xver} (Systemless)/g" $dir/system/xposed.prop && echo "Patching $dir/system/xposed.prop"
}

common_patch() {
	progress "Universal files for SDK${sdk}"
	unzip -oj source/$zip system/framework/XposedBridge.jar -d xposed_${sdk}/common
	sed -i "s/version=..../version=${xver}/g; s/Code=.*/Code=${xcode}/g" xposed_${sdk}/module.prop && echo "Patching xposed_${sdk}/module.prop"
}

mkdir source 2>/dev/null

for sdk in {21..25}; do
	for arch in arm arm64 x86; do
		zip=xposed-v${oxver}-sdk${sdk}-${arch}.zip
		dir=xposed_${sdk}/${arch}
		dl_ext
		patch_bin
	done
	common_patch
done