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..
|
# 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..
|
# not every package packagemanager has the same packagenames for their packages..
|
||||||
getImports() {
|
getImports() {
|
||||||
i="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh"
|
local url="$1"
|
||||||
import="$(mktemp)"
|
local import="$(mktemp)"
|
||||||
echo "importing $i into $import"
|
|
||||||
if command_exists curl; then
|
# ─< if $1 is a local file, source this one instead >─────────────────────────────────────
|
||||||
curl -fsSL $i -o $import
|
if [ -f "$url" ]; then
|
||||||
elif command_exists wget; then
|
source "$url"
|
||||||
wget $i -o $import
|
sleep 0.1
|
||||||
|
return 0
|
||||||
else
|
else
|
||||||
echo "curl/wget is required, but missing.."
|
# ─< if $1 is a url, grab it and source it, also deletes afterwards >─────────────────────
|
||||||
exit 1
|
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
|
fi
|
||||||
|
|
||||||
source "$import"
|
|
||||||
|
|
||||||
sleep 0.3
|
|
||||||
|
|
||||||
rm "$import" &&
|
|
||||||
echo_warning "cleaned $import"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init_docker() {
|
init_docker() {
|
||||||
if command_exists docker; then
|
if command_exists docker; then
|
||||||
echo_info "Docker was installed correctly. Do you want to add $(whoami) to the docker group? (y/n)"
|
if confirm "Docker was installed correctly. Do you want to add $(whoami) to the docker group? (y/n)"; then
|
||||||
read -r dgroup </dev/tty
|
|
||||||
case "$dgroup" in
|
|
||||||
[Yy])
|
|
||||||
$_sudo usermod -aG docker "$(whoami)"
|
$_sudo usermod -aG docker "$(whoami)"
|
||||||
;;
|
fi
|
||||||
esac
|
|
||||||
sleep 1
|
# spin and run
|
||||||
run $_sudo systemctl enable --now docker
|
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."
|
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
|
else
|
||||||
echo_error "Something went wrong!"
|
echo_error "Something went wrong!"
|
||||||
|
@ -56,9 +66,19 @@ init_docker() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_arch() {
|
_arch() {
|
||||||
echo_info "executing arch"
|
local err
|
||||||
sleep 1.3
|
# run _install docker docker-compose --noconfirm
|
||||||
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() {
|
_debian() {
|
||||||
|
@ -122,7 +142,7 @@ main() {
|
||||||
esac
|
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 >───────────────────────────────────────────────────────────────────
|
# ─< package variable >───────────────────────────────────────────────────────────────────
|
||||||
unset PACKAGE
|
unset PACKAGE
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue