install.sh: apt-get with , uninstall.sh: added var PKG_MANAGER and replaced apt-get with

This commit is contained in:
4s3ti 2019-09-03 10:09:48 +02:00
parent 510979ae90
commit d0c10db6ec
2 changed files with 7 additions and 6 deletions

View file

@ -431,7 +431,7 @@ addSoftwareRepo() {
wget -qO- https://swupdate.openvpn.net/repos/repo-public.gpg | $SUDO apt-key add - wget -qO- https://swupdate.openvpn.net/repos/repo-public.gpg | $SUDO apt-key add -
echo "deb http://build.openvpn.net/debian/openvpn/stable $OSCN main" | $SUDO tee /etc/apt/sources.list.d/swupdate.openvpn.net.list > /dev/null echo "deb http://build.openvpn.net/debian/openvpn/stable $OSCN main" | $SUDO tee /etc/apt/sources.list.d/swupdate.openvpn.net.list > /dev/null
echo -n "::: Adding OpenVPN repo for $PLAT $OSCN ..." echo -n "::: Adding OpenVPN repo for $PLAT $OSCN ..."
$SUDO apt-get -qq update & spinner $! $SUDO $PKG_MANAGER -qq update & spinner $!
echo " done!" echo " done!"
;; ;;
esac esac
@ -930,7 +930,7 @@ confUnattendedUpgrades() {
cd /etc/apt/apt.conf.d cd /etc/apt/apt.conf.d
if [[ $UNATTUPG == "unattended-upgrades" ]]; then if [[ $UNATTUPG == "unattended-upgrades" ]]; then
$SUDO apt-get --yes --quiet --no-install-recommends install "$UNATTUPG" > /dev/null & spinner $! $SUDO $PKG_MANAGER --yes --quiet --no-install-recommends install "$UNATTUPG" > /dev/null & spinner $!
if [[ $PLAT == "Ubuntu" ]]; then if [[ $PLAT == "Ubuntu" ]]; then
# Ubuntu 50unattended-upgrades should already just have security enabled # Ubuntu 50unattended-upgrades should already just have security enabled
# so we just need to configure the 10periodic file # so we just need to configure the 10periodic file

View file

@ -1,6 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# PiVPN: Uninstall Script # PiVPN: Uninstall Script
PKG_MANAGER="apt-get"
INSTALL_USER=$(cat /etc/pivpn/INSTALL_USER) INSTALL_USER=$(cat /etc/pivpn/INSTALL_USER)
INSTALL_HOME=$(grep -m1 "^${INSTALL_USER}:" /etc/passwd | cut -d: -f6) INSTALL_HOME=$(grep -m1 "^${INSTALL_USER}:" /etc/passwd | cut -d: -f6)
INSTALL_HOME=${INSTALL_HOME%/} # remove possible trailing slash INSTALL_HOME=${INSTALL_HOME%/} # remove possible trailing slash
@ -49,7 +50,7 @@ echo ":::"
while true; do while true; do
read -rp "::: Do you wish to remove $i from your system? [y/n]: " yn read -rp "::: Do you wish to remove $i from your system? [y/n]: " yn
case $yn in case $yn in
[Yy]* ) printf ":::\tRemoving %s..." "$i"; apt-get -y remove --purge "$i" &> /dev/null & spinner $!; printf "done!\n"; [Yy]* ) printf ":::\tRemoving %s..." "$i"; $PKG_MANAGER -y remove --purge "$i" &> /dev/null & spinner $!; printf "done!\n";
if [ "$i" == "openvpn" ]; then UINST_OVPN=1 ; fi if [ "$i" == "openvpn" ]; then UINST_OVPN=1 ; fi
if [ "$i" == "unattended-upgrades" ]; then UINST_UNATTUPG=1 ; fi if [ "$i" == "unattended-upgrades" ]; then UINST_UNATTUPG=1 ; fi
break;; break;;
@ -64,9 +65,9 @@ echo ":::"
# Take care of any additional package cleaning # Take care of any additional package cleaning
printf "::: Auto removing remaining dependencies..." printf "::: Auto removing remaining dependencies..."
apt-get -y autoremove &> /dev/null & spinner $!; printf "done!\n"; $PKG_MANAGER -y autoremove &> /dev/null & spinner $!; printf "done!\n";
printf "::: Auto cleaning remaining dependencies..." printf "::: Auto cleaning remaining dependencies..."
apt-get -y autoclean &> /dev/null & spinner $!; printf "done!\n"; $PKG_MANAGER -y autoclean &> /dev/null & spinner $!; printf "done!\n";
echo ":::" echo ":::"
# Removing pivpn files # Removing pivpn files
@ -83,7 +84,7 @@ echo ":::"
if [[ $PLAT == "Ubuntu" || $PLAT == "Debian" ]]; then if [[ $PLAT == "Ubuntu" || $PLAT == "Debian" ]]; then
printf "::: Removing openvpn apt source..." printf "::: Removing openvpn apt source..."
rm -rf /etc/apt/sources.list.d/swupdate.openvpn.net.list &> /dev/null rm -rf /etc/apt/sources.list.d/swupdate.openvpn.net.list &> /dev/null
apt-get -qq update & spinner $!; printf "done!\n"; $PKG_MANAGER -qq update & spinner $!; printf "done!\n";
fi fi
fi fi
if [[ $UINST_UNATTUPG = 1 ]]; then if [[ $UINST_UNATTUPG = 1 ]]; then