Made configuration directory static
Moved header variables to new file Started sanitizing variable references
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
function init_default_config() {
|
||||
if [ -z "$ROOTDIR" ]; then
|
||||
ROOTDIR=$HOME/.sns
|
||||
fi
|
||||
if [ -z "$BASEDIR" ]; then
|
||||
BASEDIR=$ROOTDIR/notes
|
||||
fi
|
||||
if [ -z "$EXT" ]; then
|
||||
EXT=note
|
||||
fi
|
||||
if [ -z "$EDITOR" ]; then
|
||||
EDITOR=vim
|
||||
fi
|
||||
if [ -z "$ENC_KEY" ]; then
|
||||
ENCRYPTION="FALSE"
|
||||
else
|
||||
ENCRYPTION="TRUE"
|
||||
fi
|
||||
}
|
||||
@@ -13,6 +13,6 @@ function help {
|
||||
echo " -h | --help : Display this message"
|
||||
echo " -p | --print : Print note to console"
|
||||
echo " -l | --list : List all notes in NOTEBOOK"
|
||||
echo " -w | --wconf : Write default configuration to ~/.sns (useful for Encryption)"
|
||||
echo " -w | --wconf : Rewrite default configuration"
|
||||
echo ""
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
function w_conf {
|
||||
cat > $HOME/.sns/sns.conf << EOF
|
||||
if [ ! -r "$ROOTDIR" ]; then mkdir -p $ROOTDIR; fi
|
||||
cat > "$CONFIGURATION" << EOF
|
||||
#==========================================================
|
||||
# Simple Note System Config, v2.0a5
|
||||
# Copyright 2014, Xenese Labs/Sicron-Perion XNF
|
||||
#==========================================================
|
||||
|
||||
#Directory where notes will be stored
|
||||
ROOTDIR=$HOME/.sns
|
||||
BASEDIR=$ROOTDIR/notes
|
||||
|
||||
#File extension to use (for listing notes)
|
||||
EXT=note
|
||||
|
||||
@@ -23,5 +20,5 @@ ENCRYPTION="FALSE"
|
||||
ENC_KEY=""
|
||||
EOF
|
||||
|
||||
chmod 600 $ROOTDIR/sns.conf
|
||||
chmod 600 "$CONFIGURATION"
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#==============================================================================
|
||||
# Section: Configuration
|
||||
#==============================================================================
|
||||
if [ -r $HOME/.sns/sns.conf ]; then
|
||||
source $HOME/.sns/sns.conf
|
||||
if [ -r "$CONFIGURATION" ]; then
|
||||
source "$CONFIGURATION"
|
||||
else
|
||||
init_default_config
|
||||
w_conf
|
||||
source "$CONFIGURATION"
|
||||
fi
|
||||
|
||||
if [ "$ENCRYPTION" == "TRUE" ]; then
|
||||
|
||||
Reference in New Issue
Block a user