Changes: Split script into several different files for easier editting Added build.sh to compile Simple Note System from tree Changed config file to config folder; $HOME/.sns now contains configuration and notes Testing: Script runs and produces help screen; no further testing done.
44 lines
1.1 KiB
Bash
44 lines
1.1 KiB
Bash
#==============================================================================
|
|
# Section: Configuration
|
|
#==============================================================================
|
|
if [ -r $HOME/.sns/sns.conf ]; then
|
|
source $HOME/.sns/sns.conf
|
|
else
|
|
ROOTDIR=$HOME/.sns
|
|
BASEDIR=$ROOTDIR/notes
|
|
EDITOR=vim
|
|
EXT=note
|
|
fi
|
|
|
|
if [ "$ENCRYPTION" == "TRUE" ]; then
|
|
if [ -z "$ENC_KEY" ]; then
|
|
ERR_NO_KEY="TRUE"
|
|
ENCRYPTION="FALSE"
|
|
fi
|
|
command -v openssl >/dev/null 2>&1 || { ERR_NO_SSL="TRUE"; ENCRYPTION="FALSE"; }
|
|
fi
|
|
|
|
if [ "$ENCRYPTION" == "TRUE" ]; then
|
|
PROD_STR="Simple Note System (Encryption Enabled)"
|
|
EXT="$EXT.enc"
|
|
if [ ! -d ~/.sns/tmp ]; then
|
|
mkdir -p ~/.sns/tmp
|
|
fi
|
|
fi
|
|
|
|
echo "$PROD_STR, $VER_STR"
|
|
if [ -n "$ERR_NO_SSL" ]; then
|
|
echo >&2 " Warning: OpenSSL not installed. Encryption disabled."
|
|
fi
|
|
if [ -n "$ERR_NO_KEY" ]; then
|
|
echo " Warning: No encryption key was provided. Encryption disabled."
|
|
fi
|
|
|
|
if [ -n "$ERR_NO_SSL" -o -n "$ERR_NO_KEY" ]; then
|
|
pause
|
|
fi
|
|
|
|
#==============================================================================
|
|
# End Section: Read Configuration
|
|
#==============================================================================
|