X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=debian%2Fpreinst;h=64f5164fd91333ab077398221559ce080d08e648;hb=ccbb261ab37df12e5367406c9faa933f726f5443;hp=43ccd683bad8be58eca80e3874a953d89b855818;hpb=d011ac16783081a339a43c5f897f662c7148c076;p=grml-etc-core.git diff --git a/debian/preinst b/debian/preinst index 43ccd68..64f5164 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] +# Latest change: Mit Mär 21 19:03:31 CET 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".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.$$" || /bin/true + 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" # trying to overwrite `/etc/skel/.zshrc', which is also in package zsh # [ -f /etc/skel/.zshrc ] && \