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