wpkg --force-overwrite-dir ...

By default the installation process verifies that all the files and directories to be installed from the new package do not already exist on the installation target as a directory or a file respectively (i.e. a file that overwrites a directory or a directory that overwrites a file.) If any one file already exists on the target and would be replaced by a directory, or any directory already exists on the target and would be replaced by a file, then the process fails. This can happen because another package installed a file or sub-directory with the same name in the same directory, or because a program created a file or directory there1.

The --force-overwrite-dir option can be used to still install a package even though some files or directory will be overwritten. This option should just never ever be used. The only reason why it is somewhat supported in wpkg is because it is present in dpkg (the Debian packager) so some people must have thought it could be useful. However, at this time the packager is not capable to properly backing up a destination directory to be replaced by a file so if the process fails, the target ends up in an unknown state.

You may want to limit yourself to using --force-overwrite and not this option. Note that this option does not let you overwrite files by other files, only directory / file combinations.

WARNING

Contrary to dpkg (the Debian packager), wpkg does NOT save any information about files getting overwritten. This means uninstalling either the package that originally installed that file or directory, or the package that overwrote said file or directory results in that file or directory to be removed. It is possible to use the --audit command to check for such problems and re-install a package if necessary. Possible procedure:

wpkg --force-overwrite-dir --install offensive-package.deb
[...conduct your tests...]
wpkg --remove offensive-package
wpkg --audit
wpkg --install offended-package(s).deb

The --audit is not required if you know which packages had files or directory getting overwritten. Note that this procedure does NOT work if the files or directory being overwritten were created by a program.

TO BE NOTED

The use of the --force-all option does not imply the --force-overwrite-dir option. It is simply too dangerous.,

IMPORTANT NOTE

The --no-force-all, --refuse-all, --no-force-overwrite-dir, --refuse-overwrite-dir all cancel this feature whatever the position of the different options on the command line.

 
  • 1. At this point wpkg does not make any difference between either case. Later it is expected that wpkg will only be able to overwrite files and directories that were installed by other packages, but never files or directories that were created in some other way.