-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Installers are now split apart (setup vs install). rsconf does setup so only need install radiasoft/download@85490d1
- Loading branch information
Showing
2 changed files
with
16 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,33 @@ | ||
#!/bin/bash | ||
_docker_pkg=docker-ce | ||
|
||
docker_install() { | ||
if [[ -e /var/lib/docker ]]; then | ||
# This will happen on dev systems only, but a good check nonetheless | ||
install_err '/var/lib/docker exists. You need to: | ||
systemctl stop docker | ||
systemctl disable docker | ||
rm -rf /var/lib/docker/* | ||
umount /var/lib/docker | ||
rmdir /var/lib/docker | ||
perl -pi -e "s{^/var/lib/docker.*}{}" /etc/fstab | ||
lvremove -f /dev/mapper/docker-vps | ||
Then re-run rsconf. This should only happen in development environments. | ||
' | ||
fi | ||
if rsconf_fedora_release_if 26; then | ||
# https://docs.docker.com/engine/installation/linux/docker-ce/fedora/#set-up-the-repository | ||
dnf -y install dnf-plugins-core | ||
dnf config-manager \ | ||
--add-repo \ | ||
https://download.docker.com/linux/fedora/"$_docker_pkg".repo | ||
else | ||
yum-config-manager \ | ||
--add-repo https://download.docker.com/linux/centos/"$_docker_pkg".repo | ||
yum makecache fast | ||
# yum-plugin-ovl required for overlay2 on centos7 | ||
# https://github.com/docker-library/official-images/issues/1291 | ||
rsconf_yum_install yum-plugin-ovl | ||
fi | ||
rsconf_yum_install "$_docker_pkg" | ||
{% if rsconf_db.channel == "dev" %} | ||
# Give vagrant user access in dev mode only | ||
usermod -aG docker vagrant | ||
{% endif %} | ||
} | ||
|
||
docker_main() { | ||
declare d={{ docker.data_d }}/volumes | ||
if [[ -e $d ]] && type docker >& /dev/null; then | ||
if docker_need_update; then | ||
if docker_up_to_date; then | ||
install_info "$d: exists, docker already installed" | ||
else | ||
# Need to specify cli explicitly or it won't update | ||
install_yum update "$_docker_pkg" "$_docker_pkg"-cli | ||
else | ||
install_info "$d: exists, docker already installed" | ||
fi | ||
else | ||
docker_install | ||
rsconf_radia_run_as_user root redhat-docker-install | ||
fi | ||
if docker_need_update; then | ||
if ! docker_up_to_date; then | ||
install_err "Installed docker=$(docker_version) is < min_software_version={{ docker.min_software_version }} after install." | ||
fi | ||
} | ||
|
||
docker_need_update() { | ||
local v=$(docker_version) | ||
docker_up_to_date() { | ||
declare v=$(docker_version) | ||
if [[ ! $v ]]; then | ||
install_err "docker --version did not output a valid version number" | ||
fi | ||
(( $(docker_version_num "$v" ) < $(docker_version_num '{{ docker.min_software_version }}') )) | ||
printf "%s\n%s\n" '{{ docker.min_software_version }}' "$v" | sort --version-sort --check &> /dev/null | ||
} | ||
|
||
docker_version() { | ||
if [[ $(docker --version) =~ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then | ||
echo "${BASH_REMATCH[1]}" | ||
fi | ||
} | ||
|
||
docker_version_num() { | ||
declare dotted=$1 | ||
printf '%d%06d%06d' ${dotted//./ } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters