testing..
This commit is contained in:
parent
c4002eff68
commit
a841a7cf7a
1 changed files with 48 additions and 28 deletions
76
docker.sh
76
docker.sh
|
@ -18,37 +18,47 @@ command_exists() {
|
|||
# This only wokrs for generic package names, like neovim, or vim, or tmux etc..
|
||||
# not every package packagemanager has the same packagenames for their packages..
|
||||
getImports() {
|
||||
i="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh"
|
||||
import="$(mktemp)"
|
||||
echo "importing $i into $import"
|
||||
if command_exists curl; then
|
||||
curl -fsSL $i -o $import
|
||||
elif command_exists wget; then
|
||||
wget $i -o $import
|
||||
local url="$1"
|
||||
local import="$(mktemp)"
|
||||
|
||||
# ─< if $1 is a local file, source this one instead >─────────────────────────────────────
|
||||
if [ -f "$url" ]; then
|
||||
source "$url"
|
||||
sleep 0.1
|
||||
return 0
|
||||
else
|
||||
echo "curl/wget is required, but missing.."
|
||||
exit 1
|
||||
# ─< if $1 is a url, grab it and source it, also deletes afterwards >─────────────────────
|
||||
if command_exists curl; then
|
||||
curl -fsSL $url -o $import
|
||||
elif command_exists wget; then
|
||||
wget -o $import $url
|
||||
else
|
||||
echo "curl/wget is required, but missing.."
|
||||
exit 69
|
||||
fi
|
||||
|
||||
source "$import"
|
||||
echo_info "Sourcing external script:${NC} $url"
|
||||
sleep 0.1
|
||||
rm -f "$import"
|
||||
fi
|
||||
|
||||
source "$import"
|
||||
|
||||
sleep 0.3
|
||||
|
||||
rm "$import" &&
|
||||
echo_warning "cleaned $import"
|
||||
}
|
||||
|
||||
init_docker() {
|
||||
if command_exists docker; then
|
||||
echo_info "Docker was installed correctly. Do you want to add $(whoami) to the docker group? (y/n)"
|
||||
read -r dgroup </dev/tty
|
||||
case "$dgroup" in
|
||||
[Yy])
|
||||
if confirm "Docker was installed correctly. Do you want to add $(whoami) to the docker group? (y/n)"; then
|
||||
$_sudo usermod -aG docker "$(whoami)"
|
||||
;;
|
||||
esac
|
||||
sleep 1
|
||||
run $_sudo systemctl enable --now docker
|
||||
fi
|
||||
|
||||
# spin and run
|
||||
spin bold grey "Enabling docker service.."
|
||||
if run --err err $_sudo systemctl enable --now docker; then
|
||||
check "Docker service is enabled!"
|
||||
else
|
||||
throw "Could not setup the service.."
|
||||
echo_error "${err:-}"
|
||||
fi
|
||||
|
||||
echo_info "$(whoami) is now part of the docker group. Restart your session to enable the changes. Also docker was addet as a service. Should autostart from now on."
|
||||
else
|
||||
echo_error "Something went wrong!"
|
||||
|
@ -56,9 +66,19 @@ init_docker() {
|
|||
}
|
||||
|
||||
_arch() {
|
||||
echo_info "executing arch"
|
||||
sleep 1.3
|
||||
run _install docker docker-compose --noconfirm
|
||||
local err
|
||||
# run _install docker docker-compose --noconfirm
|
||||
|
||||
# spin blue bold "Executing arch.."
|
||||
# sleep 1.3
|
||||
|
||||
spin bold grey "Executing arch.. installing $PACKAGE"
|
||||
if run --err err _install docker docker-compose --noconfirm; then
|
||||
check "Docker was installed"
|
||||
else
|
||||
throw "Could not install docker"
|
||||
echo_error "${err:-}"
|
||||
fi
|
||||
}
|
||||
|
||||
_debian() {
|
||||
|
@ -122,7 +142,7 @@ main() {
|
|||
esac
|
||||
}
|
||||
|
||||
if getImports; then
|
||||
if getImports "https://git.k4li.de/scripts/beddu/raw/branch/main/dist/beddu.sh" && getImports "https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh"; then
|
||||
# ─< package variable >───────────────────────────────────────────────────────────────────
|
||||
unset PACKAGE
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue