scripts/Apps/proxytext/proxytext-wrapper.sh

88 lines
1.9 KiB
Bash
Raw Normal View History

2022-05-09 14:39:31 +00:00
#!/bin/bash
function check_android () {
if $(uname -o) -ne "Android"
then
return false
fi
return true
}
function proot_install_dependencies () {
apt update -y
apt install git chromium nodejs npm -y
npm install -g --silent yarn
}
function proot_install_proxytext () {
echo "Installing proxytext."
git clone https://gitlab.com/tretrauit/proxytext.git
cd proxytext
yarn install
}
function proot_launch_proxytext () {
echo "Launching proxytext."
cd proxytext
2022-05-09 16:52:51 +00:00
git pull
2022-05-09 14:39:31 +00:00
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium yarn start
}
function install_dependencies () {
2022-05-09 16:52:51 +00:00
echo "Checking dependencies."
2022-05-09 14:39:31 +00:00
declare -a dependencies=("proot-distro")
for i in "${dependencies[@]}"
do
if ! [ -x "$(command -v \"$i\")" ]; then
echo "Installing $i..."
pkg install $i
fi
done
}
function install_dependencies_debian () {
2022-05-09 16:52:51 +00:00
echo "Installing dependencies in Debian proot."
2022-05-09 14:39:31 +00:00
proot-distro login debian --termux-home -- bash ./proxytext-wrapper.sh --proot --install-dependencies
echo "Done."
}
function install_debian() {
2022-05-09 16:52:51 +00:00
echo "Installing Debian proot."
2022-05-09 14:39:31 +00:00
proot-distro install debian
}
function install_proxytext () {
proot-distro login debian --termux-home -- bash ./proxytext-wrapper.sh --proot --install
}
function start_proxytext () {
proot-distro login debian --termux-home -- bash ./proxytext-wrapper.sh --proot --launch
}
if [[ "$1" = "--proot" ]]
then
if [[ "$2" = "--launch" ]]
then
proot_launch_proxytext
elif [[ "$2" = "--install" ]]
then
proot_install_proxytext
elif [[ "$2" = "--install-dependencies" ]]
then
proot_install_dependencies
fi
exit 0
fi
if [[ check_android = false ]];
then
echo "This script only supports Android using Termux."
exit 1
fi
install_dependencies
install_debian
install_dependencies_debian
[ ! -d "./proxytext" ] && install_proxytext
start_proxytext