This commit is contained in:
tuxwarrior
2024-05-01 15:56:09 -05:00
parent a4a30f2af1
commit 49c8eac6be

View File

@@ -63,12 +63,15 @@ if [ ${operation} == "update" ] ; then
exit 1 exit 1
fi fi
# https://stackoverflow.com/questions/30988586/creating-an-array-from-a-text-file-in-bash # https://unix.stackexchange.com/questions/157328/how-can-i-remove-all-comments-from-a-file
sed '/^[[:blank:]]*#/d;s/#.*//' ${trg_file} > ${trg_file}.tmp sed '/^[[:blank:]]*#/d;s/#.*//' ${trg_file} > ${trg_file}.tmp
# https://stackoverflow.com/questions/30988586/creating-an-array-from-a-text-file-in-bash
mapfile -t packages < ${trg_file}.tmp mapfile -t packages < ${trg_file}.tmp
installed=$(pacman -Qq) installed=$(pacman -Qq)
list=() list=()
list_aur=()
for x in ${packages[@]} for x in ${packages[@]}
do do
if [[ $installed == *$x* ]] if [[ $installed == *$x* ]]
@@ -77,8 +80,12 @@ if [ ${operation} == "update" ] ; then
elif [[ $installed != *$x* ]] elif [[ $installed != *$x* ]]
then then
if [[ $(echo "$installed" | grep -E -o "^$x$") != $x ]] then if [[ $(echo "$installed" | grep -E -o "^$x$") != $x ]] then
echo "Adding $x to list" if [[ "$x" =~ ^aur:* ]]; then
list+="$x " echo "Adding $x to aur list"
else
echo "Adding $x to normal list"
list+="$x "
fi
else else
echo "Skipping (2) $x" echo "Skipping (2) $x"
fi fi