#!/bin/bash -e # Source debconf library . /usr/share/debconf/confmodule # This conf script is capable of backing up #db_version 2.0 #db_capb backup #db_metaget debconf/priority value #CONFPRIO=$RET # Handle with debconf or not? db_input medium boxbackup-client/debconf || true db_go db_get boxbackup-client/debconf if [ "$RET" = "false" ]; then exit 0 fi # Backup mode db_get boxbackup-client/backupMode OLDMODE=$RET db_input medium boxbackup-client/backupMode || true db_go # accountNumber ANOK=0 while [ $ANOK = 0 ]; do db_input critical boxbackup-client/accountNumber || true db_go db_get boxbackup-client/accountNumber if [ -z `echo $RET | sed 's/[[:xdigit:]]//g'` ]; then ANOK=1 fi if [ $ANOK = 0 ]; then db_input critical boxbackup-client/incorrectAccountNumber || true db_go fi done # backupServer db_input critical boxbackup-client/backupServer || true db_go # backupDirs DIRSOK=0 while [ $DIRSOK = 0 ]; do db_input critical boxbackup-client/backupDirs || true db_go db_get boxbackup-client/backupDirs if [ ! -z "$RET" ]; then DIRSOK=1 for dir in $RET; do if [ ! -z `echo $dir | sed 's/^[[:space:]]*\/[[:alnum:]\.\_-]*\/*\([[:alnum:]\.\_-]*\/*\)*[[:space:]]*$//g'` ]; then DIRSOK=0; fi done fi if [ $DIRSOK = 0 ]; then db_input critical boxbackup-client/incorrectDirectories || true db_go fi done # UpdateStoreInterval MinimumFileAge MaxUploadWait #db_get boxbackup-client/backupMode # This is a way to get back to the default values when switching the backup mode #if [ ! -z $OLDMODE ]; then # if [ $OLDMODE != $RET ]; then # db_set boxbackup-client/UpdateStoreInterval "3600" # db_set boxbackup-client/MinimumFileAge "21600" # db_set boxbackup-client/MaxUploadWait "86400" # fi #fi db_get boxbackup-client/backupMode if [ "$RET" = "lazy" ]; then for param in UpdateStoreInterval MinimumFileAge MaxUploadWait; do NUMOK=0 while [ $NUMOK = 0 ]; do db_input medium boxbackup-client/$param || true db_go db_get boxbackup-client/$param if [ -z `echo $RET | sed 's/[[:digit:]]//g'` ]; then NUMOK=1 fi if [ $NUMOK = 0 ]; then db_input critical boxbackup-client/IncorrectNumber || true db_go fi done done fi # NotifyMail db_input medium boxbackup-client/notifyMail || true db_go # x509 and private key db_input medium boxbackup-client/generateCertificate || true db_go exit 0