Automatically search and install AUR dependencies

This commit is contained in:
Santiago Lo Coco 2022-03-01 12:36:41 -03:00
parent 99421564ec
commit a466636968
1 changed files with 17 additions and 14 deletions

View File

@ -7,23 +7,27 @@ setPermissions() {
}
installAurDeps() {
if [ -n "$aurDeps" ] && [ "$aurDeps" = true ]; then
aurPkgs=()
sudo -u nobody makepkg --printsrcinfo > .SRCINFO
regExp="^[[:space:]]*\(make\)\?depends\(.\)* = \([[:alnum:][:punct:]]*\)[[:space:]]*$"
mapfile -t pkgDeps < <(sed -n -e "s/$regExp/\3/p" .SRCINFO)
for pkgDep in "${pkgDeps[@]}"; do
pkgName=$(echo "$pkgDep" | sed 's/[><=].*//')
set +e
pkgInfo=$(paru -Ss "${pkgName}" 2> /dev/null)
set -e
if ! echo "$pkgInfo" | grep "\/${pkgName} "; then
aurPkgs+=("$pkgName")
fi
done
if [ "${#aurPkgs[@]}" -gt 0 ]; then
pacman -S --noconfirm --needed git
git clone https://aur.archlinux.org/paru-bin.git
cd paru-bin; sudo -u nobody makepkg -si --noconfirm; cd ..
sudo -u nobody makepkg --printsrcinfo > .SRCINFO
regExp="^[[:space:]]*\(make\)\?depends\(.\)* = \([[:alnum:][:punct:]]*\)[[:space:]]*$"
mapfile -t pkgDeps < <(sed -n -e "s/$regExp/\3/p" .SRCINFO)
for pkgDep in "${pkgDeps[@]}"; do
pkgName=$(echo "$pkgDep" | sed 's/[><=].*//')
set +e
pkgInfo=$(paru -Ss "${pkgName}" 2> /dev/null | grep "\/${pkgName} ")
set -e
if echo "$pkgInfo" | grep -q "^aur\/"; then
paru -S --noconfirm "$pkgName"
fi
for aurPkg in "${aurPkgs[@]}"; do
paru -S --noconfirm "$aurPkg"
done
rm -rf paru-bin .SRCINFO
rm -rf paru-bin
fi
}
@ -92,7 +96,6 @@ getInputs() {
gpgPublicKey="$INPUT_GPGPUBLICKEY"
gpgPassphrase="$INPUT_GPGPASSPHRASE"
pkgDir="$INPUT_PKGDIR"
aurDeps="$INPUT_AURDEPS"
}
runScript() {