3 # Purpose: preinst script for package grml-etc-core
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 # Latest change: Sam Sep 15 10:36:46 CEST 2007 [mika]
8 ################################################################################
12 # check for files from rm_conffile() in debian/preinst of grml-etc
13 # make sure we don't lose any files...
17 if [ -e "$CONFFILE.dpkg-bak" -a -e "$CONFFILE" ]; then
18 cp -f "$CONFFILE" "$CONFFILE".original
20 [ -e "$CONFFILE" ] && cp -f "$CONFFILE" "$CONFFILE".grml-etc-core || true
25 install|upgrade|configure)
27 # move files from package grml-etc to grml-etc-core, make sure
28 # we don't lose any files...
29 for file in /etc/zsh/zlogin /etc/zsh/zprofile /etc/zsh/zshenv /etc/zsh/zshrc \
30 /etc/zsh/zlogout /etc/vim/vimrc; do
31 [ -e "$file".original ] || cp -f "$file" "${file}.tmp.$TMP" 2>/dev/null || /bin/true
32 # [ -e "$file".dpkg-new ] && cp -f "$file".dpkg-new "${file}.tmp.$TMP"
33 backup_conffile $file && \
34 [ -f "$file" ] && rm $file && \
35 dpkg-divert --quiet --add --rename --package grml-etc-core --divert "$file".original $file && \
36 [ -f "$file".dpkg-bak ] && mv -f "$file".dpkg-bak "$file"
37 [ -f "$file".grml-etc-core ] && mv -f "$file".grml-etc-core "$file"
38 [ -e "${file}.tmp.$TMP" ] && mv -f "${file}.tmp.$TMP" "$file.original"
40 # trying to overwrite `/etc/skel/.zshrc', which is also in package zsh
41 # [ -f /etc/skel/.zshrc ] && \
42 # dpkg-divert --quiet --add --rename --package grml-etc-core --divert /etc/skel/.zshrc.original /etc/skel/.zshrc
45 if dpkg-divert --list grml-etc-core 2>/dev/null | grep -q /etc/skel/.zshrc.original ; then
46 mv -f /etc/skel/.zshrc.original /etc/skel/.zshrc.original.old && \
47 dpkg-divert --remove --rename --package grml-etc-core /etc/skel/.zshrc
52 echo "preinst called with unknown argument $1" >&2
58 ## END OF FILE #################################################################