summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2018-02-16 10:36:43 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2018-02-16 10:36:43 +0100
commitdaa7bdc42b38aa781d7983cdebe56220aa1ae7d1 (patch)
tree373f4770bce7b9d2af1f010ea999cd430b96a7fe
parentd9b47e1d998174c7c75e73206f904982880b8edb (diff)
downloadbin-daa7bdc42b38aa781d7983cdebe56220aa1ae7d1.zip
bin-daa7bdc42b38aa781d7983cdebe56220aa1ae7d1.tar.gz
arch-pkgs-update : try to clean pkgs list from unknown packages
-rwxr-xr-xarch-pkgs-update18
1 files changed, 15 insertions, 3 deletions
diff --git a/arch-pkgs-update b/arch-pkgs-update
index 64bb757..3bd8f74 100755
--- a/arch-pkgs-update
+++ b/arch-pkgs-update
@@ -3,7 +3,9 @@
[ $# -lt 1 ] && echo "usage $0 pkg_list (generated with pacman -Q)" && exit 1
tmp=/tmp/__pkgs
+bad=/tmp/__pkgs-bad
[ -e $tmp ] && rm $tmp
+[ -e $bad ] && rm $bad
echo " * read packages list"
pkgs=`cat $1 | gawk '{ print $1 }'`
@@ -13,9 +15,19 @@ for pkg in $pkgs; do
done
if [ -e $tmp ]; then
echo " * install packages"
- pkgs=$(cat $tmp)
- pacman -S $pkgs || exit 1
+ pacman -S `cat $tmp`
+ if [ $? -ne 0 ];
+ then
+ echo " * clean package list"
+ pacman -S `cat $tmp` 2>&1 | cut -d ':' -f 3 > $bad
+ cat $bad | while read pkg; do sed -i "/$pkg/d"; done
+ echo " * install packages"
+ pacman -S `cat $tmp`
+ fi
+ pacman -Scc
+ [ -r $tmp ] && echo "installed packages in $tmp"
+ [ -r $bad ] && echo "failed packages in $bad"
echo " * done"
else
- echo " * nothing todo"
+ echo " * all good"
fi