forked from kiss-community/kiss
kiss: add run_hook_pkg and pre-remove user hook
This commit is contained in:
parent
4931d9762c
commit
018c362a5f
22
kiss
22
kiss
@ -121,6 +121,14 @@ run_hook() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_hook_pkg() {
|
||||||
|
# Run a hook from the package's database files.
|
||||||
|
if [ -x "$sys_db/$2/$1" ]; then
|
||||||
|
log "$2" "Running $1 hook"
|
||||||
|
"$sys_db/$2/$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
decompress() {
|
decompress() {
|
||||||
case $1 in
|
case $1 in
|
||||||
*.bz2) bzip2 -d ;;
|
*.bz2) bzip2 -d ;;
|
||||||
@ -1184,10 +1192,8 @@ pkg_remove() {
|
|||||||
# incomplete package installed.
|
# incomplete package installed.
|
||||||
trap '' INT
|
trap '' INT
|
||||||
|
|
||||||
if [ -x "$sys_db/$1/pre-remove" ]; then
|
run_hook_pkg pre-remove "$1"
|
||||||
log "$1" "Running pre-remove hook"
|
run_hook pre-remove "$1" "$sys_db/$1"
|
||||||
"$sys_db/$1/pre-remove"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make a backup of the etcsums file (if it exists).
|
# Make a backup of the etcsums file (if it exists).
|
||||||
cp -f "$sys_db/$1/etcsums" "$mak_dir/c" 2>/dev/null || : > "$mak_dir/c"
|
cp -f "$sys_db/$1/etcsums" "$mak_dir/c" 2>/dev/null || : > "$mak_dir/c"
|
||||||
@ -1342,12 +1348,8 @@ pkg_install() {
|
|||||||
# need to block 'Ctrl+C'.
|
# need to block 'Ctrl+C'.
|
||||||
trap pkg_clean EXIT INT
|
trap pkg_clean EXIT INT
|
||||||
|
|
||||||
if [ -x "$sys_db/$pkg_name/post-install" ]; then
|
run_hook_pkg post-install "$pkg_name"
|
||||||
log "$pkg_name" "Running post-install hook"
|
run_hook post-install "$pkg_name" "$sys_db/$pkg_name"
|
||||||
"$sys_db/$pkg_name/post-install"
|
|
||||||
fi
|
|
||||||
|
|
||||||
run_hook post-install "$pkg_name" "$sys_db/$pkg_name"
|
|
||||||
|
|
||||||
log "$pkg_name" "Installed successfully"
|
log "$pkg_name" "Installed successfully"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user