Skip to content

Commit

Permalink
Add support for OpenRC
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Nemchik <[email protected]>
  • Loading branch information
nemchik committed Oct 2, 2023
1 parent a7ae7d1 commit 5be02a4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 20 deletions.
28 changes: 28 additions & 0 deletions .scripts/enable_docker_service.sh
Original file line number Diff line number Diff line change
@@ -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."
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."
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'
}
18 changes: 0 additions & 18 deletions .scripts/enable_docker_systemd.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .scripts/pm_apk_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pm_apk_install() {
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 sed ${REDIRECT}" || fatal "Failed to install dependencies from apk.\nFailing command: ${F[C]}sudo apk add coreutils curl git grep newt sed"
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() {
Expand Down
2 changes: 1 addition & 1 deletion .scripts/run_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand Down

0 comments on commit 5be02a4

Please sign in to comment.