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
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
# https://stackoverflow.com/questions/30988586/creating-an-array-from-a-text-file-in-bash
mapfile -t packages < ${trg_file}.tmp
installed=$(pacman -Qq)
list=()
list_aur=()
for x in ${packages[@]}
do
if [[ $installed == *$x* ]]
@@ -77,8 +80,12 @@ if [ ${operation} == "update" ] ; then
elif [[ $installed != *$x* ]]
then
if [[ $(echo "$installed" | grep -E -o "^$x$") != $x ]] then
echo "Adding $x to list"
list+="$x "
if [[ "$x" =~ ^aur:* ]]; then
echo "Adding $x to aur list"
else
echo "Adding $x to normal list"
list+="$x "
fi
else
echo "Skipping (2) $x"
fi