1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-12-25 00:20:05 -07:00

kiss: Use run_repo_hook for update hook

This commit is contained in:
Dylan Araps 2020-09-27 09:00:49 +03:00
parent 65a4507ef9
commit 704d59533a
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

19
kiss
View File

@ -105,16 +105,18 @@ run_repo_hook() {
# Execute hooks which have the executable permission set, cat hooks which
# don't. Allows packages which only need to display a message to avoid
# executing any code.
[ -f "$sys_db/$2/$1" ] ||
_hook=${3:-"$sys_db/$2/$1"}
[ -f "$_hook" ] ||
return 0
log "$2" "running $1 hook"
if [ -x "$sys_db/$2/$1" ]; then
"$sys_db/$2/$1" 2>&1
if [ -x "$_hook" ]; then
"$_hook" 2>&1
else
cat "$sys_db/$2/$1"
cat "$_hook"
fi
}
@ -1174,7 +1176,7 @@ pkg_install() {
log "$pkg" "installed successfully"
}
pkg_updates() {
sys_update() {
# Check all installed packages for updates. So long as the installed
# version and the version in the repositories differ, it's considered
# an update.
@ -1252,10 +1254,7 @@ pkg_updates() {
;;
esac
if [ -x update ]; then
log "$PWD" "running update hook"
./update
fi
run_repo_hook update "$PWD" update
done
log "checking for new package versions"
@ -1443,7 +1442,7 @@ args() {
;;
u|update)
pkg_updates
sys_update
;;
v|version)