X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=debian%2Fpreinst;h=06a79170ec4661ad7fc8de8a5312ddbe05b10322;hb=a63cf8f9b3c3fb8450dbc1d3faed62a10c72aecb;hp=848ecfff44f011e24d25289d8f6fae15894e6571;hpb=b285a6913f2b2f80d51d70b57bfe0a659903e2e2;p=grml-etc-core.git diff --git a/debian/preinst b/debian/preinst index 848ecff..06a7917 100755 --- a/debian/preinst +++ b/debian/preinst @@ -4,22 +4,21 @@ # 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: Fre Feb 09 15:24:01 CET 2007 [mika] +# Latest change: Sam Sep 15 10:36:46 CEST 2007 [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".grml-etc-core || true fi - } case "$1" in @@ -29,13 +28,14 @@ case "$1" in # 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 - [ -e "$file".original ] || cp -f "$file" "${file}.tmp.$$" - divert_conffile $file && \ + [ -e "$file".original ] || cp -f "$file" "${file}.tmp.$TMP" 2>/dev/null || /bin/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.$$" ] && mv -f "${file}.tmp.$$" "$file.original" + [ -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 ] && \