Skip to content

Commit

Permalink
feat: add flatpak install script
Browse files Browse the repository at this point in the history
script `install-flatpaks` installs and uninstalls flatpaks according to
the included `flatpaks.json`.
  • Loading branch information
ryanpz committed Nov 9, 2024
1 parent 650a82c commit 2816069
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
29 changes: 29 additions & 0 deletions files/system/usr/bin/install-flatpaks
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

set -e

FLATPAKS=${FLATPAKS:-'/usr/share/bonito/flatpaks.json'}
variant=

. /etc/os-release

case "$VARIANT_ID" in
*sway*)
variant='sway'
;;
esac

jq_args="-r '.all.{{X}}[], .\"$variant\".{{X}}[]' $FLATPAKS"
package_list() {
echo "$jq_args" | sed "s/{{X}}/$1/g" | xargs jq
}

exclude_list=$(package_list 'exclude')
include_list=$(package_list 'include')

flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

# shellcheck disable=SC2086
[ -n "$exclude_list" ] && flatpak uninstall --user -y flathub $exclude_list
# shellcheck disable=SC2086
[ -n "$include_list" ] && flatpak install --user -y flathub $include_list
20 changes: 20 additions & 0 deletions files/system/usr/share/bonito/flatpaks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"all": {
"include": [
"com.brave.Browser",
"com.github.tchx84.Flatseal",
"com.obsproject.Studio",
"com.valvesoftware.Steam",
"io.mpv.Mpv",
"org.audacityteam.Audacity",
"org.gimp.GIMP",
"org.gnome.Loupe",
"org.kde.kdenlive"
],
"exclude": []
},
"sway": {
"include": [],
"exclude": []
}
}

0 comments on commit 2816069

Please sign in to comment.