AtOM/lib/setup/setup
Vincent Riquer e4ca4d63d8 setup:
* user confirmation
	* write config
2013-06-21 09:48:36 +02:00

83 lines
1.6 KiB
Bash

#!/bin/bash
setup() {
cat <<-EOStartConf
You will now be asked (hopefully) simple questions to help you configure AtOM's
behavior.
Completion is available for prompts asking for a paths or filenames.
EOStartConf
setupGeneral
setupSource
setupDestinations
unset expr
writeConfig >"$cffile".tmp
unset \
sourcepath \
skippeddirectories \
maxload \
loadinterval \
ionice \
tempdir \
database \
debug \
destinationchannels \
destinationfat32compat \
destinationcopymime \
destinationformat \
destinationfrequency \
destinationid \
destinationloss \
destinationmaxbps \
destinationnormalize \
destinationpath \
destinationquality \
destinationrename \
destinationnoresample \
destinationrenamepath \
destinationskipmime
declare -A \
destinationchannels \
destinationfat32compat \
destinationcopymime \
destinationformat \
destinationfrequency \
destinationid \
destinationloss \
destinationmaxbps \
destinationnormalize \
destinationpath \
destinationquality \
destinationrename \
destinationnoresample \
destinationrenamepath \
destinationskipmime
oldcffile="$cffile"
cffile="$cffile".tmp
getConfig
{
echo $'Please review your new configuration:\n'
printConfig
}| less -F -e
cffile="$oldcffile"
read -p'Write config file? [y/N] ' do_write
case $do_write in
y)
mv -f "$cffile".tmp "$cffile"
;;
*)
rm "$cffile".tmp
read -p'Re-run (s)etup, (q)uit [s/Q] ' do_rerun
case $do_rerun in
s) setup ;;
*) exit ;;
esac
;;
esac
read -p'Run now? [Y/n] ' do_run
case $do_run in
n) exit ;;
*) ;;
esac
}