Optional updates, execution log, & kill lineage.

Change the update behavior by making it optional to the user.
Changed the piping of logs to null, to execution.log in fluxspace.
Added a helper utility for killing parents and their children!
This commit is contained in:
Matias Barcenas 2020-04-26 02:38:29 -05:00
parent 06cb3c7e3f
commit ee1d46fb3a
1 changed files with 36 additions and 5 deletions

View File

@ -22,7 +22,7 @@ readonly FLUXIONNoiseFloor=-90
readonly FLUXIONNoiseCeiling=-60 readonly FLUXIONNoiseCeiling=-60
readonly FLUXIONVersion=6 readonly FLUXIONVersion=6
readonly FLUXIONRevision=5 readonly FLUXIONRevision=6
# Declare window ration bigger = smaller windows # Declare window ration bigger = smaller windows
FLUXIONWindowRatio=4 FLUXIONWindowRatio=4
@ -176,7 +176,7 @@ if [ $FLUXIONDebug ]; then
readonly FLUXIONOutputDevice="/tmp/fluxion_debug_log" readonly FLUXIONOutputDevice="/tmp/fluxion_debug_log"
readonly FLUXIONHoldXterm="-hold" readonly FLUXIONHoldXterm="-hold"
else else
readonly FLUXIONOutputDevice="/dev/null" readonly FLUXIONOutputDevice="/tmp/execution.log"
readonly FLUXIONHoldXterm="" readonly FLUXIONHoldXterm=""
fi fi
@ -270,10 +270,11 @@ fluxion_startup() {
if installer_utils_check_update "https://$fluxionDomain/$fluxionPath" \ if installer_utils_check_update "https://$fluxionDomain/$fluxionPath" \
"FLUXIONVersion=" "FLUXIONRevision=" \ "FLUXIONVersion=" "FLUXIONRevision=" \
$FLUXIONVersion $FLUXIONRevision; then $FLUXIONVersion $FLUXIONRevision; then
installer_utils_run_update "https://$updateDomain/$updatePath" \ if installer_utils_run_update "https://$updateDomain/$updatePath" \
"FLUXION-V$FLUXIONVersion.$FLUXIONRevision" "$FLUXIONPath" "FLUXION-V$FLUXIONVersion.$FLUXIONRevision" "$FLUXIONPath"; then
fluxion_shutdown fluxion_shutdown
fi fi
fi
echo # Do not remove. echo # Do not remove.
@ -401,6 +402,36 @@ fluxion_shutdown() {
} }
# ============================================================ #
# ================== < Helper Subroutines > ================== #
# ============================================================ #
# The following will kill the parent proces & all its children.
fluxion_kill_lineage() {
if [ ${#@} -lt 1 ]; then return -1; fi
if [ ! -z "$2" ]; then
local -r options=$1
local match=$2
else
local -r options=""
local match=$1
fi
# Check if the match isn't a number, but a regular expression.
# The following might
if ! [[ "$match" =~ ^[0-9]+$ ]]; then
match=$(pgrep -f $match 2> $FLUXIONOutputDevice)
fi
# Check if we've got something to kill, abort otherwise.
if [ -z "$match" ]; then return -2; fi
kill $options $(pgrep -P $match 2> $FLUXIONOutputDevice) \
&> $FLUXIONOutputDevice
kill $options $match &> $FLUXIONOutputDevice
}
# ============================================================ # # ============================================================ #
# ================= < Handler Subroutines > ================== # # ================= < Handler Subroutines > ================== #
# ============================================================ # # ============================================================ #