From ad20277b602eaba24f05a4c26762913d4c24a31f Mon Sep 17 00:00:00 2001 From: airclay Date: Sun, 5 Sep 2021 12:23:56 -0500 Subject: [PATCH] avoid partial updates --- noPartial.hook | 9 +++++++++ noPartial.sh | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 noPartial.hook create mode 100755 noPartial.sh 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