From c7deeb7d5078e11436f334b1ea9435e05e4d2c3e Mon Sep 17 00:00:00 2001 From: Yves-Alexis Perez Date: Mon, 1 Dec 2008 15:05:50 +0000 Subject: [PATCH] * debian/preinst: - handle upgrade in various cases: (/etc/splashy/themes symlink or not, and changed or unchanged themes files) * debian/README.Debian: announce the change. * debian/control: - add ${misc:Depends} in Depends: line in case debhelper has something to put there. --- debian/README.Debian | 10 ++++--- debian/changelog | 12 +++++++++ debian/control | 2 +- debian/postinst | 26 ------------------- debian/preinst | 62 ++++++++++++++++++++++++++++++++------------ 5 files changed, 65 insertions(+), 47 deletions(-) diff --git a/debian/README.Debian b/debian/README.Debian index ff52a75..d91f6b3 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -5,7 +5,7 @@ README for desktop-base 1.1. Emblems 1.2. Pixmaps 1.3. Splash and Wallpapers - 1.4. GDM Theme + 1.4. Boot splash 2. Desktop files 3. Changing desktop-base images 4. Window Managers @@ -37,9 +37,13 @@ point to this pair: /usr/share/images/desktop-base/splash/gnome-debian-etch-splash.png /usr/share/images/desktop-base/wallpapers/gnome-debian-etch-wp.png -1.4. GDM Theme +1.4. Boot splash -desktop-base GDM theme will be built as soon as possible. +desktop-base provides a theme for splashy, in +/usr/share/splashy/themes/moreblue-orbit. Previously the theme was in +/etc/splashy but since splashy people move the themes to /usr/share and +replaced the folder by a symlink, we had to follow. If you modified the +theme before, you should be able to find it in /etc/splashy.dpkg-old. 2. Desktop files /usr/share/desktop-base/debian-homepage.desktop diff --git a/debian/changelog b/debian/changelog index ad149d3..d33062b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +desktop-base (5.0.3) UNRELEASED; urgency=low + + * debian/preinst: + - handle upgrade in various cases: (/etc/splashy/themes symlink or not, + and changed or unchanged themes files) + * debian/README.Debian: announce the change. + * debian/control: + - add ${misc:Depends} in Depends: line in case debhelper has something + to put there. + + -- Yves-Alexis Perez Mon, 01 Dec 2008 14:44:30 +0100 + desktop-base (5.0.2) unstable; urgency=low * moreblue-orbit-wallpaper-widescreen.svg updated, fix a “transparent” diff --git a/debian/control b/debian/control index 88dd38e..cf676e0 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,7 @@ Vcs-Svn: svn://svn.debian.org/debian-desktop/packages/trunk/desktop-base Package: desktop-base Architecture: all -Depends: librsvg2-common +Depends: librsvg2-common, ${misc:Depends} Suggests: gnome | kde | xfce4 | wmaker Description: common files for the Debian Desktop This package contains various miscellaneous files which are used by diff --git a/debian/postinst b/debian/postinst index e8e2037..49a6813 100644 --- a/debian/postinst +++ b/debian/postinst @@ -2,32 +2,6 @@ #DEBHELPER# -# Move a conffile without triggering a dpkg question -mv_conffile() { - OLDCONFFILE="$1" - NEWCONFFILE="$2" - if [ -e "$OLDCONFFILE" ]; then - echo "Preserving user changes to $NEWCONFFILE ..." - mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new - mv -f "$OLDCONFFILE" "$NEWCONFFILE" - fi -} - - -case "${1}" in -install|upgrade) - # splashy theme is moved to /usr/share/splashy starting 5.0.2 - if dpkg --compare-versions ${2} le 5.0.2; then - mv_conffile /etc/splashy/themes/moreblue-orbit/background-bw.png \ - /usr/share/splashy/themes/moreblue-orbit/background-bw.png - mv_conffile /etc/splashy/themes/moreblue-orbit/background-color.png \ - /usr/share/splashy/themes/moreblue-orbit/background-color.png - mv_conffile /etc/splashy/themes/moreblue-orbit/theme.xml \ - /usr/share/splashy/themes/moreblue-orbit/theme.xml - mv_conffile /etc/splashy/themes/moreblue-orbit/VeraSans.ttf \ - /usr/share/splashy/themes/moreblue-orbit/VeraSans.ttf - fi -esac if [ "${1}" = "configure" ] && [ "$2" != "" ] ; then diff --git a/debian/preinst b/debian/preinst index e2d8e46..8cb8d83 100644 --- a/debian/preinst +++ b/debian/preinst @@ -17,25 +17,53 @@ if [ "${1}" = "upgrade" ]; then fi fi -# prepare to move splashy themes, moved to /usr/share in 5.0.2 -prep_mv_conffile() { - PKGNAME="$1" - CONFFILE="$2" - if [ -e "$CONFFILE" ]; then - md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`" - old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`" - if [ "$md5sum" = "$old_md5sum" ]; then - rm -f "$CONFFILE" - fi - fi +same_conffile() { + CONFFILE="$1" + if [ -e "$CONFFILE" ]; then + md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`" + old_md5sum="`dpkg-query -W -f='${Conffiles}' desktop-base | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`" + [ "$md5sum" = "$old_md5sum" ] + return + fi + return 1 } + case "$1" in -install|upgrade) - if dpkg --compare-versions "$2" le "5.0.2"; then - prep_mv_conffile desktop-base "/etc/splashy/themes/moreblue-orbit/background-bw.png" - prep_mv_conffile desktop-base "/etc/splashy/themes/moreblue-orbit/background-color.png" - prep_mv_conffile desktop-base "/etc/splashy/themes/moreblue-orbit/VeraSans.ttf" - prep_mv_conffile desktop-base "/etc/splashy/themes/moreblue-orbit/theme.xml" + install|upgrade) + if dpkg --compare-versions "$2" lt "5.0.2"; then + # if the folder is a symlink (installed by splashy), modified files + # need to be copied (from /usr/share/splashy/themes) before beeing + # replaced. If it's not, they need to be moved (from + # /etc/splashy/themes) + # not modified files need to be removed if no symlink, and not + # touched in case of a symlink + THEME_FOLDER="/etc/splashy/themes/moreblue-orbit" + THEME_FOLDER_BAK="/etc/splashy.dpkg-old/themes/moreblue-orbit" + FILES="background-bw.png background-color.png VeraSans.ttf theme.xml" + + if [ -h /etc/splashy/themes ]; then + # symlink + for FILE in ${FILES}; do + if ! same_conffile "${THEME_FOLDER}/${FILE}"; then + # symlink and changed file, copy it in a safe place + [ -d $THEME_FOLDER_BAK ] || mkdir -p $THEME_FOLDER_BAK + cp ${THEME_FOLDER}/${FILE} ${THEME_FOLDER_BAK}/ + fi + done + else + # real folder + for FILE in ${FILES}; do + if ! same_conffile "${THEME_FOLDER}/${FILE}"; then + # real folder and changed file, move it in a safe place + [ -d $THEME_FOLDER_BAK ] || mkdir -p $THEME_FOLDER_BAK + mv ${THEME_FOLDER}/${FILE} ${THEME_FOLDER_BAK}/ + else + # real folder but unchanged file, just remove it + rm ${THEME_FOLDER}/${FILE} + fi + done + fi fi + ;; esac