-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dpkg-imediff: start a merge editor when dpkg needs resolving a conflict
- Loading branch information
1 parent
4b08f50
commit 4d18c97
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh -eu | ||
# SPDX-License-Identifier: WTFPL | ||
|
||
# When installing packages, dpkg needs to preserve modifications to files in | ||
# /etc, but sometimes a config file was also modified in the package, leading | ||
# to a conflict. dpkg prompts what to do: | ||
# Y: overwrite modifications to /etc, force package content | ||
# N: don't use package content, keep /etc modifications | ||
# Z: start a shell | ||
# imediff is an editor for resolving conflicts. | ||
# So, use `Z` command and just start `dpkg-imediff`. imediff must be installed. | ||
|
||
error () { | ||
echo "error: $1" >&2 | ||
exit 1 | ||
} | ||
|
||
if [ $# -gt 0 ] | ||
then | ||
error "$0 must be called within a dpkg conflict shell, without arguments" | ||
elif [ -z "${DPKG_CONFFILE_OLD-}" ] | ||
then | ||
error "$0 must be called within a dpkg conflict shell" | ||
fi | ||
|
||
imediff -o "$DPKG_CONFFILE_OLD" "$DPKG_CONFFILE_OLD" "$DPKG_CONFFILE_NEW" |