Skip to content

Commit

Permalink
issue resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
Mukesh Kumar committed Apr 14, 2022
1 parent 770b881 commit 975d1fa
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 35 deletions.
49 changes: 38 additions & 11 deletions installation
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,44 @@ currentVersion="2.1.2"
declare -a tools=(cheat cipher covidinfo crypt cryptocurrency geo gif googler ipinfo jukebox lyrics meme movie news pwned qrify shareterminal shodan shorturl termux-snippets todo transfer weather)

##Platform Check
distr_name=$1
if command -v termux-setup-storage
then
platform="Termux"
showError="Try execute install script again."
prefix="/data/data/com.termux/files/"
else
platform="Debian"
showError="Try running install script again with root privileges."
prefix=" "
fi
# distr_name=$1
# if command -v termux-setup-storage
# then
# platform="Termux"
# showError="Try execute install script again."
# prefix="/data/data/com.termux/files/"
# else
# platform="Debian"
# showError="Try running install script again with root privileges."
# prefix=" "
# fi

if [[ "$OSTYPE" == linux-android* ]]; then
distro="termux"
platform="Termux"
prefix="/data/data/com.termux/files/"
showError="Try execute install script again."
fi

if [ -z "$distro" ]; then
distro=$(ls /etc | awk 'match($0, "(.+?)[-_](?:release|version)", groups) {if(groups[1] != "os") {print groups[1]}}')
platform="Debian"
prefix=""
showError="Try running install script again with root privileges."
fi

if [ -z "$distro" ]; then
if [ -f "/etc/os-release" ]; then
distro="$(source /etc/os-release && echo $ID)"
elif [ "$OSTYPE" == "darwin" ]; then
distro="darwin"
platform="Darwin"
prefix=""
showError="Try running install script again with root privileges."
else
distro="invalid"
fi
fi


installationEnd()
Expand Down
50 changes: 39 additions & 11 deletions termux-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,45 @@ MAGENTABG="$(printf '\033[45m')" CYANBG="$(printf '\033[46m')" WHITEBG="$(prin
RESETBG="$(printf '\e[0m')" BLINK="$(printf '\033[5;31m')"

##Platform Check
distr_name=$1
if command -v termux-setup-storage
then
platform="Termux"
showError="Try execute install script again."
prefix="/data/data/com.termux/files/"
else
platform="Debian"
showError="Try running install script again with root privileges."
prefix=" "
fi
# distr_name=$1
# if command -v termux-setup-storage
# then
# platform="Termux"
# showError="Try execute install script again."
# prefix="/data/data/com.termux/files/"
# else
# platform="Debian"
# showError="Try running install script again with root privileges."
# prefix=" "
# fi

if [[ "$OSTYPE" == linux-android* ]]; then
distro="termux"
platform="Termux"
prefix="/data/data/com.termux/files/"
showError="Try execute uninstall script again."
fi

if [ -z "$distro" ]; then
distro=$(ls /etc | awk 'match($0, "(.+?)[-_](?:release|version)", groups) {if(groups[1] != "os") {print groups[1]}}')
platform="Debian"
prefix=""
showError="Try running uninstall script again with root privileges."
fi

if [ -z "$distro" ]; then
if [ -f "/etc/os-release" ]; then
distro="$(source /etc/os-release && echo $ID)"
elif [ "$OSTYPE" == "darwin" ]; then
distro="darwin"
platform="Darwin"
prefix=""
showError="Try running uninstall script again with root privileges."
else
distro="invalid"
fi
fi


## This function determines which http get tool the system has installed and returns an error if there isnt one
getConfiguredClient()
Expand Down
53 changes: 40 additions & 13 deletions uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,44 @@ declare -a tools=(termux-snippets cheat cipher covidinfo crypt cryptocurrency ge
all="1"

##Platform Check
if command -v termux-setup-storage
then
distr_name=$1
fi
if [ "$distr_name" == "Android" ]; then
platform="Termux"
prefix="/data/data/com.termux/files/"
else
platform="Debian"
prefix=""
fi
# if command -v termux-setup-storage
# then
# distr_name=$1
# fi
# if [ "$distr_name" == "Android" ]; then
# platform="Termux"
# prefix="/data/data/com.termux/files/"
# else
# platform="Debian"
# prefix=""
# fi

if [[ "$OSTYPE" == linux-android* ]]; then
distro="termux"
platform="Termux"
prefix="/data/data/com.termux/files/"
showError="Try execute uninstall script again."
fi

if [ -z "$distro" ]; then
distro=$(ls /etc | awk 'match($0, "(.+?)[-_](?:release|version)", groups) {if(groups[1] != "os") {print groups[1]}}')
platform="Debian"
prefix=""
showError="Try running uninstall script again with root privileges."
fi

if [ -z "$distro" ]; then
if [ -f "/etc/os-release" ]; then
distro="$(source /etc/os-release && echo $ID)"
elif [ "$OSTYPE" == "darwin" ]; then
distro="darwin"
platform="Darwin"
prefix=""
showError="Try running uninstall script again with root privileges."
else
distro="invalid"
fi
fi

askUninstall()
{
Expand All @@ -30,7 +57,7 @@ askUninstall()
read -r answer
if [[ "$answer" == [Yy] ]]; then
echo -n "Removing $1: "
rm -f $prefix/usr/bin/$1 > /dev/null 2>&1 || { echo "Failed"; echo "Error removing file, try running uninstall script again"; exit 1; }
rm -f $prefix/usr/bin/$1 > /dev/null 2>&1 || { echo "Failed"; echo $showError; exit 1; }
echo ""$GREEN"Success$RESETBG"
else
all="0"
Expand All @@ -43,7 +70,7 @@ removeTool()
{
if [[ -f $prefix/usr/bin/$1 ]]; then
echo -n "Removing $1: "
rm -f $prefix/usr/bin/$1 > /dev/null 2>&1 || { echo "Failed" ; echo "Error removing file, try running uninstall script again"; exit 1; }
rm -f $prefix/usr/bin/$1 > /dev/null 2>&1 || { echo "Failed" ; echo $showError; exit 1; }
echo ""$GREEN"Success$RESETBG"
fi
}
Expand Down

0 comments on commit 975d1fa

Please sign in to comment.