2024-04-12 09:47:18 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2024-06-05 09:23:12 +00:00
|
|
|
CLAN=$(nix build .#clan-app --print-out-paths)
|
2024-04-12 09:47:18 +00:00
|
|
|
|
|
|
|
if ! command -v xdg-mime &> /dev/null; then
|
|
|
|
echo "Warning: 'xdg-mime' is not available. The desktop file cannot be installed."
|
|
|
|
fi
|
|
|
|
|
|
|
|
# install desktop file
|
|
|
|
set -eou pipefail
|
2024-06-05 09:23:12 +00:00
|
|
|
DESKTOP_FILE_NAME=org.clan.app.desktop
|
2024-04-12 09:47:18 +00:00
|
|
|
DESKTOP_DST=~/.local/share/applications/"$DESKTOP_FILE_NAME"
|
|
|
|
DESKTOP_SRC="$CLAN/share/applications/$DESKTOP_FILE_NAME"
|
2024-06-05 09:23:12 +00:00
|
|
|
UI_BIN="$CLAN/bin/clan-app"
|
2024-04-12 09:47:18 +00:00
|
|
|
|
|
|
|
cp -f "$DESKTOP_SRC" "$DESKTOP_DST"
|
|
|
|
sleep 2
|
2024-06-05 09:23:12 +00:00
|
|
|
sed -i "s|Exec=.*clan-app|Exec=$UI_BIN|" "$DESKTOP_DST"
|
2024-04-12 09:47:18 +00:00
|
|
|
xdg-mime default "$DESKTOP_FILE_NAME" x-scheme-handler/clan
|
|
|
|
echo "==== Validating desktop file installation ===="
|
|
|
|
set -x
|
|
|
|
desktop-file-validate "$DESKTOP_DST"
|
|
|
|
set +xeou pipefail
|