#! /bin/sh #---------------------------------------------------------------------------- # template-restore-dconf - restore config file from /etc/default.d # # Creation: 2003-12-24 ap # Last Update: $Id$ # # Copyright (c) 2001-2003 Ansgar Puester, Ansgar.Puester(at)T-Online(dot)de # Copyright (c) 2008-@@YEAR@@ the eisfair team, team(at)eisfair(dot)org # # 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. #---------------------------------------------------------------------------- # include eislib . /var/install/include/eislib # --------------------------------------------------------------------------- # header(): display header # --------------------------------------------------------------------------- header() { clrhome mecho --info "Restore configuration file from $defaultd" mecho } # --------------------------------------------------------------------------- # footer(): display footer # --------------------------------------------------------------------------- footer() { mecho mecho anykey } # include function library . /var/install/bin/config_shlib # --------------------------------------------------------------------------- # main # --------------------------------------------------------------------------- # get package name from filename PACKAGE-restore-dconf filename=`basename $0` package=`echo $filename | sed "s|-restore-dconf$||"` # if package is template # take package from $PACKAGE [ "$package" = 'template' ] && package="$PACKAGE" #debug echo "+++ TEST filename: $filename" #debug echo " PACKAGE: $PACKAGE" #debug echo " package: $package" #debug read answ < /dev/tty header if [ ! -f $defaultd/$package ] then mecho --error "Error: Configuration file $defaultd/$package does not exist" else mecho "Default configuration file $defaultd/$package found" mecho mecho --warn "Attention: this will overwrite your current configuration" mecho -n --warn " file for package" mecho -n " $package" mecho --warn " with the default" mecho --warn " configuation delivered with the package." mecho _ask_tmpfile=$(mktemp -t XXXXXXXXXXXXX) /var/install/bin/ask 'Continue' >${_ask_tmpfile} rc=${?} read answer < ${_ask_tmpfile} rm -f ${_ask_tmpfile} if [ ${rc} = 255 ] then answer=no fi case "${answer}" in yes) cp -p $defaultd/$package $configd/$package mecho activate_hint ;; *) mecho mecho "Configuration file $configd/$package was not changed." ;; esac fi footer # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------