Browse Source

Override $WORKING_DIR variable

First, use value of $GETSSL_HOME variable if exists
Second, use value of $XDG_CONFIG_HOME variable if exists
Third, use $HOME/.config directory if exists
Last, use default directory ~/.getssl as WORKING_DIR

Some Links
FreeDesktop - https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
ArchLinux - https://wiki.archlinux.org/index.php/XDG_Base_Directory_support
pull/294/head
Markus Pesch 9 years ago
committed by Markus Pesch
parent
commit
e8cfc58517
No known key found for this signature in database GPG Key ID: C18FADC12547561
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      getssl

+ 15
- 0
getssl View File

@ -1483,6 +1483,21 @@ if [[ -z "$DOMAIN" ]] && [[ ${_CHECK_ALL} -ne 1 ]]; then
graceful_exit
fi
# if exist the ~/.config directory, use it as parent directory
if [[ -d "${HOME}/.config" ]]; then
WORKING_DIR="${HOME}/.config/getssl"
fi
#if set $XDG_CONFIG_HOME environment variable, use it as parent directory
if [[ ! -z ${XDG_CONFIG_HOME+x} ]]; then
WORKING_DIR="${XDG_CONFIG_HOME}/getssl"
fi
# if set $GETSSL_HOME enviroment variable, use it as parent directory
if [[ ! -z ${GETSSL_HOME+x} ]]; then
WORKING_DIR="${GETSSL_HOME}"
fi
# if the "working directory" doesn't exist, then create it.
if [[ ! -d "$WORKING_DIR" ]]; then
debug "Making working directory - $WORKING_DIR"


Loading…
Cancel
Save