On Thu, Jan 20, 2022 at 10:13:46AM +0800, Paul Wise wrote: > On Mon, 2022-01-17 at 18:38 +0100, наб wrote: > > I don't disagree, but /e/p.d/* can't be symlinks to /u/s. > I don't think that is correct (since systemd symlinks from /etc to > /usr), but if it were then just copying the files would work instead. Those are not in ucf and not meant to be edited; these are.
> > However, please consider new, simplified, patch below, > > applying to current Salsa HEAD > > (4ff688068d05a82039f7cbf88ae99e4d6a4bc327, 0.186-1). > This patch contains unnecessary whitespace changes, please > revert them so that we can see the substantive changes instead. show -w below. наб
From: наб <nabijaczlew...@nabijaczleweli.xyz> Date: Mon Jan 17 18:26:42 2022 +0100 Subject: d/libdebuginfod-common.post{inst,rm}: install conffiles 644, use /bin/sh shebang, remove /e/p.d/dd.*sh if libdebuginfod/usedebiandebuginfod unset --- debian/libdebuginfod-common.postinst | 97 +++++------------------------------- debian/libdebuginfod-common.postrm | 23 ++++----- 2 files changed, 22 insertions(+), 98 deletions(-) diff --git a/debian/libdebuginfod-common.postinst b/debian/libdebuginfod-common.postinst index a482967..93f5fa3 100644 --- a/debian/libdebuginfod-common.postinst +++ b/debian/libdebuginfod-common.postinst @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -e @@ -6,101 +6,28 @@ set -e CONFTEMPLATEPATH="/usr/share/libdebuginfod-common" -# Change a "generic" shell file according to enable/disable -# DEBUGINFOD_URLS according. -# -# - $1 is the shell file name -# -# - $2 is the pattern that we will look for when changing the file. -# This pattern will also be used to perform the substitution. -# -# - $3 is the action we will perform: set the DEBUGINFOD_URLS -# variable, or unset it. -# -# By the end of it, the specified shell file will have an extra line -# which either sets DEBUGINFOD_URLS to have its own value, or sets -# DEBUGINFOD_URLS to be empty (i.e., unsets any value). -change_shell_file () -{ - file="$1" - pattern="$2" - - if [ "$3" = "set" ]; then - finalvar='$DEBUGINFOD_URLS' - else - finalvar="" - fi - - # Check whether the last line of the file already starts with - # ${pattern}. If it does, then we will perform a sed to replace - # it according to the action specified. Otherwise, we will append - # a last line containing the set/unset. - if tail -n1 "$file" | grep -q "^$pattern"; then - sed -i "\$s@${pattern}.*@${pattern}\"${finalvar}\"@" "${file}" - else - echo "${pattern}\"${finalvar}\"" >> "${file}" - fi -} - -# Change the .sh file according to an action specified by $1. It can -# be either "set" (meaning that we will be setting DEBUGINFOD_URLS to -# a valid value), or "unset" (which means that DEBUGINFOD_URLS will be -# empty). -change_sh_file () -{ - shfile="$1" - shaction="$2" - - change_shell_file \ - "$shfile" \ - "export DEBUGINFOD_URLS=" \ - "$shaction" -} - -# Change the .csh file according to an action specified by $1. The -# explanation for change_sh_file also applies here. -change_csh_file () -{ - cshfile="$1" - cshaction="$2" - - change_shell_file \ - "$cshfile" \ - "setenv DEBUGINFOD_URLS " \ - "$cshaction" -} - case "$1" in configure) GOT_DEBCONF_ANSWER=0 - for ext in sh csh; do - if [ -f "${CONFTEMPLATEPATH}"/debuginfod."${ext}" ]; then + [ -f "${CONFTEMPLATEPATH}/debuginfod.${ext}" ] || continue + if [ "$GOT_DEBCONF_ANSWER" -eq 0 ]; then - RET="false" - if grep -qFx "ID=debian" /etc/os-release; then - db_get libdebuginfod/usedebiandebuginfod || RET="false" + grep -qFx "ID=debian" /etc/os-release && db_get libdebuginfod/usedebiandebuginfod || RET="false" + GOT_DEBCONF_ANSWER=1 fi if [ "$RET" = "true" ]; then - action="set" - else - action="unset" + UCF_FORCE_CONFFMISS=1 ucf --three-way --debconf-ok "${CONFTEMPLATEPATH}/debuginfod.${ext}" "/etc/profile.d/debuginfod.${ext}" + if [ "$(stat -c%a "/etc/profile.d/debuginfod.${ext}")" = 600 ]; then + chmod 644 "/etc/profile.d/debuginfod.${ext}" # Correct permissions created by previous versions (<=0.186-1) fi - GOT_DEBCONF_ANSWER=1 - fi - - tmpfile=$(mktemp) - cat "${CONFTEMPLATEPATH}"/debuginfod."${ext}" > "$tmpfile" - change_"${ext}"_file "$tmpfile" "$action" - - ucf --three-way --debconf-ok \ - "$tmpfile" \ - /etc/profile.d/debuginfod."${ext}" - ucfr libdebuginfod-common /etc/profile.d/debuginfod."${ext}" - rm -f "${tmpfile}" + else + rm -f "/etc/profile.d/debuginfod.${ext}" fi + ucfr libdebuginfod-common "/etc/profile.d/debuginfod.${ext}" done + rm -rf "${tmpdir}" ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/debian/libdebuginfod-common.postrm b/debian/libdebuginfod-common.postrm index 62a92ca..250ab6c 100644 --- a/debian/libdebuginfod-common.postrm +++ b/debian/libdebuginfod-common.postrm @@ -1,27 +1,24 @@ -#!/bin/bash +#!/bin/sh set -e case "$1" in purge) for ext in sh csh; do - if [ -f /etc/profile.d/debuginfod."${ext}" ]; then - if which ucf > /dev/null; then - ucf --purge /etc/profile.d/debuginfod."${ext}" - fi - if which ucfr > /dev/null; then - ucfr --purge libdebuginfod-common /etc/profile.d/debuginfod."${ext}" + [ -f "/etc/profile.d/debuginfod.${ext}" ] || continue + + if command -v ucf > /dev/null; then + ucf --purge "/etc/profile.d/debuginfod.${ext}" fi - rm -f /etc/profile.d/debuginfod."${ext}" + if command -v ucfr > /dev/null; then + ucfr --purge libdebuginfod-common "/etc/profile.d/debuginfod.${ext}" fi - done - ;; - remove) - : + rm -f "/etc/profile.d/debuginfod.${ext}" + done ;; - upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; *)
signature.asc
Description: PGP signature