diff --git a/noPartial.hook b/noPartial.hook new file mode 100644 index 0000000..ac15968 --- /dev/null +++ b/noPartial.hook @@ -0,0 +1,9 @@ +[Trigger] +Operation = Install +Type = Package +Target = * +[Action] +Description = Avoiding partial upgrades +When = PreTransaction +Exec = /etc/pacman.d/hooks.bin/noPartial.sh +AbortOnFail diff --git a/noPartial.sh b/noPartial.sh new file mode 100755 index 0000000..f6733d9 --- /dev/null +++ b/noPartial.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +RED='\033[0;31m' +LUPDATE="$(grep 'pacman -Syu' /var/log/pacman.log | tail -1| awk -F'[][]' '{print $2}')" +MODPKGS="$(find /var/cache/pacman/pkg -type f -newermt $LUPDATE)" + +if [[ -n $MODPKGS ]]; then + echo + echo -e "\a" + echo -e " ${RED}[WARNING]${NC}" + echo -e " ${RED}There are newer package files in the cache${NC}" + echo -e " ${RED}Sending error signals and aborting${NC}" + echo + echo -e " ${RED}Please run full update before continuing${NC}" + echo + exit 1 +elif [[ -z $MODPKGS ]]; then + exit 0 +else + echo " Error?" + exit 1 +fi