Avoid trying to delete depts when no config file

This commit is contained in:
viennet 2021-01-02 00:18:47 +01:00
parent e2a2b0f083
commit 44dde2e678

View File

@ -17,6 +17,7 @@ usage() {
set -euo pipefail
cd /opt/scodoc/Products/ScoDoc || exit 2
source config/config.sh
source config/utils.sh
if [ $# -lt 1 ]
@ -38,7 +39,11 @@ shift
if [ "$recreate_dept" = 1 ]
then
(cd config || terminate "no config directory"; ./delete_dept.sh -n "$DEPT") || terminate "error deleting dept $DEPT"
cfg_pathname="${SCODOC_VAR_DIR}/config/depts/$DEPT".cfg
if [ -e "$cfg_pathname" ]
then
(cd config || terminate "no config directory"; ./delete_dept.sh -n "$DEPT") || terminate "error deleting dept $DEPT"
fi
(cd config || terminate "no config directory"; ./create_dept.sh -n "$DEPT") || terminate "error creating dept $DEPT"
# systemctl start scodoc
fi