Size: 1255
Comment:
|
Size: 1727
Comment: Link actual diff instead of initial NMU. Removed a redundant and often down URL.
|
Deletions are marked like this. | Additions are marked like this. |
Line 5: | Line 5: |
[[DebianBug:685653|Here]] is a possible solution, creating the symbolic link during migration in a postinst script. | If you want to replace a directory with a symlink, you may let a preinst script remove the directory before dpkg creates the symbolic link. Example from [[http://anonscm.debian.org/gitweb/?p=collab-maint/mlterm.git;a=commitdiff;h=732766172c77c36bf03c3281065f6eea51c60451|the mlterm package]]: {{{#!highlight sh #!/bin/sh set -e case "$1" in install|upgrade) # dpkg does not replace directories by symlinks or vice versa. if dpkg --compare-versions "$2" lt "3.1.2-1.1" ; then rm -rf /usr/share/doc/mlterm-im-ibus || true fi ;; abort-upgrade) ;; *) echo "preinst called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0 }}} |
Line 8: | Line 32: |
Symbolic links created by any previous version must then be removed by a preinst script, as done [[http://green.ada-france.org:8081/revision/diff/0665ae79df582178a7337c7df925b12ac907fd63/with/1229410e797d7fea06b73639a64da3b54cde2b23|here]]. | Symbolic links created by any previous version must then be removed by a preinst script. |
This page is meant to describe how to address the problem "missing copyright file" as meant here. The cause is that dpkg refuses to replace a directory with a symlink or vice versa (this behaviour is wanted for unrelated reasons).
If you want to replace a directory with a symlink, you may let a preinst script remove the directory before dpkg creates the symbolic link. Example from the mlterm package:
1 #!/bin/sh
2 set -e
3
4 case "$1" in
5 install|upgrade)
6 # dpkg does not replace directories by symlinks or vice versa.
7 if dpkg --compare-versions "$2" lt "3.1.2-1.1" ; then
8 rm -rf /usr/share/doc/mlterm-im-ibus || true
9 fi
10 ;;
11 abort-upgrade)
12 ;;
13 *)
14 echo "preinst called with unknown argument \`$1'" >&2
15 exit 1
16 ;;
17 esac
18
19 #DEBHELPER#
20
21 exit 0
The other obvious solution is not to use symlinks at all. Symbolic links created by any previous version must then be removed by a preinst script. In case you did replace a symlink with a directory in version 1, but are adding the preinst script a posteriori in version 3, a system with version 2 may still contain a symlink (because dpkg did ignore your changes in a normal upgrade path) or not (because the user did try version 3 then downgrade). You should then remove any existing symlink, whatever the upgraded version, as done here.