env-docker/bin/install.sh
Chad 8602f7ada2
Fix Directory Hardcodes, Documentation Improvements (#10)
* Improve the main crontab example.

* Remove /opt/Docker hardcodes.

* Add periods.

* Improve readability.

* Begin removing hardcoded path from the bin files.

* Update main README to no longer enforce hardcoded path. Other improvements.

* Add the load folder with a README.

* Add load folder and its README.

* Improve reverse proxy text files.

* Switch to tabs.

* Update all scripts for tabs, DOCKER_HOME, and comments.

* Let users know the directory choice is optional.

* Fix environment file.

* Add more details for the reverse proxy load balancing.

* Don't actually listen for postgres.

* Fix comments on source file.

* Be more explicit on the pathing.
2023-07-23 14:51:48 -07:00

68 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# 2022-08-05 Hyperling
# Install docker from official repository. Currently only supports apt.
# Original comands came from here: https://docs.docker.com/engine/install/debian/
# usage: install.sh
## Setup ##
DIR="`dirname $0`"
PROG=`basename $0`
if [[ $DIR == *"."* ]]; then
DIR="`pwd`"
fi
if [[ -z $DOCKER_HOME ]]; then
DOCKER_HOME="$DIR/.."
fi
os=`grep ^'NAME=' /etc/os-release`
pkgmgr=""
## Validations ##
if [[ "$os" == *"Debian"* ]]; then
repo="debian"
pkgmgr="apt"
elif [[ "$os" == *"Ubuntu"* ]]; then
repo="ubuntu"
pkgmgr="apt"
elif [[ $os == "Arch Linux" ]]; then
pkgmgr="pacman"
else
echo "Distribution not yet supported." &&
exit 1
fi
echo "os=$os"
echo "repo=$repo"
echo "pkgmgr=$pkgmgr"
## Main ##
if [[ "$pkgmgr" == "apt" ]]; then
apt purge docker docker-engine docker.io containerd runc podman-docker
apt update &&
apt install -y ca-certificates curl gnupg lsb-release &&
mkdir -p /etc/apt/keyrings &&
curl -fsSL https://download.docker.com/linux/$repo/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg &&
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$repo \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null &&
apt update &&
apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin &&
echo "Success!" &&
exit 0
elif [[ $pkgmgr == "pacman" ]]; then
pacman -Rcns --noconfirm *docker*
pacman -Sy --noconfirm docker docker-compose &&
echo "Success!" &&
exit 0
fi
## Error ##
echo "ERROR: Installation failed!"
exit 1