create user configuration file, entice user to change it

This commit is contained in:
Vincent Riquer 2013-02-25 13:03:58 +01:00
parent 3d9786cc6c
commit 62b3b2ff29

21
atom
View File

@ -4,6 +4,7 @@
# General config errors [10-19] # General config errors [10-19]
ELOAD=10 ELOAD=10
EINTERVAL=11 EINTERVAL=11
ENOCFG=19
# Source cofig errors [20-29] # Source cofig errors [20-29]
# Destination config errors [30-49] # Destination config errors [30-49]
EFORMAT=30 EFORMAT=30
@ -26,6 +27,9 @@ declare -A \
exit $EBASHVERS exit $EBASHVERS
} }
DOCDIR=./doc
exampleconf=$DOCDIR/example.cfg
#parse arguments #parse arguments
#parse config #parse config
getConfigGeneral() { getConfigGeneral() {
@ -278,6 +282,23 @@ transcodeLauncher() {
} }
#UI #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 getConfig
{ {
cat <<EOF cat <<EOF