added checks for flatpak-builder

This commit is contained in:
Wizzard 2023-07-11 20:59:42 -04:00
parent 18e6598a95
commit 03f52e221f
1 changed files with 27 additions and 6 deletions

View File

@ -1,9 +1,33 @@
#!/bin/bash
# Build Flatpak package
is_package_installed() {
if command -v "$1" >/dev/null 2>&1; then
return 0
else
return 1
fi
}
if [[ -f /etc/os-release ]]; then
. /etc/os-release
if [[ "$ID" == "ubuntu" || "$ID_LIKE" == "ubuntu" ]]; then
if ! is_package_installed flatpak-builder; then
sudo apt update
sudo apt install -y flatpak-builder
fi
elif [[ "$ID" == "fedora" || "$ID_LIKE" == "fedora" ]]; then
if ! is_package_installed flatpak-builder; then
sudo dnf install -y flatpak-builder
fi
elif [[ "$ID" == "void" ]]; then
if ! is_package_installed flatpak-builder; then
sudo xbps-install -Sy flatpak-builder
fi
fi
fi
flatpak-builder build-dir lol.deadzone.discord-awesomeaudio.json --install --user --force-clean
# Create wrapper script
echo '#!/bin/bash
RUNNING=$(pgrep -f "discord-screenaudio")
if [[ -n $RUNNING ]]; then
@ -11,12 +35,10 @@ if [[ -n $RUNNING ]]; then
else
WM_CLASS=""
fi
flatpak run --env=WM_CLASS="$WM_CLASS" lol.deadzone.discord-awesomeaudio' > ~/.local/bin/discord-awesomeaudio.sh
#flatpak run --env=WM_CLASS="$WM_CLASS" lol.deadzone.discord-awesomeaudio' > ~/.local/bin/discord-awesomeaudio.sh
# Make the wrapper script executable
chmod +x ~/.local/bin/discord-awesomeaudio.sh
# Create .desktop file
echo "[Desktop Entry]
Name=Discord Awesome Audio
Exec=flatpak run lol.deadzone.discord-awesomeaudio
@ -24,5 +46,4 @@ Icon=/path/to/application/icon.png
Type=Application
Categories=AudioVideo;Network;" > ~/.local/share/applications/discord-awesomeaudio.desktop
# Make the .desktop file executable (if necessary)
chmod +x ~/.local/share/applications/discord-awesomeaudio.desktop