feat: Add pac ( a 0 skill wrapper for pacman/paru and flatpak)

This commit is contained in:
Fabio Lenherr / DashieTM 2023-10-03 23:25:32 +02:00
parent 5c63e259fc
commit 457c10f2f9
3 changed files with 2223 additions and 27 deletions

2156
scripts/flatpkg.txt Normal file

File diff suppressed because it is too large Load diff

67
scripts/pac Executable file
View file

@ -0,0 +1,67 @@
#!/bin/bash
pacfile="$HOME/.config/scripts/pacmanpkg.txt"
flatfile="$HOME/.config/scripts/flatpkg.txt"
save() {
rm "$pacfile"
pacvar=$(pacman -Q)
flatvar=$(flatpak list | awk '{ print $2 }')
if [ "$pacfile" != ' ' ]; then
touch "$pacfile"
fi
if [ "$flatfile" != ' ' ]; then
touch "$flatfile"
fi
echo "$pacvar" | awk '{ print $1 }' >>"$pacfile"
echo "$flatvar" >>"$flatfile"
}
load() {
sudo paru -S - <"$pacfile"
}
install() {
PKG=$(pacman -Ss "^$1$")
AURPKG=$(paru -Ss "^$1$")
SPLIT=$(echo "$1" | awk -F '-' '{ print $NF }')
if [ "$SPLIT" != '' ]; then
AURPKGGIT=$(paru -Ss "$1")
else
AURPKGGIT=''
fi
if [ "$PKG" == '' ] && [ "$AURPKG" != '' ] && [ "$AURPKGGIT" != '' ]; then
echo "warning, this is an aur package!"
paru -S "$1"
elif [ "$PKG" == '' ] && [ "$AURPKG" == '' ] && [ "$AURPKGGIT" == '' ]; then
FLT=$(flatpak search "$1")
if [ "$FLT" == '' ]; then
flatpak install "$1"
else
echo "No package found!"
fi
else
paru -S "$1"
fi
save
}
remove() {
PKG=$(pacman -Qs "$2")
if [ "$PKG" == '' ]; then
flatpak uninstall "$PKG"
else
sudo pacman -R "$PKG"
fi
save
}
if [ "$1" == "-S" ]; then
install "$2"
elif [ "$1" == "-R" ]; then
remove "$2"
elif [ "$1" == "save" ]; then
save
elif [ "$1" == "load" ]; then
load
fi

View file

@ -1,27 +0,0 @@
#!/bin/bash
pacfile="$HOME/.config/scripts/pacmanpkg.txt"
save() {
rm $pacfile
var=$(pacman -Q)
echo $var
if [ "$pacfile" != ' ' ]; then
touch $pacfile
fi
echo "$var" | awk '{ print $1 }' >>$pacfile
}
load() {
sudo paru -S - <$pacfile
}
if [ "$1" == "-S" ]; then
sudo pacman -S $2
elif [ "$1" == "-R" ]; then
sudo pacman -R $2
elif [ "$1" == "save" ]; then
save
elif [ "$1" == "load" ]; then
load
fi