commit: 887fce6e46755741db85dc1e419f57ee03b69740 Author: benaryorg <binary <AT> benary <DOT> org> AuthorDate: Thu Oct 30 12:08:24 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Tue Dec 16 03:15:02 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=887fce6e
etc-update: Add Debian support Technically this also adds Ubuntu support but I have not tested that one at all. Using this on Debian works as expected given the code is basically copied over from the *rpm* section with suffixes changed. At time of writing it does not seem like Debian has any tool similar to this despite having feature requests for something similar from at least 2001. Signed-off-by: benaryorg <binary <AT> benary.org> Part-of: https://github.com/gentoo/portage/pull/1494 Closes: https://github.com/gentoo/portage/pull/1494 Signed-off-by: Sam James <sam <AT> gentoo.org> bin/etc-update | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bin/etc-update b/bin/etc-update index e3bc3da251..a25457cfab 100755 --- a/bin/etc-update +++ b/bin/etc-update @@ -44,6 +44,7 @@ else case ${OS_RELEASE_POSSIBLE_IDS} in *:suse:*|*:opensuse:*|*:opensuse-tumbleweed:*) OS_FAMILY='rpm';; *:fedora:*|*:rhel:*) OS_FAMILY='rpm';; + *:debian:*|*:ubuntu:*) OS_FAMILY='dpkg';; *:arch:*) OS_FAMILY='arch' NEW_EXT='pacnew';; *) OS_FAMILY='gentoo';; esac @@ -89,6 +90,20 @@ elif [[ ${OS_FAMILY} == 'rpm' ]]; then get_live_file() { printf -- '%s\n' "${cfg_file}" |sed -e 's/\.rpmsave$//' -e 's/\.rpmnew$//' -e 's/\.rpmorig$//' } +# In dpkg we have dpkg-old, dpkg-dist, dpkg-new. +elif [[ ${OS_FAMILY} == 'dpkg' ]]; then + get_basename() { + printf -- '%s\n' "${1}" |sed -e 's/\.dpkg-old$//' -e 's/\.dpkg-new$//' -e 's/\.dpkg-dist$//' + } + get_basename_find_opt() { + printf -- '%s\n' "${1}.dpkg-???*" + } + get_scan_regexp() { + echo "s:\(^.*/\)\(.*\)\(\.\(dpkg-old|dpkg-new|dpkg-dist\)\):\1\2\3$b\1$b\3$b\2:" + } + get_live_file() { + printf -- '%s\n' "${cfg_file}" |sed -e 's/\.dpkg-old$//' -e 's/\.dpkg-new$//' -e 's/\.dpkg-dist$//' + } fi cmd_var_is_valid() { @@ -790,6 +805,12 @@ if [[ ${OS_FAMILY} == 'rpm' ]]; then CONFIG_PROTECT='/etc /usr/share' CONFIG_PROTECT_MASK='' [[ -f /etc/sysconfig/etc-update ]] && . /etc/sysconfig/etc-update +elif [[ ${OS_FAMILY} == 'dpkg' ]]; then + PORTAGE_CONFIGROOT='/' + PORTAGE_TMPDIR='/tmp' + CONFIG_PROTECT='/etc /usr/share' + CONFIG_PROTECT_MASK='' + [[ -f /etc/default/etc-update ]] && . /etc/default/etc-update elif [[ ${OS_FAMILY} == 'arch' ]]; then PORTAGE_CONFIGROOT='/' PORTAGE_TMPDIR='/tmp'
