-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docker: adjust module options to match changes
- Loading branch information
1 parent
28f5838
commit a0d0db9
Showing
6 changed files
with
110 additions
and
61 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
This file was deleted.
Oops, something went wrong.
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
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
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
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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
module_options+=( | ||
["module_docker,author"]="@schwar3kat" | ||
["module_docker,maintainer"]="@igorpecovnik" | ||
["module_docker,feature"]="install_docker" | ||
["module_docker,example"]="install remove purge status help" | ||
["module_docker,desc"]="Install docker from a repo using apt" | ||
["module_docker,status"]="Active" | ||
["module_docker,doc_link"]="https://wiki.bazarr.media/" | ||
["module_docker,group"]="Containers" | ||
["module_docker,port"]="" | ||
["module_docker,arch"]="x86-64 arm64 armhf" | ||
) | ||
# | ||
# Install Docker from repo using apt | ||
# Setup sources list and GPG key then install the app. If you want a full desktop then $1=desktop | ||
# | ||
function module_docker() { | ||
|
||
local title="bazarr" | ||
local condition=$(which "$title" 2>/dev/null) | ||
|
||
local commands | ||
IFS=' ' read -r -a commands <<< "${module_options["module_docker,example"]}" | ||
|
||
case "$1" in | ||
"${commands[0]}") | ||
# Check if repo for distribution exists. | ||
URL="https://download.docker.com/linux/${DISTRO,,}/dists/$DISTROID" | ||
if wget --spider "${URL}" 2> /dev/null; then | ||
# Add Docker's official GPG key: | ||
wget -qO - https://download.docker.com/linux/${DISTRO,,}/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/docker.gpg > /dev/null | ||
if [[ $? -eq 0 ]]; then | ||
# Add the repository to Apt sources: | ||
cat <<- EOF > "/etc/apt/sources.list.d/docker.list" | ||
deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/${DISTRO,,} $DISTROID stable | ||
EOF | ||
pkg_update | ||
# Install docker | ||
if [ "$2" = "engine" ]; then | ||
pkg_install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | ||
else | ||
pkg_install docker-ce docker-ce-cli containerd.io | ||
fi | ||
|
||
groupadd docker 2>/dev/null || true | ||
usermod -aG docker $SUDO_USER | ||
systemctl enable docker.service > /dev/null 2>&1 | ||
systemctl enable containerd.service > /dev/null 2>&1 | ||
docker network create lsio 2> /dev/null | ||
fi | ||
else | ||
$DIALOG --msgbox "ERROR ! ${DISTRO} $DISTROID distribution not found in repository!" 7 70 | ||
fi | ||
;; | ||
"${commands[1]}") | ||
pkg_remove docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras | ||
;; | ||
"${commands[2]}") | ||
rm -rf /var/lib/docker | ||
rm -rf /var/lib/containerd | ||
;; | ||
"${commands[3]}") | ||
if [ "$2" = "docker-ce" ]; then | ||
if pkg_installed docker-ce; then | ||
return 0 | ||
else | ||
return 1 | ||
fi | ||
fi | ||
if [ "$2" = "docker-compose-plugin" ]; then | ||
if pkg_installed docker-compose-plugin; then | ||
return 0 | ||
else | ||
return 1 | ||
fi | ||
fi | ||
;; | ||
"${commands[4]}") | ||
echo -e "\nUsage: ${module_options["module_docker,feature"]} <command>" | ||
echo -e "Commands: ${module_options["module_docker,example"]}" | ||
echo "Available commands:" | ||
echo -e "\tinstall\t- Install $title." | ||
echo -e "\tstatus\t- Installation status $title." | ||
echo -e "\tremove\t- Remove $title." | ||
echo -e "\tremove\t- Purge $title." | ||
echo | ||
;; | ||
*) | ||
${module_options["module_docker,feature"]} ${commands[4]} | ||
;; | ||
esac | ||
} | ||
|