projects
/
monkeysphere.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make sure that the FreeBSD package is using GNU-style getopt calls.
[monkeysphere.git]
/
src
/
monkeysphere
diff --git
a/src/monkeysphere
b/src/monkeysphere
index b0003fc3c71c137fd4556c97bc475ff57aa50437..089c06e6e8e59ac2e72e7df9e6613b4a0e53490e 100755
(executable)
--- a/
src/monkeysphere
+++ b/
src/monkeysphere
@@
-1,4
+1,4
@@
-#!/
bin/
bash
+#!/
usr/bin/env
bash
# monkeysphere: MonkeySphere client tool
#
# monkeysphere: MonkeySphere client tool
#
@@
-17,7
+17,7
@@
SHARE=${MONKEYSPHERE_SHARE:-"/usr/share/monkeysphere"}
export SHARE
. "${SHARE}/common" || exit 1
export SHARE
. "${SHARE}/common" || exit 1
-#
date in UTF
format if needed
+#
UTC date in ISO 8601
format if needed
DATE=$(date -u '+%FT%T')
# unset some environment variables that could screw things up
DATE=$(date -u '+%FT%T')
# unset some environment variables that could screw things up
@@
-63,7
+63,7
@@
gen_subkey(){
keyExpire=
# get options
keyExpire=
# get options
- TEMP=$(
getopt -o l:e: -l length:,expire: -n "$PGRM" -- "$@")
+ TEMP=$(
PATH="/usr/local/bin:$PATH" getopt -o l:e: -l length:,expire: -n "$PGRM" -- "$@") || failure "getopt failed! Does your getopt support GNU-style long options?"
if [ $? != 0 ] ; then
exit 1
if [ $? != 0 ] ; then
exit 1
@@
-93,7
+93,7
@@
gen_subkey(){
if [ -z "$1" ] ; then
# find all secret keys
if [ -z "$1" ] ; then
# find all secret keys
- keyID=$(gpg --with-colons --list-secret-keys | grep ^sec | cut -f5 -d:)
+ keyID=$(gpg --with-colons --list-secret-keys | grep ^sec | cut -f5 -d:
| sort -u
)
# if multiple sec keys exist, fail
if (( $(echo "$keyID" | wc -l) > 1 )) ; then
echo "Multiple secret keys found:"
# if multiple sec keys exist, fail
if (( $(echo "$keyID" | wc -l) > 1 )) ; then
echo "Multiple secret keys found:"
@@
-115,7
+115,7
@@
key before joining the monkeysphere. You can do this with:
# fail if multiple sec lines are returned, which means the id
# given is not unique
# fail if multiple sec lines are returned, which means the id
# given is not unique
- if [ $(echo "$gpgOut" | grep
'^sec:' | wc -l
) -gt '1' ] ; then
+ if [ $(echo "$gpgOut" | grep
-c '^sec:'
) -gt '1' ] ; then
failure "Key ID '$keyID' is not unique."
fi
failure "Key ID '$keyID' is not unique."
fi
@@
-146,8
+146,8
@@
save
EOF
)
EOF
)
- log
info
"generating subkey..."
- fifoDir=$(mktemp -d)
+ log
verbose
"generating subkey..."
+ fifoDir=$(mktemp -d
${TMPDIR:-/tmp}/tmp.XXXXXXXXXX
)
(umask 077 && mkfifo "$fifoDir/pass")
echo "$editCommands" | gpg --passphrase-fd 3 3< "$fifoDir/pass" --expert --command-fd 0 --edit-key "$keyID" &
(umask 077 && mkfifo "$fifoDir/pass")
echo "$editCommands" | gpg --passphrase-fd 3 3< "$fifoDir/pass" --expert --command-fd 0 --edit-key "$keyID" &
@@
-155,7
+155,7
@@
EOF
rm -rf "$fifoDir"
wait
rm -rf "$fifoDir"
wait
- log
info
"done."
+ log
verbose
"done."
}
function subkey_to_ssh_agent() {
}
function subkey_to_ssh_agent() {
@@
-210,7
+210,7
@@
You might want to run 'gpg --gen-key'."
You might want to 'monkeysphere gen-subkey'"
fi
You might want to 'monkeysphere gen-subkey'"
fi
- workingdir=$(mktemp -d)
+ workingdir=$(mktemp -d
${TMPDIR:-/tmp}/tmp.XXXXXXXXXX
)
umask 077
mkfifo "$workingdir/passphrase"
keysuccess=1
umask 077
mkfifo "$workingdir/passphrase"
keysuccess=1
@@
-273,7
+273,7
@@
unset AUTHORIZED_KEYS
[ -r "${ETC}/monkeysphere.conf" ] && . "${ETC}/monkeysphere.conf"
# set monkeysphere home directory
[ -r "${ETC}/monkeysphere.conf" ] && . "${ETC}/monkeysphere.conf"
# set monkeysphere home directory
-MONKEYSPHERE_HOME=${MONKEYSPHERE_HOME:="${HOME}/.
config/
monkeysphere"}
+MONKEYSPHERE_HOME=${MONKEYSPHERE_HOME:="${HOME}/.monkeysphere"}
mkdir -p -m 0700 "$MONKEYSPHERE_HOME"
# load local config
mkdir -p -m 0700 "$MONKEYSPHERE_HOME"
# load local config