2017-06-28 11:19:32 +00:00
|
|
|
#!/bin/sh -e
|
2016-12-02 13:34:01 +00:00
|
|
|
#
|
|
|
|
# 2016 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")
|
2016-12-29 13:36:46 +00:00
|
|
|
state=$(cat "$__object/parameter/state")
|
2018-12-13 12:23:49 +00:00
|
|
|
version=$(cat "$__object/parameter/version")
|
2016-12-02 13:34:01 +00:00
|
|
|
|
|
|
|
case "$os" in
|
2016-12-29 13:36:46 +00:00
|
|
|
centos)
|
2018-10-05 10:19:16 +00:00
|
|
|
# shellcheck source=/dev/null
|
2018-10-03 12:32:28 +00:00
|
|
|
if (. "$__global/explorer/os_release" && [ "${VERSION_ID}" = "7" ]); then
|
2018-07-21 12:53:53 +00:00
|
|
|
__yum_repo docker-ce-stable \
|
|
|
|
--name 'Docker CE Stable' \
|
|
|
|
--baseurl "https://download.docker.com/linux/centos/7/\$basearch/stable" \
|
|
|
|
--enabled \
|
|
|
|
--gpgcheck 1 \
|
|
|
|
--gpgkey 'https://download.docker.com/linux/centos/gpg' \
|
2018-10-02 19:44:27 +00:00
|
|
|
--state "${state}"
|
2018-12-13 12:23:49 +00:00
|
|
|
if [ "$version" != "latest" ]; then
|
|
|
|
require="__yum_repo/docker-ce-stable" __package docker-ce --version "${version}" --state "${state}"
|
|
|
|
else
|
|
|
|
require="__yum_repo/docker-ce-stable" __package docker-ce --state "${state}"
|
|
|
|
fi
|
2018-07-21 12:53:53 +00:00
|
|
|
else
|
|
|
|
echo "CentOS version 7 is required!" >&2
|
|
|
|
exit 1
|
2016-12-29 13:36:46 +00:00
|
|
|
fi
|
|
|
|
;;
|
2018-07-21 12:53:53 +00:00
|
|
|
ubuntu|debian)
|
|
|
|
if [ "${state}" = "present" ]; then
|
|
|
|
__package apt-transport-https
|
|
|
|
__package ca-certificates
|
|
|
|
__package gnupg2
|
2016-12-02 13:34:01 +00:00
|
|
|
fi
|
2018-07-21 12:53:53 +00:00
|
|
|
__apt_key_uri docker --name "Docker Release (CE deb) <docker@docker.com>" \
|
2018-10-02 19:44:27 +00:00
|
|
|
--uri "https://download.docker.com/linux/${os}/gpg" --state "${state}"
|
2018-12-13 12:26:40 +00:00
|
|
|
|
|
|
|
require="__apt_key_uri/docker" __apt_source docker \
|
2018-07-21 12:53:53 +00:00
|
|
|
--uri "https://download.docker.com/linux/${os}" \
|
|
|
|
--distribution "$(cat "$__global/explorer/lsb_codename")" \
|
2018-10-02 19:44:27 +00:00
|
|
|
--state "${state}" \
|
2018-07-21 12:53:53 +00:00
|
|
|
--component "stable"
|
2018-12-13 12:23:49 +00:00
|
|
|
if [ "$version" != "latest" ]; then
|
2018-12-13 12:26:40 +00:00
|
|
|
require="__apt_source/docker" __package docker-ce --version "${version}" --state "${state}"
|
2018-12-13 12:23:49 +00:00
|
|
|
else
|
2018-12-13 12:26:40 +00:00
|
|
|
require="__apt_source/docker" __package docker-ce --state "${state}"
|
2018-12-13 12:23:49 +00:00
|
|
|
fi
|
2016-12-02 13:34:01 +00:00
|
|
|
;;
|
2019-08-04 19:23:44 +00:00
|
|
|
devuan)
|
|
|
|
os_version="$(cat "$__global/explorer/os_version")"
|
|
|
|
|
|
|
|
case "$os_version" in
|
|
|
|
ascii)
|
2019-08-04 19:54:13 +00:00
|
|
|
distribution="stretch"
|
2019-08-04 19:23:44 +00:00
|
|
|
;;
|
|
|
|
jessie)
|
|
|
|
distribution="jessie"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Your devuan release ($os_version) is currently not supported by this type (${__type##*/}).">&2
|
|
|
|
echo "Please contribute an implementation for it if you can." >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ "${state}" = "present" ]; then
|
|
|
|
__package apt-transport-https
|
|
|
|
__package ca-certificates
|
|
|
|
__package gnupg2
|
|
|
|
fi
|
|
|
|
__apt_key_uri docker --name "Docker Release (CE deb) <docker@docker.com>" \
|
|
|
|
--uri "https://download.docker.com/linux/${os}/gpg" --state "${state}"
|
|
|
|
|
|
|
|
require="__apt_key_uri/docker" __apt_source docker \
|
|
|
|
--uri "https://download.docker.com/linux/${os}" \
|
|
|
|
--distribution "${distribution}" \
|
|
|
|
--state "${state}" \
|
|
|
|
--component "stable"
|
|
|
|
if [ "$version" != "latest" ]; then
|
|
|
|
require="__apt_source/docker" __package docker-ce --version "${version}" --state "${state}"
|
|
|
|
else
|
|
|
|
require="__apt_source/docker" __package docker-ce --state "${state}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
;;
|
2016-12-02 13:34:01 +00:00
|
|
|
*)
|
|
|
|
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
|
|
|
|
echo "Please contribute an implementation for it if you can." >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|