From 9839ad87f60edf33079f0a847c7c1ece6413d172 Mon Sep 17 00:00:00 2001 From: fatalerrors Date: Wed, 27 Oct 2021 10:46:04 +0200 Subject: [PATCH] added pre and post installation directory and implemented one for ntp --- init.sh | 6 ++++++ lib/zzz_main_fct.sh | 2 +- prepost.d/ntp.sh | 21 +++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 prepost.d/ntp.sh diff --git a/init.sh b/init.sh index c5e821e..107f664 100755 --- a/init.sh +++ b/init.sh @@ -120,6 +120,12 @@ load_autoconf load_configuration +# Load pre and post actions for package manager +for prepost in $MYPATH/prepost/*.sh; do + . $prepost +done +unset $prepost + process_commandline_and_vars set_system_proxy diff --git a/lib/zzz_main_fct.sh b/lib/zzz_main_fct.sh index 53317b3..d6d5d6e 100644 --- a/lib/zzz_main_fct.sh +++ b/lib/zzz_main_fct.sh @@ -153,7 +153,7 @@ chroot_bootstrap() fi local tmpdir=$(mktemp -d $CHROOT_PATH/tmp/init.sh-XXXX) - local bootstrap_items="conf lib modules repo bash.rc init.sh" + local bootstrap_items="conf lib modules repo bash.rc init.sh prepost.d" if [[ $RESUME == true ]]; then bootstrap_items="$bootstrap_items $STAGE_FILE" fi diff --git a/prepost.d/ntp.sh b/prepost.d/ntp.sh new file mode 100644 index 0000000..f003bf9 --- /dev/null +++ b/prepost.d/ntp.sh @@ -0,0 +1,21 @@ +# ------------------------------------------------------------------------------ +# NTP package pre and post configuration +# This file is part of the init.sh project +# Copyright (c) 2019-2021 Geoffray Levasseur +# ------------------------------------------------------------------------------ +# This file is distributed under 3-clause BSD license. +# The complete license agreement can be obtained at: +# https://opensource.org/licenses/BSD-3-Clause +# ------------------------------------------------------------------------------ + +preupgd_ntp() +{ + svc_stop ntp +} +export -f preupgd_ntp + +postupgd_ntp() +{ + svc_start ntp +} +export -f postupgd_ntp