diff --git a/main.sh b/main.sh index 1177e50..d012500 100644 --- a/main.sh +++ b/main.sh @@ -6,12 +6,11 @@ echo "Backify is starting, looking for configuration file..." >&2 config='backup.cfg' config_secured='sbackup.cfg' -if [ -f "$config" ] -then - echo "Configuration found." >&2 -else - echo "Configuration not found" >&2 - exit +if [ ! -f "$config" ] + then + echo "Error: Config file not found: $config" >&2 + echo "Please create a config file or specify the location of an existing file." >&2 + exit 1 fi if grep -E -q -v '^#|^[^ ]*=[^;]*' "$config"; then @@ -32,15 +31,18 @@ fi function system { -if [ -f /etc/redhat-release ] -then - system='rhel' -fi - -if [ -f /etc/lsb-release ] -then - system='ubuntu' -fi + if [ -f /etc/redhat-release ] + then + echo "Discovered Red Hat-based OS..." + system='rhel' + elif [ -f /etc/lsb-release ] + then + echo "Discovered Ubuntu-based OS..." + system='ubuntu' + else + echo "Error: Unable to detect OS type." + exit 1 + fi echo "Discovered $system based OS..." >&2 }