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