Fixed gpm function

This commit is contained in:
Phil 2023-03-12 17:53:14 +00:00
parent d170745571
commit 15adc3bc6c
2 changed files with 20 additions and 7 deletions

View File

@ -118,13 +118,13 @@ alias wireshark-pfsense-lab="sudo su -c 'wireshark -k -i <(ssh root@10.74.85.11
# Git Functions
function gpm() {
if [ "$(grep -c "[branch "master"]" .git/config )" -gt 0 ]; then
git push origin master
elif [ "$(grep -c "[branch "main"]" .git/config )" -gt 0 ]; then
git push origin main
if [ "$(grep -c '\[branch "master"\]' .git/config )" -gt 0 ]; then
git push origin master
elif [ "$(grep -c '\[branch "main"\]' .git/config )" -gt 0 ]; then
git push origin main
else
echo "fatal: not a git repository (or any of the parent directories): .git"
fi
echo "fatal: not a git repository (or any of the parent directories): .git"
fi
}
function gac() {
@ -202,6 +202,7 @@ sudo -v
else
echo "No Snap Found"
fi
## Parrot OS
if [ "$(grep -c "parrot" /etc/os-release)" -gt 0 ]; then
echo "Updating Apt Packages..."
if [ -d "/opt/sophos-av" ];then
@ -212,6 +213,7 @@ if [ "$(grep -c "parrot" /etc/os-release)" -gt 0 ]; then
sudo parrot-upgrade -y && sudo apt full-upgrade -y
fi
##Kali
elif [ "$(grep -c "kali" /etc/os-release)" -gt 0 ]; then
echo "Updating Apt Packages..."
if [ -d "/opt/sophos-av" ];then
@ -221,6 +223,7 @@ elif [ "$(grep -c "kali" /etc/os-release)" -gt 0 ]; then
else
sudo apt update && sudo apt --autoremove full-upgrade -y
fi
## Debian
elif [ "$(grep -c "debian" /etc/os-release)" -gt 0 ]; then
echo "Updating Apt Packages..."
if [ -d "/opt/sophos-av" ];then
@ -230,6 +233,7 @@ elif [ "$(grep -c "debian" /etc/os-release)" -gt 0 ]; then
else
sudo apt clean && sudo apt update && sudo apt full-upgrade -y
fi
##Arch
elif [ "$(grep -c "arch" /etc/os-release)" -gt 0 ]; then
echo "Updating Pacman Packages"
if [ -d "/opt/sophos-av" ];then
@ -240,7 +244,16 @@ elif [ "$(grep -c "arch" /etc/os-release)" -gt 0 ]; then
pacmanorphan=$(sudo pacman -Qdt)
sudo pacman -Syy -y && sudo -v && sudo pacman -Syu -y && sudo pacman --noconfirm -R $(pacman -Qdtq)
fi
## Fedora
elif [ "$(grep -c "fedora" /etc/os-release)" -gt 0 ]; then
echo "Updating DNF Packages"
if [ -d "/opt/sophos-av" ];then
sudo service sav-protect stop >> /dev/null
sudo dnf update -y && sudo dnf autoremove -y
sudo service sav-protect start >> /dev/null
else
sudo dnf update -y && sudo dnf autoremove -y
fi
else
echo "No apt or pacman found. I guess you're out of luck"
fi

Binary file not shown.