__apt_ppa: /enabled/present/ -e /disabled/absent/

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2012-11-16 14:56:20 +01:00
parent bec3569724
commit e4910933b1
3 changed files with 15 additions and 13 deletions

View File

@ -29,5 +29,5 @@ repo_name="${name#ppa:}"
repo_file_name="$(echo "$repo_name" | sed "s:\/:\-:")-${DISTRIB_CODENAME}.list" repo_file_name="$(echo "$repo_name" | sed "s:\/:\-:")-${DISTRIB_CODENAME}.list"
[ -s "/etc/apt/sources.list.d/${repo_file_name}" ] \ [ -s "/etc/apt/sources.list.d/${repo_file_name}" ] \
&& echo enabled || echo disabled && echo present || echo absent

View File

@ -22,14 +22,16 @@ name="$__object_id"
state_should="$(cat "$__object/parameter/state")" state_should="$(cat "$__object/parameter/state")"
state_is="$(cat "$__object/explorer/state")" state_is="$(cat "$__object/explorer/state")"
if [ "$state_should" != "$state_is" ]; then if [ "$state_should" == "$state_is" ]; then
case "$state_should" in # Nothing to do, move along
enabled) exit 0
echo add-apt-repository \"$name\"
;;
disabled)
echo remove-apt-repository \"$name\"
;;
esac
fi fi
case "$state_should" in
present)
echo add-apt-repository \"$name\"
;;
absent)
echo remove-apt-repository \"$name\"
;;
esac

View File

@ -16,7 +16,7 @@ This cdist type allows manage ubuntu ppa repositories.
REQUIRED PARAMETERS REQUIRED PARAMETERS
------------------- -------------------
state:: state::
The state the ppa should be in, either "enabled" or "disabled". The state the ppa should be in, either "present" or "absent".
OPTIONAL PARAMETERS OPTIONAL PARAMETERS
@ -29,10 +29,10 @@ EXAMPLES
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
# Enable a ppa repository # Enable a ppa repository
__apt_ppa ppa:sans-intern/missing-bits --state enabled __apt_ppa ppa:sans-intern/missing-bits --state present
# Disable a ppa repository # Disable a ppa repository
__apt_ppa ppa:sans-intern/missing-bits --state disabled __apt_ppa ppa:sans-intern/missing-bits --state absent
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------