An cli to install module directly from the Magisk-Modules-Alt-Repo
Usage: getisk install mkshrc:master
install the module to be installed
help prints this help message
An cli to install module directly from the Magisk-Modules-Alt-Repo
Usage: getisk install mkshrc:master
install the module to be installed
help prints this help message
#!/system/bin/sh | |
if [ -z "$TMPDIR" ]; then | |
echo "! \$TMPDIR is unset or zero but is required by this cli" | |
exit 0 | |
fi | |
if ! command -v xh > /dev/null;then | |
echo "! couldn't find xh binary. Did you have xh installed? Learn more at https://github.com/ducaale/xh#via-a-package-manager" | |
exit 0 | |
fi | |
function install { | |
local RAW_NAME="$1" | |
if [ -z "$RAW_NAME" ]; then | |
echo "! Cannot download with empty name" | |
fi | |
local NAME="$(echo "$RAW_NAME" | cut -f 1 -d ":")" | |
local CUT_BRANCH=$(echo "$RAW_NAME" | cut -f 2 -d ":") | |
local BRANCH="${CUT_BRANCH:="master"}" | |
local URL="https://github.com/Magisk-Modules-Alt-Repo/$NAME/archive/refs/heads/$BRANCH.tar.gz" | |
local tarball_tmp="$TMPDIR/$NAME.$RANDOM.tar.gz" | |
echo "- Download $NAME ($BRANCH)" | |
xh --download "$URL" --output "$tarball_tmp" #|| abort 0 "> Failed to download $url" | |
echo "- Extracting..." | |
local temp=$(mktemp -dt $NAME.XXXXXXXXXX) | |
local module_temp=$(mktemp -dt $NAME.XXXXXX) | |
if [ -f "$tarball_tmp" ]; then | |
tar xfz $tarball_tmp -C "$temp" | |
cd "$temp/$NAME-$BRANCH" | |
zip -r "$module_temp.zip" ./* | |
magisk --install-module "$module_temp.zip" | |
rm -rf "$temp" $tarball_tmp* | |
else | |
echo "! $tarball_tmp was not found!" | |
exit 0 | |
fi | |
} | |
function phelp { | |
echo "" | |
echo "Usage: getisk install mkshrc:master" | |
echo "" | |
echo "\tinstall \t the module to be installed" | |
echo "\thelp \t prints this help message" | |
exit 1 # Exit script after printing help | |
} | |
while [ "${1:-}" != "" ]; | |
do | |
case "$1" in | |
"install") | |
install "$2" | |
;; | |
"help") | |
phelp | |
;; | |
esac | |
shift | |
done |