Commit 63f898c1 authored by Natanael Copa's avatar Natanael Copa

lbu: implement support for lbu package pre/post hooks

scripts in /etc/lbu/pre-package.d/ will be executed prior creating the
tar ball and scripts in /etc/lbu/post-package.d/ will be executed after.

if pre-scripts fails, then will package not be created.

ref #220
parent add06520
...@@ -21,6 +21,9 @@ INCLUDE_LIST="$sysconfdir"/include ...@@ -21,6 +21,9 @@ INCLUDE_LIST="$sysconfdir"/include
DEFAULT_CIPHER="aes-256-cbc" DEFAULT_CIPHER="aes-256-cbc"
LBU_CONF="$sysconfdir"/lbu.conf LBU_CONF="$sysconfdir"/lbu.conf
LBU_PREPACKAGE="$sysconfdir"/pre-package.d
LBU_POSTPACKAGE="$sysconfdir"/post-package.d
if [ -f "$LBU_CONF" ]; then if [ -f "$LBU_CONF" ]; then
. "$LBU_CONF" . "$LBU_CONF"
fi fi
...@@ -230,6 +233,10 @@ cmd_package() { ...@@ -230,6 +233,10 @@ cmd_package() {
check_openssl check_openssl
init_tmpdir tmpdir init_tmpdir tmpdir
if [ -d "$LBU_PREPACKAGE" ]; then
run-parts "$LBU_PREPACKAGE" || return 1
fi
[ -n "$ENCRYPTION" ] && suff="$suff.$ENCRYPTION" [ -n "$ENCRYPTION" ] && suff="$suff.$ENCRYPTION"
# find filename # find filename
...@@ -294,6 +301,9 @@ cmd_package() { ...@@ -294,6 +301,9 @@ cmd_package() {
fi fi
[ $rc -eq 0 ] && vecho "Created $pkg" [ $rc -eq 0 ] && vecho "Created $pkg"
fi fi
if [ -d "$LBU_POSTPACKAGE" ]; then
run-parts "$LBU_POSTPACKAGE"
fi
return $rc return $rc
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment