Split the execute function apart

This commit is contained in:
Salt 2020-10-04 07:36:32 -05:00
parent ba11289f23
commit 5a2a34ccd2

View File

@ -301,6 +301,12 @@ step_preexecute() {
[ -n "$_optdryrun" ] && return 0 [ -n "$_optdryrun" ] && return 0
# Execute a user rc if it exists # Execute a user rc if it exists
[ -r "$HOME/.firestarterrc" ] && . "$HOME/.firestarterrc" [ -r "$HOME/.firestarterrc" ] && . "$HOME/.firestarterrc"
# Ensure we have a log directory
if ! [ -d "$_optlogdir" ]; then
if ! mkdir -p "$_optlogdir" >/dev/null 2>&1; then
error "Failed to create log directory: \"$_optlogdir\"" 53
fi
fi
[ -n "$FIRESTARTER" ] && [ "$FIRESTARTER_DISPLAY" == "$DISPLAY" ] && error "Firestarter is already running on $DISPLAY: $FIRESTARTER" 55 [ -n "$FIRESTARTER" ] && [ "$FIRESTARTER_DISPLAY" == "$DISPLAY" ] && error "Firestarter is already running on $DISPLAY: $FIRESTARTER" 55
export FIRESTARTER="$BASHPID" export FIRESTARTER="$BASHPID"
export FIRESTARTER_DISPLAY="$DISPLAY" export FIRESTARTER_DISPLAY="$DISPLAY"
@ -400,22 +406,6 @@ step_preexecute() {
xset s off -dpms xset s off -dpms
fi fi
} }
step_execute() {
# Parse out our defaults lists and execute their targets
if ! [ -d "$_optlogdir" ]; then
if ! mkdir -p "$_optlogdir" >/dev/null 2>&1; then
error "Failed to create log directory: \"$_optlogdir\"" 53
fi
fi
for file in "$_optconfigdir"/*; do
if ! [ -e "$file" ]; then
error "No configuration files found" 70
fi
# Skip our logs directory
[ "$_optlogdir" == "$file" ] && continue
fsexec "$file"
done
}
step_postexecute() { step_postexecute() {
# Wait for the WM to initialize, if one was found and we have the tools # Wait for the WM to initialize, if one was found and we have the tools
if [ -z "$FS_NOWAITWM" ] && gettarget "$_optconfigdir/wm" && has xprop grep; then if [ -z "$FS_NOWAITWM" ] && gettarget "$_optconfigdir/wm" && has xprop grep; then
@ -525,7 +515,14 @@ firestart() {
init) init)
[ -n "$_optdryrun" ] && log "Performing a dry run" [ -n "$_optdryrun" ] && log "Performing a dry run"
step_preexecute step_preexecute
step_execute for file in "$_optconfigdir"/*; do
if ! [ -e "$file" ]; then
error "No configuration files found" 70
fi
# Skip our logs directory
[ "$_optlogdir" == "$file" ] && continue
fsexec "$file"
done
step_wait step_wait
step_logout step_logout
;; ;;