Merge pull request #616 from thriqon/package-apt-purge-parameter

Provide `--purge-if-absent` to __package_apt
This commit is contained in:
Darko Poljak 2018-01-31 10:00:19 +01:00 committed by GitHub
commit ed1a53dda2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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