From: Fiona Ebner <f.ebner@proxmox.com>
To: "Proxmox VE development discussion" <pve-devel@lists.proxmox.com>,
"Fabian Grünbichler" <f.gruenbichler@proxmox.com>
Subject: Re: [pve-devel] [PATCH proxmox-ve] apt hook: disable on remove
Date: Tue, 16 Apr 2024 11:46:04 +0200 [thread overview]
Message-ID: <ed97ad51-73fa-467a-a93e-899ef3da642d@proxmox.com> (raw)
In-Reply-To: <20240307090000.139143-1-f.gruenbichler@proxmox.com>
Am 07.03.24 um 10:00 schrieb Fabian Grünbichler:
> and (re-)enable on install. adapted from apt-listbugs/apt-listchanges, which
> solve the issue of removing (instead of purging) the package keeping the
> conffile while removing the hook binary in the same fashion.
>
Suggested-by: Fiona Ebner <f.ebner@proxmox.com>
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
With my comment below addressed:
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> tested with:
> - touch /please-remove-proxmox-ve
> - remove proxmox-ve (works, hook config moved out of the way)
> - purge proxmox-ve (works, disabled config removed)
> - reinstall proxmox-ve (works, hook config reappears)
>
> - touch /please-remove-proxmox-ve
> - remove (works, hook config moved out of the way)
> - reinstall (works, hook config reappears)
>
> - touch /please-remove-proxmox-ve
> - purge proxmox-ve (works, hook config removed)
> - reinstall (works, hook config reappears)
>
> debian/proxmox-ve.postrm | 33 +++++++++++++++++++++++++++++++++
> debian/proxmox-ve.preinst | 13 +++++++++++++
> 2 files changed, 46 insertions(+)
> create mode 100644 debian/proxmox-ve.postrm
> create mode 100644 debian/proxmox-ve.preinst
>
> diff --git a/debian/proxmox-ve.postrm b/debian/proxmox-ve.postrm
> new file mode 100644
> index 0000000..f3eff33
> --- /dev/null
> +++ b/debian/proxmox-ve.postrm
> @@ -0,0 +1,33 @@
> +#! /bin/sh
> +set -e
> +
> +hook=/etc/apt/apt.conf.d/10pveapthook
> +
> +case "$1" in
> + purge)
> + rm -f $hook.disabled
> + ;;
> +
> + remove)
We should check for existence first. While we don't expect the hook to
be missing, it could be for whatever reason and then both 'apt purge'
and 'apt remove' would fail.
> + mv $hook $hook.disabled
> + ;;
> +
> + abort-install)
> + if test "x$2" != "x" && test -f $hook
> + then
> + mv $hook $hook.disabled
> + fi
> + ;;
> +
> + upgrade|failed-upgrade|abort-upgrade|disappear)
> + ;;
> +
> + *)
> + echo "postrm called with unknown argument \`$1'" >&2
> + exit 1
> +
> +esac
> +
> +#DEBHELPER#
> +
> +exit 0
prev parent reply other threads:[~2024-04-16 9:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 9:00 Fabian Grünbichler
2024-04-16 9:46 ` Fiona Ebner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ed97ad51-73fa-467a-a93e-899ef3da642d@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=f.gruenbichler@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.