Skip to content

Commit

Permalink
Update setup for SSHGATE_EDITOR
Browse files Browse the repository at this point in the history
  • Loading branch information
Tauop committed Feb 16, 2012
1 parent 1d25f23 commit 90c13cd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
22 changes: 16 additions & 6 deletions build-utils/bin/core/setup.func
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ if [ "${__SETUP_FUNC__:-}" != 'Loaded' ]; then
SSHGATE_GATE_ACCOUNT="${SSHGATE_GATE_ACCOUNT:-sshgate}"
SSHGATE_TARGETS_DEFAULT_SSH_LOGIN="${SSHGATE_TARGETS_DEFAULT_SSH_LOGIN:-root}"
SSHGATE_DEFAULT_LANGUAGE="${SSHGATE_DEFAULT_LANGUAGE:-us}"
SSHGATE_EDITOR="${SSHGATE_EDITOR:-vi}"
SSHGATE_EDITOR="${SSHGATE_EDITOR:-${EDITOR}}"
SSHGATE_MAIL_SEND="${SSHGATE_MAIL_SEND:-Y}"
SSHGATE_MAIL_TO="${SSHGATE_MAIL_TO:-you@yourdomain.tld}"
SSHGATE_USERS_MUST_ACCEPT_TOS="${SSHGATE_USERS_MUST_ACCEPT_TOS:-Y}"
Expand Down Expand Up @@ -255,12 +255,22 @@ if [ "${__SETUP_FUNC__:-}" != 'Loaded' ]; then

good='0'
while [ "${good}" = '0' ]; do
private_CONF SSHGATE_EDITOR "Which editor to use [%%%] ?"
which "${SSHGATE_EDITOR}" >/dev/null 2>/dev/null
if [ $? -eq 0 ]; then
good='1'; break;
private_CONF --allow-empty SSHGATE_EDITOR "Which editor to use (empty: use \${EDITOR} environnement variable) [%%%] ?"
if [ -n "${SSHGATE_EDITOR}" ]; then
which "${SSHGATE_EDITOR}" >/dev/null 2>/dev/null
if [ $? -eq 0 ]; then
good='1'; break;
fi
ERROR "Can't find editor '${SSHGATE_EDITOR}'. (Set the full path ?)"
else
if [ -z "${EDITOR}" ]; then
MESSAGE "You don't set an editor for sshGate, and \${EDITOR} isn't set."
ASK --yesno reply "Are you sure to continue [N] ?" 'N'
if [ "${reply}" = 'Y' ]; then
good='1'; break;
fi
fi
fi
ERROR "Can't find editor '${SSHGATE_EDITOR}'. (Set the full path ?)"
done

private_CONF --yesno SSHGATE_MAIL_SEND "Activate mail notification system [%%%] ?"
Expand Down
4 changes: 2 additions & 2 deletions data/sshgate.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ SSHGATE_USE_REMOTE_ADMIN_CLI='Y'
SSHGATE_SUDO_WITH_NOPASSWORD='Y'
SSHGATE_USERS_MUST_ACCEPT_TOS='Y'

# editor to use when editing files
SSHGATE_EDITOR='vim'
# editor to use when editing files. leave it empty to use ${EDITOR}
SSHGATE_EDITOR=''

# default path where files where sent to the target host
SSHGATE_TARGETS_SCP_PATH='~'
Expand Down

0 comments on commit 90c13cd

Please sign in to comment.