avoid partial updates

This commit is contained in:
airclay 2021-09-05 12:23:56 -05:00
parent 0cef72041c
commit ad20277b60
2 changed files with 31 additions and 0 deletions

9
noPartial.hook Normal file
View File

@ -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

22
noPartial.sh Executable file
View File

@ -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