diff options
Diffstat (limited to 'keyringer')
-rwxr-xr-x | keyringer | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -3,21 +3,22 @@ # Keyringer key management system. # # Copyright (C) 2010 Silvio Rhatto - rhatto at riseup.net -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, # or any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # +# Initialize a new keyring function keyringer_init { BASEDIR="$3" URL="$4" @@ -104,6 +105,7 @@ function keyringer_init { fi } +# Action dispatcher function keyringer_dispatch { BASEDIR="`keyringer_config $KEYRING`" @@ -120,7 +122,7 @@ function keyringer_dispatch { # Config NAME="keyringer" -KEYRINGER_VERSION="0.2.9" +KEYRINGER_VERSION="0.3" CONFIG_VERSION="0.1" CONFIG_BASE="$HOME/.$NAME" CONFIG="$CONFIG_BASE/config" @@ -131,10 +133,12 @@ ACTION="$2" # Turn off pathname expansion so expansion can work properly set -f -# Export preferences and version for other scripts +# Export globals for other scripts export PREFERENCES="`dirname $CONFIG`/$KEYRING" export KEYRINGER_VERSION export CONFIG_VERSION +export KEYRING +export CONFIG # Set functions location if [ -e "`dirname $(readlink -f $0)`/lib/$NAME/functions" ]; then @@ -160,12 +164,14 @@ source "$LIB" || exit 1 # Setup main configuration and load preferences keyringer_config_load -if [ -z "$ACTION" ]; then +# Dispatch +if [ -z "$KEYRING" ]; then keyringer_usage exit 1 -fi - -if [ "$ACTION" == "init" ]; then +elif [ -z "$ACTION" ]; then + # Run shell if no action were given + keyringer $KEYRING shell +elif [ "$ACTION" == "init" ]; then keyringer_init $* elif keyringer_has_action "$ACTION"; then keyringer_dispatch $* |