#!/usr/bin/env bash # Installs Music Player Randomizer for the current user, with an app menu entry and icon. # Run it from the unpacked release folder: ./install.sh set -euo pipefail cd "$(dirname "$0")" bin_dir="${XDG_BIN_HOME:-$HOME/.local/bin}" data_dir="${XDG_DATA_HOME:-$HOME/.local/share}" binary="$bin_dir/music-player-randomizer" icon_dir="$data_dir/icons/hicolor/256x256/apps" mkdir -p "$bin_dir" "$icon_dir" "$data_dir/applications" install -m755 MusicPlayer.x86_64 "$binary" install -m644 music-player-randomizer.png "$icon_dir/music-player-randomizer.png" # The menu entry needs the full path, since ~/.local/bin is not always on PATH sed "s|^Exec=.*|Exec=$binary|" music-player-randomizer.desktop \ > "$data_dir/applications/music-player-randomizer.desktop" # Refresh menu and icon caches where the tools exist; most desktops also notice on their own command -v update-desktop-database > /dev/null \ && update-desktop-database "$data_dir/applications" || true command -v gtk-update-icon-cache > /dev/null \ && gtk-update-icon-cache -q "$data_dir/icons/hicolor" || true echo "Installed. Start it from your app menu, or run: $binary" echo "To uninstall, delete:" echo " $binary" echo " $data_dir/applications/music-player-randomizer.desktop" echo " $icon_dir/music-player-randomizer.png"