Skip to content

Instantly share code, notes, and snippets.

@nukhes
Created January 17, 2026 15:39
Show Gist options
  • Select an option

  • Save nukhes/899291eef2149f8862df68f3ab2199a6 to your computer and use it in GitHub Desktop.

Select an option

Save nukhes/899291eef2149f8862df68f3ab2199a6 to your computer and use it in GitHub Desktop.
Distribution-agnostic tool designed to deploy the Flatpak across multiple Linux environments silently.
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
exit 1
fi
declare -A os_map=(
["apt"]="apt install -qq -y flatpak"
["dnf"]="dnf install -y -q flatpak"
["pacman"]="pacman -S --noconfirm --needed --quiet flatpak"
["zypper"]="zypper --quiet install -y flatpak"
["apk"]="apk add --quiet flatpak"
["xbps-install"]="xbps-install -y -Q flatpak"
)
install_flatpak() {
for cmd in "${!os_map[@]}"; do
if command -v "$cmd" &> /dev/null; then
eval "${os_map[$cmd]}" > /dev/null 2>&1
return 0
fi
done
return 1
}
setup_flathub() {
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
}
main() {
if install_flatpak; then
if ! command -v flatpak &> /dev/null; then
setup_flathub
fi
else
exit 1
fi
}
main
@nukhes
Copy link
Author

nukhes commented Jan 17, 2026

Run with one command

curl -fsSL https://gist.githubusercontent.com/nukhes/899291eef2149f8862df68f3ab2199a6/raw/ | sudo sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment