Add support for Ubuntu.
This commit is contained in:
parent
28af038548
commit
470f0701ae
@ -4,19 +4,47 @@
|
|||||||
# Original comands came from here: https://docs.docker.com/engine/install/debian/
|
# Original comands came from here: https://docs.docker.com/engine/install/debian/
|
||||||
# usage: install.sh
|
# usage: install.sh
|
||||||
|
|
||||||
apt purge docker docker-engine docker.io containerd runc
|
## Variables ##
|
||||||
|
|
||||||
apt update &&
|
os=`grep ^'NAME=' /etc/os-release`
|
||||||
apt install -y ca-certificates curl gnupg lsb-release &&
|
pkgmgr=""
|
||||||
mkdir -p /etc/apt/keyrings &&
|
|
||||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg &&
|
## Validations ##
|
||||||
echo \
|
|
||||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
|
if [[ "$os" == *"Debian"* ]]; then
|
||||||
|
repo="debian"
|
||||||
|
pkgmgr="apt"
|
||||||
|
elif [[ "$os" == *"Ubuntu"* ]]; then
|
||||||
|
repo="ubuntu"
|
||||||
|
pkgmgr="apt"
|
||||||
|
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
|
||||||
|
|
||||||
|
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 &&
|
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null &&
|
||||||
apt update &&
|
apt update &&
|
||||||
apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin &&
|
apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin &&
|
||||||
exit 0
|
|
||||||
|
echo "Success!" &&
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
## Error ##
|
||||||
|
|
||||||
echo "ERROR: Installation failed!"
|
echo "ERROR: Installation failed!"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user