From 01fcece3699db64a3e8daada24d93a1a02e2c70c Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Fri, 2 Dec 2022 17:09:59 +0000 Subject: [PATCH] Update .local/share/chezmoi/home/dot_local/bin/executable_install-program, .local/bin/install-program --- .local/bin/install-program | 23 ++++++++++++ .../dot_local/bin/executable_install-program | 37 +++++++++++-------- 2 files changed, 45 insertions(+), 15 deletions(-) diff --git a/.local/bin/install-program b/.local/bin/install-program index fe963c59..0611be6a 100644 --- a/.local/bin/install-program +++ b/.local/bin/install-program @@ -242,6 +242,29 @@ async function beforeInstall(packageManager) { } else if (packageManager === 'flatpak') { } else if (packageManager === 'snap') { } else if (packageManager === 'whalebrew') { + if (osType === 'darwin') { + const docker = await which('docker') + if (!docker) { + await $`brew install --cask docker` + } + try { + await $`docker run --rm hello-world` + } catch (e) { + await $`logg warn 'The command \`docker run --rm hello-world\` failed` + try { + await $`test -f /Applications/Docker.app` + await $`logg info 'Attempting to open \`Applications/Docker.app\` (Docker Desktop for macOS). This should take about 30 seconds.'` + const gum = await which('gum') + if (gum) { + await $`gum spin --spinner dot --title "Waiting for Docker Desktop to start up.." -- sleep 30` + } else { + await $`sleep 30` + } + } catch (e) { + await $`logg warn 'Docker Desktop appears to not be installed!` + } + } + } } else if (packageManager === 'winget') { } else if (packageManager === 'yay') { } else if (packageManager === 'zypper') { diff --git a/.local/share/chezmoi/home/dot_local/bin/executable_install-program b/.local/share/chezmoi/home/dot_local/bin/executable_install-program index b78b418f..55cfa4e4 100644 --- a/.local/share/chezmoi/home/dot_local/bin/executable_install-program +++ b/.local/share/chezmoi/home/dot_local/bin/executable_install-program @@ -242,21 +242,28 @@ async function beforeInstall(packageManager) { } else if (packageManager === 'flatpak') { } else if (packageManager === 'snap') { } else if (packageManager === 'whalebrew') { - if (osType === 'darwin') { - await $` - if ! docker run --rm hello-world; then - logg warn 'The command `docker run --rm hello-world` failed' - if [ -f '/Applications/Docker.app' ]; then - logg info 'Attempting to open `Applications/Docker.app` (Docker Desktop for macOS)' - open /Applications/Docker.app - if command -v gum > /dev/null; then - gum spin --spinner dot --title "Waiting for Docker Desktop to open and start the Docker daemon" -- sleep 30 - else - sleep 30 - fi - fi - fi - ` +if (osType === 'darwin') { + const docker = await which('docker') + if (!docker) { + await $`brew install --cask docker` + } + try { + await $`docker run --rm hello-world` + } catch (e) { + await $`logg warn 'The command \`docker run --rm hello-world\` failed` + try { + await $`test -f /Applications/Docker.app` + await $`logg info 'Attempting to open \`Applications/Docker.app\` (Docker Desktop for macOS). This should take about 30 seconds.'` + const gum = await which('gum') + if (gum) { + await $`gum spin --spinner dot --title "Waiting for Docker Desktop to start up.." -- sleep 30` + } else { + await $`sleep 30` + } + } catch (e) { + await $`logg warn 'Docker Desktop appears to not be installed!` + } + } } } else if (packageManager === 'winget') { } else if (packageManager === 'yay') {