30 lines
1.4 KiB
Shell
30 lines
1.4 KiB
Shell
#!/usr/bin/env bash
|
|
# Builds Tunal in release mode and installs it for the current user.
|
|
# bash scripts/install.sh installs under ~/.local
|
|
# PREFIX=/some/dir bash scripts/install.sh
|
|
# The polkit policy needs root, so its install line is printed, not run.
|
|
set -euo pipefail
|
|
|
|
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
prefix="${PREFIX:-$HOME/.local}"
|
|
|
|
cd "$root"
|
|
cargo build --release -p tunal
|
|
|
|
install -Dm755 target/release/tunal "$prefix/bin/tunal"
|
|
install -Dm644 assets/tunal.desktop "$prefix/share/applications/tunal.desktop"
|
|
install -Dm644 assets/tunal.svg "$prefix/share/icons/hicolor/scalable/apps/tunal.svg"
|
|
install -Dm644 assets/tunal.png "$prefix/share/icons/hicolor/256x256/apps/tunal.png"
|
|
|
|
command -v update-desktop-database >/dev/null && update-desktop-database "$prefix/share/applications" || true
|
|
command -v gtk-update-icon-cache >/dev/null && gtk-update-icon-cache -qtf "$prefix/share/icons/hicolor" || true
|
|
|
|
echo "Installed Tunal under $prefix"
|
|
case ":$PATH:" in
|
|
*":$prefix/bin:"*) ;;
|
|
*) echo "Note: $prefix/bin is not in PATH." ;;
|
|
esac
|
|
echo
|
|
echo "Root operations (Tunal asks polkit for the password) need the policy file, which"
|
|
echo "belongs to /usr/bin/tunal. Install the binary there too, then run:"
|
|
echo " sudo install -Dm644 $root/assets/polkit/org.tunal.Tunal.elevated-helper.policy /usr/share/polkit-1/actions/org.tunal.Tunal.elevated-helper.policy"
|