aboutsummaryrefslogtreecommitdiff
path: root/src/bin/systemctl.ver1
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-01-12 18:42:10 -0500
committerB Stack <bgstack15@gmail.com>2020-01-12 18:42:10 -0500
commit595982218707cbbe30e7920d3a6af8f9398e32b0 (patch)
tree0b7071723719121a6cae63e403b05b63e4773101 /src/bin/systemctl.ver1
parentWIP: initial commit, 5% done (diff)
downloadsystemdtl-595982218707cbbe30e7920d3a6af8f9398e32b0.tar.gz
systemdtl-595982218707cbbe30e7920d3a6af8f9398e32b0.tar.bz2
systemdtl-595982218707cbbe30e7920d3a6af8f9398e32b0.zip
WIP: add most parsing
Still need to add the commands to execute the action list.
Diffstat (limited to 'src/bin/systemctl.ver1')
-rwxr-xr-xsrc/bin/systemctl.ver165
1 files changed, 0 insertions, 65 deletions
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
bgstack15