From 595982218707cbbe30e7920d3a6af8f9398e32b0 Mon Sep 17 00:00:00 2001 From: B Stack Date: Sun, 12 Jan 2020 18:42:10 -0500 Subject: WIP: add most parsing Still need to add the commands to execute the action list. --- src/bin/systemctl.ver1 | 65 -------------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100755 src/bin/systemctl.ver1 (limited to 'src/bin/systemctl.ver1') diff --git a/src/bin/systemctl.ver1 b/src/bin/systemctl.ver1 deleted file mode 100755 index 74f29c4..0000000 --- a/src/bin/systemctl.ver1 +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh -# goal: handle various systemctl commands, particularly for freeipa -# restart X(.service)? -# start -# stop -# enable -# status -# disable -# mask -# unmask -# is-enabled -# list-unit-files --full -# is-active -# reload-or-try-restart X -# condrestart X -# daemon-reload --system -# --now - -# log all parameters to learn usage -logfile=/var/log/systemctl.log -printf "%s\n" "${*}" >> "${logfile}" - -evalparam() { - # call: evalparam "${_x}" "word/single/double" "${_thisparam}" "${_nextparam}" - printf "%s\n" "evalparam $*" - __paramposition="${1}" - __paramflaglevel="${2}" - __param="${3}" - __nextparam="${4}" - case "${__param}" in - "now") - esac -} - -# iterate through all parameters -_param_count="${#}" -_x=0 -while test ${_x} -lt ${_param_count} ; -do - _x=$(( _x + 1 )) - eval _thisparam="\${${_x}}" - test ${_x} -lt ${_param_count} && eval _nextparam="\${$(( _x + 1 ))}" || unset _nextparam - #printf "%s\n" "param ${_x} is \"${_thisparam}\" and next is \"${_nextparam:-UNDEFINED}\"" - case "${_thisparam}" in - --*) - #printf "%s\n" "This is a double-dash! Send the whole thing." - evalparam "${_x}" "double" "${_thisparam##--}" "${_nextparam:-UNDEFINED}" - ;; - -*) - #printf "%s\n" "This is a single dash! Send each char." - _i=2 - while test ${_i} -le ${#_thisparam} ; - do - _char="$( printf '%s' "${_thisparam}" | cut -c ${_i})" - evalparam "${_x}" "single" "${_char}" "${_nextparam:-UNDEFINED}" "$(( _i -1 ))" - _i=$(( _i + 1 )) - done - unset _char - ;; - *) - #printf "%s\n" "No dash. Evaluate this as a word." - evalparam "${_x}" "word" "${_thisparam}" "${_nextparam:-UNDEFINED}" - ;; - esac -done -- cgit