pmt: fix std::filesystem exceptions
This commit is contained in:
121
manager.sh
Normal file
121
manager.sh
Normal file
@@ -0,0 +1,121 @@
|
||||
#!/data/data/com.termux/files/usr/bin/env bash
|
||||
#
|
||||
# Copyright 2025 Yağız Zengin
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
THIS="$(basename $0)"
|
||||
RELEASE="20250810"
|
||||
|
||||
echo() { command echo "[$THIS]: $@"; }
|
||||
|
||||
checks()
|
||||
{
|
||||
if ! curl "https://github.com" &>/dev/null; then
|
||||
echo "No internet connection!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Updating repositories and checking required packages..."
|
||||
pkg update &>/dev/null
|
||||
[ ! -f $PREFIX/bin/unzip ] && pkg install -y unzip
|
||||
[ ! -f $PREFIX/bin/wget ] && pkg install -y wget
|
||||
}
|
||||
|
||||
select_variant()
|
||||
{
|
||||
LINK=""; ARCH=""; VARIANT=""
|
||||
|
||||
if getprop ro.product.cpu.abi | grep "arm64-v8a" &>/dev/null; then ARCH="arm64-v8a";
|
||||
else ARCH="armeabi-v7a"
|
||||
fi
|
||||
[ $1 == "static" ] && VARIANT="static-"
|
||||
|
||||
LINK="https://github.com/ShawkTeam/pmt-renovated/releases/download/${RELEASE}/pmt-${VARIANT}${ARCH}.zip"
|
||||
}
|
||||
|
||||
download()
|
||||
{
|
||||
mkdir -p $PREFIX/tmp
|
||||
echo "Downloading pmt-${VARIANT}${ARCH}.zip (${RELEASE})"
|
||||
if ! wget -o $PREFIX/tmp/pmt.zip "${LINK}" &>/dev/null; then
|
||||
echo "Download failed! LINK=${LINK}"
|
||||
rm $PREFIX/tmp/*.zip
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Extracting..."
|
||||
if ! unzip -d $PREFIX/tmp $PREFIX/tmp/pmt.zip &>/dev/null; then
|
||||
echo "Extraction failed!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
setup()
|
||||
{
|
||||
[ -f $PREFIX/tmp/pmt_static ]; mv $PREFIX/tmp/pmt_static $PREFIX/tmp/pmt
|
||||
set -e
|
||||
install -t $PREFIX/bin $PREFIX/tmp/pmt
|
||||
if [ -f $PREFIX/tmp/libhelper.so ]; then
|
||||
install -t $PREFIX/lib $(find $PREFIX/tmp -name "lib*.so")
|
||||
install -t $PREFIX/lib $(find $PREFIX/tmp -name "lib*.a")
|
||||
fi
|
||||
echo "Installed successfully. Try running 'pmt' command."
|
||||
}
|
||||
|
||||
uninstall()
|
||||
{
|
||||
rm -f $PREFIX/pmt $PREFIX/lib/libhelper* $PREFIX/libpartition_map* &>/dev/null
|
||||
}
|
||||
|
||||
is_installed()
|
||||
{
|
||||
if /system/bin/which pmt &>/dev/null; then
|
||||
echo "PMT is already installed."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup()
|
||||
{
|
||||
rm -f $PREFIX/tmp/pmt* $PREFIX/tmp/lib* $PREFIX/tmp/*.zip &>/dev/null
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
command echo "Usage: $0 install|uninstall [--static]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
"install")
|
||||
is_installed
|
||||
checks
|
||||
select_variant $([ "$2" == "--static" ] && echo static)
|
||||
download
|
||||
setup
|
||||
;;
|
||||
"uninstall")
|
||||
uninstall && echo "Uninstalled successfully."
|
||||
;;
|
||||
"reinstall")
|
||||
uninstall
|
||||
checks
|
||||
select_variant $([ "$2" == "--static" ] && echo static)
|
||||
download
|
||||
setup
|
||||
;;
|
||||
*)
|
||||
command echo "$0: Unknown argument: $1"
|
||||
exit 1 ;;
|
||||
esac
|
||||
Reference in New Issue
Block a user