Perform checks when generating configs
This commit is contained in:
parent
8216f7af01
commit
65fe20c41a
26
firestarter
26
firestarter
@ -342,6 +342,11 @@ step_check() {
|
||||
if ! [ -d "$HOME" ] || ! [ -r "$HOME" ]; then
|
||||
err "Inaccessible home directory: \"$HOME\"" 54
|
||||
fi
|
||||
if ! [ -d "$_configdir" ]; then
|
||||
if ! mkdir -p "$_configdir" > /dev/null 2>&1; then
|
||||
err "Failed to create configuration directory: \"$_configdir\"" 52
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
step_preexecute() {
|
||||
@ -422,12 +427,6 @@ step_preexecute() {
|
||||
fi
|
||||
}
|
||||
step_execute() {
|
||||
# Ensure we have a config directory
|
||||
if ! [ -d "$_configdir" ]; then
|
||||
if ! mkdir -p "$_configdir" > /dev/null 2>&1; then
|
||||
err "Failed to create configuration directory: \"$_configdir\"" 52
|
||||
fi
|
||||
fi
|
||||
# Ensure we can log if we have to
|
||||
if [ -n "$FS_NOLOG" ]; then
|
||||
log "No logs will be created per FS_NOLOG"
|
||||
@ -540,8 +539,7 @@ main() {
|
||||
_dryrun=1
|
||||
;;
|
||||
g)
|
||||
step_generate
|
||||
exit $?
|
||||
_generate=1
|
||||
;;
|
||||
h)
|
||||
step_printhelp
|
||||
@ -557,10 +555,14 @@ main() {
|
||||
done
|
||||
[ -n "$_dryrun" ] && log "Performing a dry run"
|
||||
step_check
|
||||
step_preexecute
|
||||
step_execute
|
||||
step_postexecute
|
||||
step_wait
|
||||
if [ -n "$_generate" ]; then
|
||||
step_generate
|
||||
else
|
||||
step_preexecute
|
||||
step_execute
|
||||
step_postexecute
|
||||
step_wait
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user