tcs-cleaner/installer

90 lines
2.8 KiB
Bash
Executable File

#!/usr/bin/bash
if [ ! $(whoami) = "root" ]
then
if [ -f "/usr/bin/dialog" ] || [ -f "/usr/sbin/dialog" ] || [ -f "/usr/games/dialog" ]
then
dialog --title "root" --msgbox "You need run this script as root" 0 0
else
echo "You need run this script as root"
fi
clear
exit
fi
#Depends
echo "installing depends"
if [ -f "/usr/bin/zypper" ] || [ -f "/usr/sbin/zypper" ] || [ -f "/usr/games/zypper" ]
then
echo zypper detected
zypper ref
zypper in dialog curl coreutils bash
else
if [ -f "/usr/bin/apt" ] || [ -f "/usr/sbin/apt" ] || [ -f "/usr/games/apt" ]
then
echo apt detected
apt update
apt install dialog curl coreutils bash
else
if [ -f "/usr/bin/dnf" ] || [ -f "/usr/sbin/dnf" ] || [ -f "/usr/games/dnf" ]
then
echo dnf detected
dnf install dialog curl coreutils bash
else
if [ -f "/usr/bin/pacman" ] || [ -f "/usr/sbin/pacman" ] || [ -f "/usr/games/pacman" ]
then
echo pacman detected
pacman -Syy
pacman -S dialog curl coreutils bash
else
if [ -f "/usr/bin/eopkg" ] || [ -f "/usr/sbin/eopkg" ] || [ -f "/usr/games/eopkg" ]
then
echo eopkg detected
eopkg install dialog curl coreutils bash
else
echo "aborting"
exit
fi
fi
fi
fi
fi
version=$(curl https://raw.githubusercontent.com/Can202/tcs-cleaner/main/version)
echo "remove tcs-cleaner if it's installed"
rm -vrf /usr/bin/tcs-cleaner
rm -vrf /usr/bin/tcs-cleaner-remove
echo "getting $version version of tcs-cleaner"
cd /tmp/
rm -vrf tcs-cleaner
mkdir -p tcs-cleaner
cd tcs-cleaner/
curl -LO https://raw.githubusercontent.com/Can202/tcs-cleaner/$version/tcs-cleaner
chmod a+x tcs-cleaner
cp tcs-cleaner /usr/bin/tcs-cleaner
curl -LO https://raw.githubusercontent.com/Can202/tcs-cleaner/$version/tcs-cleaner-remove
chmod a+x tcs-cleaner-remove
cp tcs-cleaner-remove /usr/bin/tcs-cleaner-remove
curl -LO https://raw.githubusercontent.com/Can202/tcs-cleaner/$version/desktops/tcs-cleaner.png
cp tcs-cleaner.png /usr/share/icons/hicolor/256x256/apps/tcs-cleaner.png
curl -LO https://raw.githubusercontent.com/Can202/tcs-cleaner/$version/desktops/tcs-cleaner-su.desktop
curl -LO https://raw.githubusercontent.com/Can202/tcs-cleaner/$version/desktops/tcs-cleaner-sudo.desktop
curl -LO https://raw.githubusercontent.com/Can202/tcs-cleaner/$version/desktops/tcs-cleaner.desktop
chmod a+x tcs-cleaner-su.desktop
chmod a+x tcs-cleaner-sudo.desktop
chmod a+x tcs-cleaner.desktop
cp tcs-cleaner.desktop /usr/share/applications/
cp tcs-cleaner-sudo.desktop /usr/share/applications/
cp tcs-cleaner-su.desktop /usr/share/applications/