install.fairie/home/dot_local/bin/post-installx/executable_post-ntfy.sh

33 lines
1.2 KiB
Bash
Raw Normal View History

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
### Branding assets
2024-05-27 20:50:11 -07:00
gum log -sl info 'Ensuring branding assets are in expected place for ntfy'
2024-05-04 21:05:33 -07:00
sudo mkdir -p /usr/local/etc/branding
sudo cp -f "$HOME/.local/etc/branding/logo-color-256x256.png" /usr/local/etc/branding/logo-color-256x256.png
### 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
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