From fe424a56838805f7a043201f6b3558a7a05c178e Mon Sep 17 00:00:00 2001 From: "Christos.K" Date: Tue, 29 Aug 2017 16:48:27 +0300 Subject: Cleanup --- config.d/controller/modules/cinit_clean.sh | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/config.d/controller/modules/cinit_clean.sh b/config.d/controller/modules/cinit_clean.sh index e69de29..0cdc92e 100755 --- a/config.d/controller/modules/cinit_clean.sh +++ b/config.d/controller/modules/cinit_clean.sh @@ -0,0 +1,38 @@ +# EXPORT CONTROLLER CONFDIR +CTCONFDIR=/config.d +export CTCONFDIR +# EXPORT LOCAL SCRIPTDIR +CTSCRIPTS=/usr/local/controller +export CTSCRIPTS +# UPDATE PATH +export "PATH=${PATH}:/usr/local/controller" +# CONTROLLER PRELIMINARY FUNCTIONS +source "${CTSCRIPTS}/ct_prelim.sh" +# MAKE SURE RFS BFS WORKDIR ARE NOT MOUNTED +_unmount_all_targets + +if [[ "${_ctflag_setup}" == 0 || "${_ctflag_extract}" == 0 || "${_sys_config}" == 0 ]]; then + if [[ -z "${_sys_archive}" ]]; then + if [[ -z "${_server_version}" ]]; then + _server_version="$(cat "${CTCONFDIR}/version")" + fi + + _sys_archive="stage3-amd64-${_server_version}.tar.bz2" + fi + + mount -L "SYSFS" "/mnt/workdir" + + if [[ "${_ctflag_extract}" == 0 ]]; then + rm -f "/mnt/workdir/${_sys_archive}" + rm -f "/mnt/workdir/${_sys_archive}.md5sum" + rm -f "/mnt/workdir/${_sys_archive}.sig" + fi + + if [[ "${_sys_config}" == 0 ]]; then + rm -rf "/mnt/workdir/var/tmp/ctworkdir" + fi + + umount "/mnt/workdir" +fi + + -- cgit v1.2.3-65-gdbad