X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=debian%2Fpreinst;h=ec6b7a9a7596c42ac13d5525819ec9ee8340039a;hb=8c10100d37bd17eaf94fb18ccd8e749a1bb0d4d0;hp=43ccd683bad8be58eca80e3874a953d89b855818;hpb=d011ac16783081a339a43c5f897f662c7148c076;p=grml-etc-core.git diff --git a/debian/preinst b/debian/preinst index 43ccd68..ec6b7a9 100755 --- a/debian/preinst +++ b/debian/preinst @@ -4,35 +4,37 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Die Okt 03 20:33:19 CEST 2006 [mika] ################################################################################ set -e # check for files from rm_conffile() in debian/preinst of grml-etc # make sure we don't lose any files... -divert_conffile() { +backup_conffile() { CONFFILE="$1" - if [ -e "$CONFFILE.dpkg-bak" ]; then + if [ -e "$CONFFILE.dpkg-bak" -a -e "$CONFFILE" ]; then cp -f "$CONFFILE" "$CONFFILE".original else - [ -e "$CONFFILE" ] && cp -f "$CONFFILE" "$CONFFILE".grml-etc-core -# [ -e "$CONFFILE" ] && cp -f "$CONFFILE" "$CONFFILE".original + [ -e "$CONFFILE" ] && cp -f "$CONFFILE" "$CONFFILE".grml-etc-core || true fi } case "$1" in install|upgrade|configure) + TMP=$$ # move files from package grml-etc to grml-etc-core, make sure # we don't lose any files... for file in /etc/zsh/zlogin /etc/zsh/zprofile /etc/zsh/zshenv /etc/zsh/zshrc \ /etc/zsh/zlogout /etc/vim/vimrc; do - divert_conffile $file && \ + [ -e "$file".original ] || cp -f "$file" "${file}.tmp.$TMP" 2>/dev/null || true + # [ -e "$file".dpkg-new ] && cp -f "$file".dpkg-new "${file}.tmp.$TMP" + backup_conffile $file && \ [ -f "$file" ] && rm $file && \ dpkg-divert --quiet --add --rename --package grml-etc-core --divert "$file".original $file && \ [ -f "$file".dpkg-bak ] && mv -f "$file".dpkg-bak "$file" [ -f "$file".grml-etc-core ] && mv -f "$file".grml-etc-core "$file" + [ -e "${file}.tmp.$TMP" ] && mv -f "${file}.tmp.$TMP" "$file.original" # trying to overwrite `/etc/skel/.zshrc', which is also in package zsh # [ -f /etc/skel/.zshrc ] && \