Author: branden Revision: 1740 Property Name: svn:log New Property Value: Rewrite migration of app-defaults (in libxt6) and xkb (in libx11-6) directories. + Enhance the shell libary with new functions: - Implement check_symlink() and change check_symlinks_and_warn() and check_symlinks_and_bomb() to use it. - Implement make_symlink_sane(). Ensure that the specified symbolic link symlink exists, and points to the specified target. If symlink does not exist, create it and point it at target. If symlink exists but is not a symbolic link, back it up. If symlink exists, is a symbolic link, but points to the wrong location, fix it. If symlink exists, is a symbolic link, and already points to target, do nothing. This function wouldn't be needed if ln had an -I, --idempotent option. - Implement migrate_dir_to_symlink(). Per Debian Policy section 6.5.4, "A directory will never be replaced by a symbolic link to a directory or vice versa; instead, the existing state (symlink or not) will be left alone and dpkg will follow the symlink if there is one." We have to do it ourselves. This function moves the contents of old_location, a directory, into new_location, a directory, then makes old_location a symbolic link to new_location. old_location need not exist, but if it does, it must be a directory (or a symlink to a directory). If it is not, it is backed up. If new_location exists already and is not a directory, it is backed up. + Add config scripts for libx11-6 and libxt6, which detect if /usr/X11R6/lib/X11/{app-defaults,xkb} is a directory but not a symlink, and use debconf to prompt the user (at low priority) whether the directories should be moved. If the user says no, abort the script. If the user says yes (default), start the migration with migrate_dir_to_symlink(). + Update preinst scripts to use debconf as the config scripts do; this is unusual but necessary because if we're going to do the migration we need to start before any other packages (which may use the old directories) are unpacked. + In the preinst scripts, call check_symlink(), and if that fails, call make_symlink_sane(). Stop calling check_symlinks_and_warn(). + Update postinst scripts to indicate that migration is completed. + Update postrm scripts to run migration in reverse if it had been started and the package installation or upgrade is aborted. + We keep shipping /etc/X11/{app-defaults,xkb} symlinks as part of the package payloads, because manipulating them in the preinst isn't enough -- dpkg will remove "disappearing" files from the system *after* the preinst runs but before the postinst does, leaving a window for packages using the legacy paths to unpack to the old location with no symlink to redirect them, which is precisely what we don't want (see section 6.5 of the Debian Policy Manual).
Convert occurrences of test -[ao] to the shell's && and || operators. Update Vim modelines.