Files
vns/src/main/stage1.sns.sh
2016-01-25 23:41:41 -06:00

45 lines
1.2 KiB
Bash

#==============================================================================
# Section: Configuration / Stage 1
#==============================================================================
if [ -r "$CONFIG_FILE" ]; then
source "$CONFIG_FILE"
else
create_sns_root
source "$CONFIG_FILE"
fi
if [ "$ENCRYPTION" == "TRUE" ]; then
if [ -z "$PUBKEY" ]; then
ERR_NO_KEY="TRUE"
ENCRYPTION="FALSE"
fi
command -v gpg >/dev/null 2>&1 ||\
{ ERR_NO_GPG="TRUE"; ENCRYPTION="FALSE"; }
fi
if [ "$ENCRYPTION" == "TRUE" ]; then
PROD_STR="Simple Note System (Encryption Enabled)"
if [ ! -d "$ROOT_DIR"/tmp ]; then
mkdir -p "$ROOT_DIR"/tmp
fi
fi
echo "$PROD_STR, $VER_STR"
if [ -z "$EDITOR" ]; then
>&2 echo "Error no editor specified in environment."
elif [ -n "$ERR_NO_GPG" ]; then
>&2 echo " Error: Encryption was specified, but GPG is not installed."
exit 100
elif [ -n "$ERR_NO_KEY" ]; then
>&2 echo " Error: No GPG recipient was provided in $CONFIG_FILE. "
exit 110
fi
#==============================================================================
# End Section: Configuration / Stage 1
#==============================================================================