#! /bin/sh #---------------------------------------------------------------------------- # template-restore-bconf - restore config file from /etc/backup.d # # Copyright (c) 2001-2003 Ansgar Püster # # Creation: 24.12.2003 ap # Last Update: $Id$ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- header() { clrhome colecho "Restore configuration file from $backupd directory" gn echo [ $act_count -lt $fcount ] && colecho "Avaliable backups for package $package:" } footer() { echo echo /var/install/bin/anykey } question() ( echo echo /usr/local/bin/colecho "Enter number to select a file, return to continue, q to quit: \b\b\b\b\b\b\b\b\b\b\c" ) gotoyx () { echo -e "\033[$1;$2H\c"; } echoyx () { echo -e "\033[$1;$2H\c"; shift; shift; echo -e "$*\c"; } overwrite_hint() { /usr/local/bin/colecho "Attention: this will overwrite your current configuration" br b br /usr/local/bin/colecho " file for package $package with an older" br b br /usr/local/bin/colecho " configuation file named" br b br /usr/local/bin/colecho " $restfile" br b br /usr/local/bin/colecho " that was saved in $backupd." br b br } restore_file() { act_count=`expr $fcount + 1` header eval restfile=\${bfile[$fnumber]} echo overwrite_hint if /var/install/bin/ask "Continue"; then echo #echo "TEST cp -p $restfile $configd/$package" cp -p $restfile $configd/$package activate_hint else /usr/local/bin/colecho "Configuration file $configd/$package was not changed." fi } # include function library . /var/install/bin/config_shlib #---------------------------------------------------------------------------- # get package name from filename PACKAGE-restore-bconf # filename=`basename $0` package=`echo $filename | sed "s|-restore-bconf$||"` select_file if [ $selected = 'true' ]; then case $fnumber in [0-9]*) restore_file;; Q|q) ;; esac fi footer