Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 20 additions & 21 deletions podman-desktop
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,30 @@ show_help() {
"
}

die() {
err() {
echo >&2 "$@"
exit 1
}

install_cmd() {
set +e
if [ -z "$(command -v brew)" ]; then
echo "# Install homebrew for easier MacOS management"
# shellcheck disable=SC2016
echo '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'
fi
set -e
echo "brew install $1"
die() {
err "$@"
exit 1
}

validate() {
cmd=$1
if [ ! -x "$(command -v "$cmd")" ]; then
echo "ERROR: \`$cmd\` command not found. Please install $cmd." >&2
echo "Instructions are:"
install_cmd "$cmd"
exit 1
else
echo "$cmd found."
fi
set +e
command -v $cmd >/dev/null 2>&1 && return
command -v brew >/dev/null 2>&1 || {
die 'Install homebrew for easier macOS management

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
'
}

die "ERROR: \`$cmd\` command not found. Please install with

brew install $cmd
"
}

validate "podman"
Expand Down Expand Up @@ -82,10 +80,11 @@ PUBKEY=$(cat "$PUBKEYFILE")

PRIMARY=$(multipass get client.primary-name)
if [ "$PRIMARY" != "$INSTANCE_NAME" ] && [ "$PRIMARY" != "primary" ]; then
die "client.primary-name already set ($PRIMARY) for multipass"
err "client.primary-name already set ($PRIMARY) for multipass"
else
multipass set client.primary-name="$INSTANCE_NAME"
fi

multipass set client.primary-name="$INSTANCE_NAME"
echo >&2 "this may take a while - to view progress:

multipass exec $INSTANCE_NAME -- tail -f /var/log/cloud-init-output.log
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ podman runs on linux, so this script spins up a virtual linux machine, and confi

Requires `muiltipass` and `podman`

> if you are on Apple Silicon, use multipass [1.8.0](https://multipass-ci.s3.amazonaws.com/pr403/multipass-1.8.0-dev.403.pr403%2Bg843f3ca3.mac%2Barm64-Darwin.pkg)
> if you are on Apple Silicon, use multipass [1.8.0-rc.849](https://multipass-ci.s3.amazonaws.com/multipass-1.8.0-rc.849%2Bgb6625c10.mac-Darwin.pkg)

brew install multipass podman

Expand Down