Provide --purge-if-absent to __package_apt

Configuration files are not purged under Debian when the package
is deinstalled. If this parameter is given, they are deleted upon
package deinstallation.
This commit is contained in:
Jonas Weber 2018-01-30 12:04:19 +01:00
parent 950f00d1a4
commit 3545d0157f
3 changed files with 10 additions and 1 deletions

View file

@ -35,6 +35,11 @@ else
target_release="" target_release=""
fi fi
if [ -f "$__object/parameter/purge-if-absent" ]; then
purgeparam="--purge"
else
purgeparam=""
fi
# FIXME: use grep directly, state is a list, not a line! # FIXME: use grep directly, state is a list, not a line!
@ -57,7 +62,7 @@ case "$state_should" in
echo $aptget install $target_release \"$name\" echo $aptget install $target_release \"$name\"
;; ;;
absent) absent)
echo $aptget remove \"$name\" echo $aptget remove $purgeparam \"$name\"
;; ;;
*) *)
echo "Unknown state: $state_should" >&2 echo "Unknown state: $state_should" >&2

View file

@ -28,6 +28,9 @@ state
target-release target-release
Passed on to apt-get install, see apt-get(8). Passed on to apt-get install, see apt-get(8).
Essentially allows you to retrieve packages from a different release Essentially allows you to retrieve packages from a different release
purge-if-absent
If this parameter is given when state is `absent`, the package is
purged from the system (using `--purge`).
EXAMPLES EXAMPLES
-------- --------

View file

@ -0,0 +1 @@
purge-if-absent