Files
vns/src/includes/init_store.sns.sh
Jon-William Lewis 993a6508d3 Code cleanup
2016-02-11 00:22:34 -06:00

35 lines
1.1 KiB
Bash

function init_store {
if [ ! -d "$ROOT_DIR" ]; then mkdir -p "$ROOT_DIR"; WILL_INIT="TRUE"; fi
if [ ! -d "$TMP_DIR" ]; then mkdir -p "$TMP_DIR" ; WILL_INIT="TRUE"; fi
cat > "$CONFIG_FILE" << EOF
# This file contains directives for the Simple Note System.
EXT=note # File extension to use (for listing notes)
#EDITOR= # Preferred Editor:
# If you would like to specify a different editor for
# sns to use, you may do so here.
ENCRYPTION="FALSE" # Main Encryption Toggle:
# WARNING: ANY PREVIOUSLY UNENCRYPTED NOTES WILL BE LOST
# Change this to TRUE to enable encryption.
PUBKEY="" # Public Key
# Encryption is done using GPG. You must enter your
# public key's identifier here.
EOF
chmod 600 "$CONFIG_FILE"
printf " - %s\n" "Rewrote Default Configuration"
if [ "$WILL_INIT" == "TRUE" ]; then
printf " - %s %s\n" "Environment initialized in" "$ROOT_DIR"
else
printf " - %s\n" "Store already initialized."
fi
}