Browse Source

import __apt_* types from private repo

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
3.0
Steven Armstrong 9 years ago
parent
commit
03ce5a2828
  1. 32
      cdist/conf/type/__apt_key/explorer/state
  2. 42
      cdist/conf/type/__apt_key/gencode-remote
  3. 60
      cdist/conf/type/__apt_key/man.text
  4. 1
      cdist/conf/type/__apt_key/parameter/default/keyserver
  5. 1
      cdist/conf/type/__apt_key/parameter/default/state
  6. 3
      cdist/conf/type/__apt_key/parameter/optional
  7. 32
      cdist/conf/type/__apt_key_uri/explorer/state
  8. 45
      cdist/conf/type/__apt_key_uri/gencode-remote
  9. 51
      cdist/conf/type/__apt_key_uri/man.text
  10. 21
      cdist/conf/type/__apt_key_uri/manifest
  11. 1
      cdist/conf/type/__apt_key_uri/parameter/default/state
  12. 2
      cdist/conf/type/__apt_key_uri/parameter/optional
  13. 1
      cdist/conf/type/__apt_key_uri/parameter/required
  14. 42
      cdist/conf/type/__apt_norecommends/man.text
  15. 40
      cdist/conf/type/__apt_norecommends/manifest
  16. 0
      cdist/conf/type/__apt_norecommends/singleton
  17. 15
      cdist/conf/type/__apt_source/files/source.list.template
  18. 69
      cdist/conf/type/__apt_source/man.text
  19. 58
      cdist/conf/type/__apt_source/manifest
  20. 1
      cdist/conf/type/__apt_source/parameter/boolean
  21. 1
      cdist/conf/type/__apt_source/parameter/default/state
  22. 4
      cdist/conf/type/__apt_source/parameter/optional
  23. 1
      cdist/conf/type/__apt_source/parameter/required

32
cdist/conf/type/__apt_key/explorer/state vendored

@ -0,0 +1,32 @@
#!/bin/sh
#
# 2011-2014 Steven Armstrong (steven-cdist at armstrong.cc)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# Get the current state of the apt key.
#
if [ -f "$__object/parameter/keyid" ]; then
keyid="$(cat "$__object/parameter/keyid")"
else
keyid="$__object_id"
fi
apt-key export "$keyid" | head -n 1 | grep -Fqe "BEGIN PGP PUBLIC KEY BLOCK" \
&& echo present \
|| echo absent

42
cdist/conf/type/__apt_key/gencode-remote vendored

@ -0,0 +1,42 @@
#!/bin/sh
#
# 2011-2014 Steven Armstrong (steven-cdist at armstrong.cc)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
if [ -f "$__object/parameter/keyid" ]; then
keyid="$(cat "$__object/parameter/keyid")"
else
keyid="$__object_id"
fi
state_should="$(cat "$__object/parameter/state")"
state_is="$(cat "$__object/explorer/state")"
if [ "$state_should" = "$state_is" ]; then
# nothing to do
exit 0
fi
case "$state_should" in
present)
keyserver="$(cat "$__object/parameter/keyserver")"
echo "apt-key adv --keyserver \"$keyserver\" --recv-keys \"$keyid\""
;;
absent)
echo "apt-key del \"$keyid\""
;;
esac

60
cdist/conf/type/__apt_key/man.text vendored

@ -0,0 +1,60 @@
cdist-type__apt_key(7)
======================
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__apt_key - manage the list of keys used by apt
DESCRIPTION
-----------
Manages the list of keys used by apt to authenticate packages.
REQUIRED PARAMETERS
-------------------
None.
OPTIONAL PARAMETERS
-------------------
state::
'present' or 'absent'. Defaults to 'present'
keyid::
the id of the key to add. Defaults to __object_id
keyserver::
the keyserver from which to fetch the key. If omitted a sane default is used.
EXAMPLES
--------
--------------------------------------------------------------------------------
# Add Ubuntu Archive Automatic Signing Key
__apt_key 437D05B5
# Same thing
__apt_key 437D05B5 --state present
# Get rid of it
__apt_key 437D05B5 --state absent
# same thing with human readable name and explicit keyid
__apt_key UbuntuArchiveKey --keyid 437D05B5
# same thing with other keyserver
__apt_key UbuntuArchiveKey --keyid 437D05B5 --keyserver keyserver.ubuntu.com
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
COPYING
-------
Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

1
cdist/conf/type/__apt_key/parameter/default/keyserver vendored

@ -0,0 +1 @@
subkeys.pgp.net

1
cdist/conf/type/__apt_key/parameter/default/state vendored

@ -0,0 +1 @@
present

3
cdist/conf/type/__apt_key/parameter/optional vendored

@ -0,0 +1,3 @@
state
keyid
keyserver

32
cdist/conf/type/__apt_key_uri/explorer/state vendored

@ -0,0 +1,32 @@
#!/bin/sh
#
# 2011-2014 Steven Armstrong (steven-cdist at armstrong.cc)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# Get the current state of the apt key.
#
if [ -f "$__object/parameter/name" ]; then
name="$(cat "$__object/parameter/name")"
else
name="$__object_id"
fi
apt-key list | grep -Fqe "$name" \
&& echo present \
|| echo absent

45
cdist/conf/type/__apt_key_uri/gencode-remote vendored

@ -0,0 +1,45 @@
#!/bin/sh
#
# 2011-2014 Steven Armstrong (steven-cdist at armstrong.cc)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
if [ -f "$__object/parameter/name" ]; then
name="$(cat "$__object/parameter/name")"
else
name="$__object_id"
fi
state_should="$(cat "$__object/parameter/state")"
state_is="$(cat "$__object/explorer/state")"
if [ "$state_should" = "$state_is" ]; then
# nothing to do
exit 0
fi
case "$state_should" in
present)
uri="$(cat "$__object/parameter/uri")"
echo "wget -q \"$uri\" -O - | apt-key add -"
;;
absent)
cat << DONE
keyid=\$(apt-key list | grep -B1 "$name" | awk '/pub/ { print \$2 }' | cut -d'/' -f 2)
apt-key del \$keyid
DONE
;;
esac

51
cdist/conf/type/__apt_key_uri/man.text vendored

@ -0,0 +1,51 @@
cdist-type__apt_key_uri(7)
==========================
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__apt_key_uri - add apt key from uri
DESCRIPTION
-----------
Download a key from an uri and add it to the apt keyring.
REQUIRED PARAMETERS
-------------------
uri::
the uri from which to download the key
OPTIONAL PARAMETERS
-------------------
state::
'present' or 'absent', defaults to 'present'
name::
a name for this key, used when testing if it is already installed.
Defaults to __object_id
EXAMPLES
--------
--------------------------------------------------------------------------------
__apt_key_uri rabbitmq \
--name 'RabbitMQ Release Signing Key <info@rabbitmq.com>' \
--uri http://www.rabbitmq.com/rabbitmq-signing-key-public.asc \
--state present
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
COPYING
-------
Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

21
cdist/conf/type/__apt_key_uri/manifest vendored

@ -0,0 +1,21 @@
#!/bin/sh
#
# 2013-2014 Steven Armstrong (steven-cdist at armstrong.cc)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
__package wget

1
cdist/conf/type/__apt_key_uri/parameter/default/state vendored

@ -0,0 +1 @@
present

2
cdist/conf/type/__apt_key_uri/parameter/optional vendored

@ -0,0 +1,2 @@
state
name

1
cdist/conf/type/__apt_key_uri/parameter/required vendored

@ -0,0 +1 @@
uri

42
cdist/conf/type/__apt_norecommends/man.text vendored

@ -0,0 +1,42 @@
cdist-type__apt_norecommends(7)
===============================
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__apt_norecommends - configure apt to not install recommended packages
DESCRIPTION
-----------
Configure apt to not install any recommended or suggested packages.
REQUIRED PARAMETERS
-------------------
None.
OPTIONAL PARAMETERS
-------------------
None.
EXAMPLES
--------
--------------------------------------------------------------------------------
__apt_norecommends
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
COPYING
-------
Copyright \(C) 2014 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

40
cdist/conf/type/__apt_norecommends/manifest vendored

@ -0,0 +1,40 @@
#!/bin/sh
#
# 2014 Steven Armstrong (steven-cdist at armstrong.cc)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
os=$(cat "$__global/explorer/os")
case "$os" in
ubuntu|debian)
# No stinking recommends thank you very much.
# If I want something installed I will do so myself.
__file /etc/apt/apt.conf.d/99-no-recommends \
--owner root --group root --mode 644 \
--source - << DONE
APT::Install-Recommends "0";
APT::Install-Suggests "0";
DONE
;;
*)
echo "This type (${__type##*/}) makes no sense on your operating system ($os)." >&2
echo "If you think otherwise please submit a patch." >&2
exit 1
;;
esac

0
cdist/conf/type/__apt_norecommends/singleton vendored

15
cdist/conf/type/__apt_source/files/source.list.template vendored

@ -0,0 +1,15 @@
#!/bin/sh
set -u
entry="$uri $distribution $component"
cat << DONE
# Created by cdist ${__type##*/}
# Do not change. Changes will be overwritten.
#
# $name
deb ${forcedarch} $entry
DONE
if [ -f "$__object/parameter/include-src" ]; then
echo "deb-src $entry"
fi

69
cdist/conf/type/__apt_source/man.text vendored

@ -0,0 +1,69 @@
cdist-type__apt_source(7)
=========================
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__apt_source - manage apt sources
DESCRIPTION
-----------
This cdist type allows you to manage apt sources.
REQUIRED PARAMETERS
-------------------
uri::
the uri to the apt repository
OPTIONAL PARAMETERS
-------------------
arch::
set this if you need to force and specific arch (ubuntu specific)
state::
'present' or 'absent', defaults to 'present'
distribution::
the distribution codename to use. Defaults to DISTRIB_CODENAME from
the targets /etc/lsb-release
component::
space delimited list of components to enable. Defaults to 'main'.
BOOLEAN PARAMETERS
------------------
include-src::
include deb-src entries
EXAMPLES
--------
--------------------------------------------------------------------------------
__apt_source rabbitmq \
--uri http://www.rabbitmq.com/debian/ \
--distribution testing \
--component main \
--include-src \
--state present
__apt_source canonical_partner \
--uri http://archive.canonical.com/ \
--component partner --state present
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
COPYING
-------
Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

58
cdist/conf/type/__apt_source/manifest vendored

@ -0,0 +1,58 @@
#!/bin/sh
#
# 2011-2013 Steven Armstrong (steven-cdist at armstrong.cc)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
name="$__object_id"
state="$(cat "$__object/parameter/state")"
uri="$(cat "$__object/parameter/uri")"
if [ -f "$__object/parameter/distribution" ]; then
distribution="$(cat "$__object/parameter/distribution")"
else
distribution="$(cat "$__global/explorer/lsb_codename")"
fi
if [ -f "$__object/parameter/component" ]; then
component="$(cat "$__object/parameter/component")"
else
# FIXME: nead to omit this for http://stat.ethz.ch/CRAN//bin/linux/ubuntu, investigate side-effects
#component="main"
component=""
fi
if [ -f "$__object/parameter/arch" ]; then
forcedarch="[arch=$(cat "$__object/parameter/arch")]"
else
forcedarch=""
fi
# export variables for use in template
export name
export uri
export distribution
export component
export forcedarch
# generate file from template
mkdir "$__object/files"
"$__type/files/source.list.template" > "$__object/files/source.list"
__file "/etc/apt/sources.list.d/${name}.list" \
--source "$__object/files/source.list" \
--owner root --group root --mode 0644 \
--state "$state"
require="$__object_name" __apt_update_index

1
cdist/conf/type/__apt_source/parameter/boolean vendored

@ -0,0 +1 @@
include-src

1
cdist/conf/type/__apt_source/parameter/default/state vendored

@ -0,0 +1 @@
present

4
cdist/conf/type/__apt_source/parameter/optional vendored

@ -0,0 +1,4 @@
state
distribution
component
arch

1
cdist/conf/type/__apt_source/parameter/required vendored

@ -0,0 +1 @@
uri
Loading…
Cancel
Save