123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #!/bin/bash
-
- . <(ffoom init)
-
- mkinipath() {
- local userd="__SATURNIN_CONFIG_USER__/ini.d"
- local user="__SATURNIN_CONFIG_USER__"
- local lcal="__SATURNIN_CONFIG_LOCAL__"
- local distd="__SATURNIN_SHARE__/ini.d"
- test -d "$userd" && find "$userd" -mindepth 1 -maxdepth 1 -type d
- echo "$user"
- echo "$lcal"
- test -d "$distd" && find "$distd" -mindepth 1 -maxdepth 1 -type d
- }
-
- export FFOO_PATH="__SATURNIN_SHARE__/ffoo"
- SATURNIN_LIBEXEC="__SATURNIN_LIBEXEC__"
- export FFOO_CONFIG_PATH=$(mkinipath | tr '\n' :)
- export FFOO_CONFIG_SUFFIX=".ini"
- export SATURNIN_VERSION="__VERSION__"
-
- ffoo import exit
- ffoo import core
-
- usage() {
- usage_is "[-d|-v] command [args...]" \
- "help"
- }
-
- print_help() {
- echo "valid commands:"
- echo ""
- ls "$SATURNIN_LIBEXEC" \
- | sed -e 's/saturnin-/ /'
- }
-
- version_info() {
- echo "$(basename $0) (Smart and ready desktop helper) $SATURNIN_VERSION"
- exit $FFOO_EXIT_OK
- }
-
- while true; do case $1 in
- -d|--debug) export FFOO_DEBUG=true; shift ;;
- -v|--verbose) export FFOO_VERBOSE=true; shift ;;
- --version) version_info ;;
- -*) usage; ;;
- --*) usage; ;;
- --) shift; break ;;
- "") usage; ;;
- *) break; ;;
- esac done
-
- debug -v FFOO_PATH SATURNIN_LIBEXEC FFOO_CONFIG_PATH
- debug "\$@=$@"
-
- scmd=$1
- shift
-
- case $scmd in
- help) print_help; exit $FFOO_EXIT_OK ;;
- *)
- lexpath="$SATURNIN_LIBEXEC/saturnin-$scmd"
- debug -v lexpath
- debug "\$@='$@'"
- test -x "$lexpath" && exec "$lexpath" "$@"
- warn "invalid sub-command: $scmd"
- print_help; exit $FFOO_EXIT_USAGE
- ;;
- esac
|