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