#!/bin/sh # Installs Camomilla, the menu bar file converter for macOS. # curl -fsSL https://camomilla.app/install.sh | sh # It downloads the latest release from GitHub, checks its SHA-256 sum and its signature, quits Camomilla if it is open, # copies the app to Applications and opens it. No sudo, nothing else on your Mac changes. # Camomilla is notarized by Apple. Updates then come from inside the app. set -eu # Everything is inside a function: if the download of this script stops halfway, nothing runs. main() { release=https://github.com/roaringsoul404/camomilla/releases/latest/download fail() { echo "$1" >&2; exit 1; } [ "$(uname -s)" = Darwin ] || fail "This installer is for macOS." [ "$(sysctl -n hw.optional.arm64 2>/dev/null)" = 1 ] || fail "Camomilla needs a Mac with Apple silicon (M1 or later)." [ "$(sw_vers -productVersion | cut -d. -f1)" -ge 14 ] || fail "Camomilla needs macOS 14 Sonoma or later." tmp=$(mktemp -d) trap 'hdiutil detach -quiet "$tmp/volume" 2>/dev/null || true; rm -rf "$tmp"' EXIT echo "Downloading Camomilla…" curl -fsSL -o "$tmp/Camomilla.dmg" "$release/Camomilla.dmg" curl -fsSL -o "$tmp/SHA256SUMS.txt" "$release/SHA256SUMS.txt" (cd "$tmp" && grep ' Camomilla.dmg$' SHA256SUMS.txt | shasum -a 256 -c -s) \ || fail "The download is damaged (the SHA-256 sum doesn't match). Try again." mkdir "$tmp/volume" hdiutil attach -quiet -nobrowse -readonly -noautoopen -mountpoint "$tmp/volume" "$tmp/Camomilla.dmg" /dev/null \ && [ "$(codesign -dv "$app" 2>&1 | sed -n 's/^TeamIdentifier=//p')" = NVP49VL5BG ] \ && spctl --assess --type execute "$app" 2>/dev/null \ || fail "This copy of Camomilla isn't signed by its developer. Nothing was installed." if pgrep -xq Camomilla; then echo "Quitting Camomilla…" osascript -e 'quit app id "app.camomilla"' >/dev/null 2>&1 || true for _ in 1 2 3 4 5 6 7 8 9 10; do pgrep -xq Camomilla || break; sleep 0.5; done fi # /Applications if you can write there, otherwise the Applications folder in your home. # If Camomilla is already in your home folder, it stays there. if [ -d "$HOME/Applications/Camomilla.app" ] || [ ! -w /Applications ]; then dest="$HOME/Applications" mkdir -p "$dest" else dest=/Applications fi # The new copy lands next to the old one first: if the copy stops halfway, the old app is still there. rm -rf "$dest/.Camomilla.app.new" ditto "$app" "$dest/.Camomilla.app.new" rm -rf "$dest/Camomilla.app" mv "$dest/.Camomilla.app.new" "$dest/Camomilla.app" open "$dest/Camomilla.app" echo "Camomilla is in $dest. Look for the flower in the menu bar." } main