-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Convert flatpak-manager into a module (#45)
* refactor: Move flatpak-manager and user-setup to modules dir * fix: Remove just setup from user-setup * fix: Disable systemd module We're only enabling the Flatpak-related services, and those are being converted into a separate module. * refactor: Use generic names for flatpak setup scripts and services * refactor: Standardize config file checks in flatpak-setup scripts * feat: Initial add flatpaks module * feat: Enable flatpaks module * fix: Copy system and user scripts separately * fix: Point to correct directory * refactor: Move flatpak-setup files back into main usr dirs Unless this is made a bling module instead, this module is gonna have to work like yafti in that the necessary files need to be included in startingpoint directly. * feat: Create flatpak install and remove lists * fix: Point system-flatpak-setup to new install and remove files * feat: Enable flatpak installation and removal for user * refactor: Move flatpak installation to flatpaks module * fix: Build install and removal lists correctly * fix(main): Remove user flatpak installs Had them there for testing, don't need them to stay. * chore: Add output for added flatpaks * style: Make flathub remote name generic System-wide was flathub-system, per-user was flathub-user. I do like having it explicit like that myself, but for more general-purpose usage, it's probably best to keep it generic as just flathub for both. Flatpak does allow specifying --system or --user already, anyway. * refactor: Use flatpaks module for kinoite * fix(dconf): packaging-format-preference: flathub-user -> flathub Since I'm switching back to using "flathub" as the remote name instead of specifying -user vs -system
- Loading branch information
Showing
14 changed files
with
196 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Script Version | ||
VER=1 | ||
VER_FILE="$HOME/.config/ublue-os/user-flatpak-configured" | ||
VER_RAN=$(cat $VER_FILE) | ||
|
||
# Run script if updated | ||
if [[ -f $VER_FILE && $VER = $VER_RAN ]]; then | ||
echo "Flatpak setup v$VER has already ran. Exiting..." | ||
exit 0 | ||
fi | ||
|
||
# Setup Flathub | ||
if grep -qz 'fedora' <<< $(flatpak remotes); then | ||
flatpak remote-delete --user fedora --force | ||
fi | ||
flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo | ||
|
||
# Lists of flatpaks | ||
FLATPAK_LIST=$(flatpak list --columns=application) | ||
INSTALL_LIST=$(cat /etc/flatpak/user-install) | ||
REMOVE_LIST=$(cat /etc/flatpak/user-remove) | ||
|
||
# Install flatpaks in list | ||
if [[ -n $INSTALL_LIST ]]; then | ||
for flatpak in $INSTALL_LIST; do | ||
if grep -qvz $flatpak <<< $FLATPAK_LIST; then | ||
flatpak install --user --noninteractive flathub $flatpak | ||
fi | ||
done | ||
fi | ||
|
||
# Remove flatpaks in list | ||
if [[ -n $REMOVE_LIST ]]; then | ||
for flatpak in $REMOVE_LIST; do | ||
if grep -qz $flatpak <<< $FLATPAK_LIST; then | ||
flatpak remove --user --noninteractive $flatpak | ||
fi | ||
done | ||
fi | ||
|
||
# Prevent future executions | ||
echo "Writing state file" | ||
mkdir -p $HOME/.config/ublue-os/ | ||
echo $VER > $VER_FILE |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
config/files/usr/lib/systemd/user/user-flatpak-setup.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Unit] | ||
Description=Configure Flatpaks for current user | ||
Requires=xdg-desktop-autostart.target | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/usr/bin/user-flatpak-setup | ||
|
||
[Install] | ||
WantedBy=default.target |
11 changes: 0 additions & 11 deletions
11
config/files/usr/lib/systemd/user/zeliblue-user-setup.service
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,32 @@ | ||
type: rpm-ostree | ||
install: | ||
- gnome-console | ||
remove: | ||
- gnome-classic-session | ||
- gnome-terminal | ||
- gnome-terminal-nautilus | ||
modules: | ||
|
||
- type: rpm-ostree | ||
install: | ||
- gnome-console | ||
remove: | ||
- gnome-classic-session | ||
- gnome-terminal | ||
- gnome-terminal-nautilus | ||
|
||
- type: flatpaks | ||
system: | ||
install: | ||
- org.gnome.Calculator | ||
- org.gnome.Calendar | ||
- io.github.celluloid_player.Celluloid | ||
- org.gnome.Characters | ||
- org.gnome.clocks | ||
- org.gnome.Contacts | ||
- org.gnome.baobab | ||
- org.gnome.SimpleScan | ||
- org.gnome.Evince | ||
- org.gnome.font-viewer | ||
- org.gnome.Logs | ||
- org.gnome.Loupe | ||
- org.gnome.Maps | ||
- org.gnome.NautilusPreviewer | ||
- org.gnome.TextEditor | ||
- org.gnome.Weather | ||
- org.gnome.Epiphany | ||
- com.github.tchx84.Flatseal | ||
- org.gnome.World.PikaBackup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,34 @@ | ||
type: rpm-ostree | ||
# install: | ||
# - ksystemlog | ||
remove: | ||
- ark | ||
- ark-libs | ||
- filelight | ||
- gwenview | ||
- gwenview-libs | ||
- kate | ||
- kate-plugins | ||
- kcalc | ||
- kfind | ||
- okular | ||
modules: | ||
|
||
- type: rpm-ostree | ||
# install: | ||
# - ksystemlog | ||
remove: | ||
- ark | ||
- ark-libs | ||
- filelight | ||
- gwenview | ||
- gwenview-libs | ||
- kate | ||
- kate-plugins | ||
- kcalc | ||
- kfind | ||
- okular | ||
|
||
- type: flatpaks | ||
system: | ||
install: | ||
- org.kde.ark | ||
- org.kde.filelight | ||
- org.kde.gwenview | ||
- org.kde.haruna | ||
- org.kde.kalk | ||
- org.kde.kclock | ||
- org.kde.kfind | ||
- org.kde.kweather | ||
- org.kde.kwrite | ||
- org.kde.okular | ||
- org.mozilla.firefox | ||
- com.borgbase.Vorta | ||
- com.github.tchx84.Flatseal | ||
- org.gnome.Logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Tell build process to exit if there are any errors. | ||
set -oue pipefail | ||
|
||
SYS_INSTALL_LIST=/usr/etc/flatpak/system-install | ||
SYS_REMOVE_LIST=/usr/etc/flatpak/system-remove | ||
USER_INSTALL_LIST=/usr/etc/flatpak/user-install | ||
USER_REMOVE_LIST=/usr/etc/flatpak/user-remove | ||
|
||
echo "Enabling flatpaks module" | ||
systemctl enable system-flatpak-setup.service | ||
systemctl enable --global user-flatpak-setup.service | ||
mkdir -p /usr/etc/flatpak | ||
|
||
get_yaml_array SYSTEM_INSTALL '.system.install[]' "$1" | ||
get_yaml_array SYSTEM_REMOVE '.system.remove[]' "$1" | ||
get_yaml_array USER_INSTALL '.user.install[]' "$1" | ||
get_yaml_array USER_REMOVE '.user.remove[]' "$1" | ||
|
||
echo "Creating system Flatpak install list" | ||
if [[ ${#SYSTEM_INSTALL[@]} -gt 0 ]]; then | ||
rm -f $SYS_INSTALL_LIST && touch $SYS_INSTALL_LIST | ||
for flatpak in "${SYSTEM_INSTALL[@]}"; do | ||
echo "Adding to system flatpak installs: $(printf ${flatpak})" | ||
echo $flatpak >> $SYS_INSTALL_LIST | ||
done | ||
fi | ||
|
||
echo "Creating system Flatpak removals list" | ||
if [[ ${#SYSTEM_REMOVE[@]} -gt 0 ]]; then | ||
rm -f $SYS_REMOVE_LIST && touch $SYS_REMOVE_LIST | ||
for flatpak in "${SYSTEM_REMOVE[@]}"; do | ||
echo "Adding to system flatpak removals: $(printf ${flatpak})" | ||
echo $flatpak >> $SYS_REMOVE_LIST | ||
done | ||
fi | ||
|
||
echo "Creating user Flatpak install list" | ||
if [[ ${#USER_INSTALL[@]} -gt 0 ]]; then | ||
rm -f $USER_INSTALL_LIST && touch $USER_INSTALL_LIST | ||
for flatpak in "${USER_INSTALL[@]}"; do | ||
echo "Adding to user flatpak installs: $(printf ${flatpak})" | ||
echo $flatpak >> $USER_INSTALL_LIST | ||
done | ||
fi | ||
|
||
echo "Creating user Flatpak removals list" | ||
if [[ ${#USER_REMOVE[@]} -gt 0 ]]; then | ||
rm -f $USER_REMOVE_LIST && touch $USER_REMOVE_LIST | ||
for flatpak in "${USER_REMOVE[@]}"; do | ||
echo "Adding to user flatpak removals: $(printf ${flatpak})" | ||
echo $flatpak >> $USER_REMOVE_LIST | ||
done | ||
fi |