~sourcemage/sorcery

bd9e97e075b8875b3306d38fd1d5e549da6f969f — Ismael Luceno 2 months ago c0fc1f2
Implement support for external commands

Executable binaries added to /usr/lib/sorcery/cmd/ will be used as
sub-commands for Sorcery.

The sub-commands must implement the --help argument.
2 files changed, 13 insertions(+), 6 deletions(-)

M install
M usr/sbin/sorcery
M install => install +1 -1
@@ 27,7 27,7 @@ echo /etc/sorcery/install.log > $SORCERY_INSTALL_LOG

echo "Installing scripts and libraries"
# Install the executables
install__find_non_volatile etc usr/sbin var/lib |
install__find_non_volatile etc usr/sbin var/lib usr/lib |
while read src; do
  dst="$INSTALL_ROOT/$src" &&
  install -o 0 -g 0 -m 755 -p -D "$src" "$dst" &&

M usr/sbin/sorcery => usr/sbin/sorcery +12 -5
@@ 32,6 32,8 @@ Usage:          sorcery [parameters]

Optional Parameters:

-v  | --version         Print the sorcery version

-h  |  --help  |  help  Display this help screen

-s  |  system-update    Perform a system update (updates sorcery, grimoire,


@@ 80,13 82,11 @@ default add spell PROVIDER on/off       "Spell" is the provider for

default remove [spell|""] [spell|PROVIDER|""] Remove entry from defaults
default search [spell|""] [spell|PROVIDER|""] [on|off] Search defaults

-v  | --version                 Print the sorcery version

EOF

  exit 1
#' <-- fix for syntax highlighting in nedit
  find /usr/lib/sorcery/cmd -mindepth 1 -maxdepth 1 -perm /333 -type f \
    -exec {} --help \;
  exit 1
}

mirror_list() {


@@ 1996,6 1996,13 @@ main() {

}

# Externally-implemented subcommands take priority
if [ -f /usr/lib/sorcery/cmd/"$1" ]; then
  cmd="$1"
  shift
  exec /usr/lib/sorcery/cmd/"$cmd" "$@"
fi

. /etc/sorcery/config
verify_parameters "$@"