From 161ffa56a72398f7b01ec0dea1877c198d9e8bab Mon Sep 17 00:00:00 2001 From: Charles Herlin Date: Mon, 23 Oct 2017 14:50:11 +0200 Subject: [PATCH] Change src/skel to allow setting CIS_ROOT_DIR in env and not just sourcing /etc/default/cis-hardening. Making the whole lib more versatile. --- src/skel | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/skel b/src/skel index b3b4941..bb5b4e0 100644 --- a/src/skel +++ b/src/skel @@ -27,15 +27,15 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z $CIS_ROOT_DIR ]; then - echo "No CIS_ROOT_DIR variable, aborting" - fi +fi +if [ -z "$CIS_ROOT_DIR" ]; then + echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment." + echo "Cannot source CIS_ROOT_DIR variable, aborting." + exit 128 fi # Main function, will call the proper functions given the configuration (audit, enabled, disabled) -[ -r $CIS_ROOT_DIR/lib/main.sh ] && . $CIS_ROOT_DIR/lib/main.sh +[ -r "$CIS_ROOT_DIR"/lib/main.sh ] && . $CIS_ROOT_DIR/lib/main.sh +