__apt_ppa: /enabled/present/ -e /disabled/absent/
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
bec3569724
commit
e4910933b1
3 changed files with 15 additions and 13 deletions
|
@ -29,5 +29,5 @@ repo_name="${name#ppa:}"
|
|||
repo_file_name="$(echo "$repo_name" | sed "s:\/:\-:")-${DISTRIB_CODENAME}.list"
|
||||
|
||||
[ -s "/etc/apt/sources.list.d/${repo_file_name}" ] \
|
||||
&& echo enabled || echo disabled
|
||||
&& echo present || echo absent
|
||||
|
||||
|
|
|
@ -22,14 +22,16 @@ name="$__object_id"
|
|||
state_should="$(cat "$__object/parameter/state")"
|
||||
state_is="$(cat "$__object/explorer/state")"
|
||||
|
||||
if [ "$state_should" != "$state_is" ]; then
|
||||
if [ "$state_should" == "$state_is" ]; then
|
||||
# Nothing to do, move along
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$state_should" in
|
||||
enabled)
|
||||
present)
|
||||
echo add-apt-repository \"$name\"
|
||||
;;
|
||||
disabled)
|
||||
absent)
|
||||
echo remove-apt-repository \"$name\"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ This cdist type allows manage ubuntu ppa repositories.
|
|||
REQUIRED PARAMETERS
|
||||
-------------------
|
||||
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
|
||||
|
@ -29,10 +29,10 @@ EXAMPLES
|
|||
|
||||
--------------------------------------------------------------------------------
|
||||
# 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
|
||||
__apt_ppa ppa:sans-intern/missing-bits --state disabled
|
||||
__apt_ppa ppa:sans-intern/missing-bits --state absent
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue