diff --git a/.scripts/enable_docker_service.sh b/.scripts/enable_docker_service.sh new file mode 100644 index 0000000000..3e08f891b1 --- /dev/null +++ b/.scripts/enable_docker_service.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +IFS=$'\n\t' + +enable_docker_service() { + DOCKER_SERVICE_ENABLE="" + DOCKER_SERVICE_START="" + if [[ -n "$(command -v systemctl)" ]]; then + info "Systemd detected." + DOCKER_SERVICE_ENABLE="systemctl enable docker" + DOCKER_SERVICE_START="systemctl start docker" + elif [[ -n "$(command -v rc-update)" ]]; then + info "OpenRC detected." + DOCKER_SERVICE_ENABLE="rc-update add docker boot" + DOCKER_SERVICE_START="service docker start" + fi + if [[ -n ${DOCKER_SERVICE_ENABLE} ]]; then + info "Enabling docker service." + eval "sudo ${DOCKER_SERVICE_ENABLE}" > /dev/null 2>&1 || fatal "Failed to enable docker service.\nFailing command: ${F[C]}${DOCKER_SERVICE_ENABLE}" + info "Starting docker service." + eval "sudo ${DOCKER_SERVICE_START}" > /dev/null 2>&1 || fatal "Failed to start docker service.\nFailing command: ${F[C]}${DOCKER_SERVICE_START}" + fi +} + +test_enable_docker_service() { + run_script 'require_docker' + run_script 'enable_docker_service' +} diff --git a/.scripts/enable_docker_systemd.sh b/.scripts/enable_docker_systemd.sh deleted file mode 100644 index 7ac516c1ff..0000000000 --- a/.scripts/enable_docker_systemd.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail -IFS=$'\n\t' - -enable_docker_systemd() { - # https://docs.docker.com/install/linux/linux-postinstall/ - if [[ -L "/sbin/init" ]]; then - info "Systemd detected. Enabling docker service." - sudo systemctl enable docker > /dev/null 2>&1 || fatal "Failed to enable docker service.\nFailing command: ${F[C]}systemctl enable docker" - info "Starting docker service." - sudo systemctl start docker > /dev/null 2>&1 || fatal "Failed to start docker service.\nFailing command: ${F[C]}systemctl start docker" - fi -} - -test_enable_docker_systemd() { - run_script 'require_docker' - run_script 'enable_docker_systemd' -} diff --git a/.scripts/package_manager_run.sh b/.scripts/package_manager_run.sh index 63248e3fb6..fb3bdba010 100644 --- a/.scripts/package_manager_run.sh +++ b/.scripts/package_manager_run.sh @@ -4,7 +4,9 @@ IFS=$'\n\t' package_manager_run() { local ACTION=${1-} - if [[ -n "$(command -v apt-get)" ]]; then + if [[ -n "$(command -v apk)" ]]; then + run_script "pm_apk_${ACTION}" + elif [[ -n "$(command -v apt-get)" ]]; then run_script "pm_apt_${ACTION}" elif [[ -n "$(command -v dnf)" ]]; then run_script "pm_dnf_${ACTION}" diff --git a/.scripts/pm_apk_clean.sh b/.scripts/pm_apk_clean.sh new file mode 100644 index 0000000000..45bc29e418 --- /dev/null +++ b/.scripts/pm_apk_clean.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +IFS=$'\n\t' + +pm_apk_clean() { + info "apk does not require cleanup." +} + +test_pm_apk_clean() { + # run_script 'pm_apk_clean' + warn "CI does not test pm_apk_clean." +} diff --git a/.scripts/pm_apk_install.sh b/.scripts/pm_apk_install.sh new file mode 100644 index 0000000000..396126422e --- /dev/null +++ b/.scripts/pm_apk_install.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +IFS=$'\n\t' + +pm_apk_install() { + notice "Installing dependencies. Please be patient, this can take a while." + local REDIRECT="> /dev/null 2>&1" + if [[ -n ${VERBOSE-} ]] || run_script 'question_prompt' "${PROMPT:-CLI}" N "Would you like to display the command output?"; then + REDIRECT="" + fi + eval "sudo apk add coreutils curl git grep newt openrc sed ${REDIRECT}" || fatal "Failed to install dependencies from apk.\nFailing command: ${F[C]}sudo apk add coreutils curl git grep newt sed" +} + +test_pm_apk_install() { + # run_script 'pm_apk_repos' + # run_script 'pm_apk_install' + warn "CI does not test pm_apk_install." +} diff --git a/.scripts/pm_apk_install_docker.sh b/.scripts/pm_apk_install_docker.sh new file mode 100644 index 0000000000..0e37644c04 --- /dev/null +++ b/.scripts/pm_apk_install_docker.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +IFS=$'\n\t' + +pm_apk_install_docker() { + notice "Installing docker. Please be patient, this can take a while." + local REDIRECT="> /dev/null 2>&1" + if [[ -n ${VERBOSE-} ]] || run_script 'question_prompt' "${PROMPT:-CLI}" N "Would you like to display the command output?"; then + REDIRECT="" + fi + eval "sudo apk add docker docker-cli-compose ${REDIRECT}" || fatal "Failed to install docker and docker-compose using pacman.\nFailing command: ${F[C]}sudo apk add docker docker-cli-compose" + +} + +test_pm_apk_install_docker() { + # run_script 'pm_apk_repos' + # run_script 'pm_apk_install_docker' + warn "CI does not test pm_apk_install_docker." +} diff --git a/.scripts/pm_apk_repos.sh b/.scripts/pm_apk_repos.sh new file mode 100644 index 0000000000..27369dbf31 --- /dev/null +++ b/.scripts/pm_apk_repos.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +IFS=$'\n\t' + +pm_apk_repos() { + info "apk does not require additional repositories." +} + +test_pm_apk_repos() { + # run_script 'pm_apk_repos' + warn "CI does not test pm_apk_repos." +} diff --git a/.scripts/pm_apk_upgrade.sh b/.scripts/pm_apk_upgrade.sh new file mode 100644 index 0000000000..c25367f655 --- /dev/null +++ b/.scripts/pm_apk_upgrade.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +IFS=$'\n\t' + +pm_apk_upgrade() { + if [[ ${CI-} != true ]]; then + notice "Upgrading packages. Please be patient, this can take a while." + local REDIRECT="> /dev/null 2>&1" + if [[ -n ${VERBOSE-} ]] || run_script 'question_prompt' "${PROMPT:-CLI}" N "Would you like to display the command output?"; then + REDIRECT="" + fi + eval "sudo apk upgrade ${REDIRECT}" || fatal "Failed to upgrade packages from apk.\nFailing command: ${F[C]}sudo apk upgrade" + fi +} + +test_pm_apk_upgrade() { + # run_script 'pm_apk_upgrade' + warn "CI does not test pm_apk_upgrade." +} diff --git a/.scripts/pm_dnf_install.sh b/.scripts/pm_dnf_install.sh index 890900902b..c3ac7dbf65 100644 --- a/.scripts/pm_dnf_install.sh +++ b/.scripts/pm_dnf_install.sh @@ -12,6 +12,7 @@ pm_dnf_install() { } test_pm_dnf_install() { + # run_script 'pm_dnf_repos' # run_script 'pm_dnf_install' warn "CI does not test pm_dnf_install." } diff --git a/.scripts/pm_dnf_install_docker.sh b/.scripts/pm_dnf_install_docker.sh index d182c0c51c..f97352ad27 100644 --- a/.scripts/pm_dnf_install_docker.sh +++ b/.scripts/pm_dnf_install_docker.sh @@ -21,6 +21,7 @@ pm_dnf_install_docker() { } test_pm_dnf_install_docker() { + # run_script 'pm_dnf_repos' # run_script 'pm_dnf_install_docker' warn "CI does not test pm_dnf_install_docker." } diff --git a/.scripts/pm_pacman_install.sh b/.scripts/pm_pacman_install.sh index 74a17fb745..13637f819c 100644 --- a/.scripts/pm_pacman_install.sh +++ b/.scripts/pm_pacman_install.sh @@ -12,6 +12,7 @@ pm_pacman_install() { } test_pm_pacman_install() { + # run_script 'pm_pacman_repos' # run_script 'pm_pacman_install' warn "CI does not test pm_pacman_install." } diff --git a/.scripts/pm_pacman_install_docker.sh b/.scripts/pm_pacman_install_docker.sh index db2116c3de..336bd6d1b7 100644 --- a/.scripts/pm_pacman_install_docker.sh +++ b/.scripts/pm_pacman_install_docker.sh @@ -12,6 +12,7 @@ pm_pacman_install_docker() { } test_pm_pacman_install_docker() { + # run_script 'pm_pacman_repos' # run_script 'pm_pacman_install_docker' warn "CI does not test pm_pacman_install_docker." } diff --git a/.scripts/pm_yum_install.sh b/.scripts/pm_yum_install.sh index 6d9d18445e..10b4a866cf 100644 --- a/.scripts/pm_yum_install.sh +++ b/.scripts/pm_yum_install.sh @@ -12,6 +12,7 @@ pm_yum_install() { } test_pm_yum_install() { + # run_script 'pm_yum_repos' # run_script 'pm_yum_install' warn "CI does not test pm_yum_install." } diff --git a/.scripts/pm_yum_install_docker.sh b/.scripts/pm_yum_install_docker.sh index eba5800052..2b863382d1 100644 --- a/.scripts/pm_yum_install_docker.sh +++ b/.scripts/pm_yum_install_docker.sh @@ -19,6 +19,7 @@ pm_yum_install_docker() { } test_pm_yum_install_docker() { + # run_script 'pm_yum_repos' # run_script 'pm_yum_install_docker' warn "CI does not test pm_yum_install_docker." } diff --git a/.scripts/run_install.sh b/.scripts/run_install.sh index fac03fed7c..1425432250 100644 --- a/.scripts/run_install.sh +++ b/.scripts/run_install.sh @@ -6,7 +6,7 @@ run_install() { run_script 'update_system' run_script 'require_docker' run_script 'setup_docker_group' - run_script 'enable_docker_systemd' + run_script 'enable_docker_service' run_script 'request_reboot' } diff --git a/README.md b/README.md index 560e0b9c9c..6db46a15d2 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,14 @@ You may choose to rely on DockSTARTer for various changes to your Docker system ### One Time Setup (required) +- APK Systems (Alpine) + + ```bash + sudo apk add curl git + bash -c "$(curl -fsSL https://get.dockstarter.com)" + sudo reboot + ``` + - APT Systems ([Debian](https://docs.docker.com/install/linux/docker-ce/debian/#os-requirements), [Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/#os-requirements), etc) ```bash