minor fixes

This commit is contained in:
snaki 2022-07-07 14:13:38 +02:00
parent 3e84ea65e3
commit cd6dfdda40

11
btrbk
View file

@ -1,6 +1,5 @@
#!/bin/bash
source /etc/btrbk.conf
startDate=$(date +%s)
function bkRun {
@ -101,6 +100,7 @@ function getSnap {
function testConf {
source /etc/btrbk.conf
if [ -z ${rDate+x} ]; then
if ! date -d "$rDate" > /dev/null 2>&1; then
echo "date is in wrong format: YYYY-MM-DD"
@ -150,7 +150,7 @@ function echoHelp {
exit 1
}
options=$(getopt -l "backup,force,date:,restore:,full-restore:,help" -o "bfd:r:x:h" -- "$@")
options=$(getopt -l "backup,force,date::,restore::,full-restore::,help" -o "bfd::r::x::h" -- "$@")
eval set -- "$options"
while true; do
@ -161,14 +161,13 @@ while true; do
-r|--restore) restore=1; restoreVol=$2; shift;;
-x|--full-restore) fullRestore=1; restoreDir=$2; shift;;
-h|--help) Help; shift; break;;
--) shift;;
--) shift; echoHelp;;
\?) echo "error"; exit 1;;
*) echoHelp; shift; break;;
esac
shift
done
if [ $fullRestore=1 ]; then
echo $fullRestore
if [ $fullRestore = "1" ]; then
runFullRestore
else
testConf