mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-24 03:01:01 +01:00
Improve bastille.conf handling with user prompt for creation
Replaced ineffective default configuration generation logic with a user-interactive prompt. Users can now choose to create the configuration file with default values if it is missing, ensuring better control and clarity. Removed redundant code from the setup script to streamline execution.
This commit is contained in:
@@ -32,10 +32,20 @@ PATH=${PATH}:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
|
||||
|
||||
. /usr/local/share/bastille/common.sh
|
||||
|
||||
## check for config existance
|
||||
## check for config existence
|
||||
bastille_conf_check() {
|
||||
if [ ! -r "/usr/local/etc/bastille/bastille.conf" ]; then
|
||||
error_exit "Missing Configuration"
|
||||
warn "Configuration file not found. Do yu want to create it with default values? [y/N]"
|
||||
read answer
|
||||
case "${answer}" in
|
||||
[Nn][Oo]|[Nn]|"")
|
||||
error_exit "No configuration file has been generated. Exiting."
|
||||
;;
|
||||
[Yy][Ee][Ss]|[Yy])
|
||||
cp /usr/local/etc/bastille/bastille.conf.sample /usr/local/etc/bastille/bastille.conf
|
||||
info "Configuration file has been generated. Continuing with default values"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user