From 62b3b2ff297ede7a810741bdd648c9139b2a6eb9 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Mon, 25 Feb 2013 13:03:58 +0100 Subject: [PATCH] create user configuration file, entice user to change it --- atom | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/atom b/atom index 554bb2f..b1aa548 100755 --- a/atom +++ b/atom @@ -4,6 +4,7 @@ # General config errors [10-19] ELOAD=10 EINTERVAL=11 +ENOCFG=19 # Source cofig errors [20-29] # Destination config errors [30-49] EFORMAT=30 @@ -26,6 +27,9 @@ declare -A \ exit $EBASHVERS } +DOCDIR=./doc +exampleconf=$DOCDIR/example.cfg + #parse arguments #parse config getConfigGeneral() { @@ -278,6 +282,23 @@ transcodeLauncher() { } #UI + +if [ ! -f ~/.atom/atom.cfg ] +then + if [ ! -d ~/.atom ] + then + mkdir -p ~/.atom + fi + sed "s/%HOME%/$HOME/" "$exampleconf" ~/.atom/atom.cfg + cat >&2 <<-EOCfgNotice + No configuration file found! + An example file has been created as ~/.atom/atom.cfg. + You should change it to your likings using you favorite editor. + + Bailing out. + EOCfgNotice + exit $ENOCFG +fi getConfig { cat <