2024-05-04 21:05:33 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# @file NTFY Dependencies
|
|
|
|
# @brief Ensures branding assets and sound files are in system locations. Also, ensures system dependencies are installed
|
|
|
|
|
2024-05-27 20:45:14 -07:00
|
|
|
set -Eeuo pipefail
|
2024-05-27 20:50:11 -07:00
|
|
|
trap "gum log -sl error 'Script encountered an error!'" ERR
|
2024-05-27 04:15:03 -07:00
|
|
|
|
2024-05-04 21:05:33 -07:00
|
|
|
if command -v ntfy > /dev/null; then
|
|
|
|
|
|
|
|
### Sound files
|
2024-05-27 20:50:11 -07:00
|
|
|
gum log -sl info 'Ensuring shared sound files are synced to system location'
|
2024-05-04 21:05:33 -07:00
|
|
|
sudo mkdir -p /usr/local/share/sounds
|
2024-05-27 23:55:42 -07:00
|
|
|
### /usr/share/sounds is ideal spot
|
2024-05-04 21:05:33 -07:00
|
|
|
sudo rsync -rtvp "${XDG_DATA_HOME:-$HOME/.local/share}/sounds/" /usr/local/share/sounds
|
|
|
|
|
|
|
|
### Debian dependency
|
|
|
|
if command -v apt-get > /dev/null; then
|
2024-05-27 20:50:11 -07:00
|
|
|
gum log -sl info 'Running sudo apt-get update && sudo apt-get install -y python-dbus'
|
2024-05-04 21:05:33 -07:00
|
|
|
sudo apt-get update && sudo apt-get install -y python-dbus
|
|
|
|
fi
|
|
|
|
|
|
|
|
### Termux dependency
|
|
|
|
if command -v termux-setup-storage > /dev/null; then
|
2024-05-27 20:50:11 -07:00
|
|
|
gum log -sl info 'Running apt install -y termux-api'
|
2024-05-04 21:05:33 -07:00
|
|
|
apt install -y termux-api
|
|
|
|
fi
|
|
|
|
else
|
2024-05-27 20:50:11 -07:00
|
|
|
gum log -sl info 'ntfy not available on PATH'
|
2024-05-04 21:05:33 -07:00
|
|
|
fi
|