mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-02-21 00:40:01 +00:00
chore: Move flathub setup to separate script, run with pkexec
This commit is contained in:
parent
673086cc51
commit
5c902473b4
7
system_files/desktop/shared/usr/bin/bazzite-flathub-setup
Executable file
7
system_files/desktop/shared/usr/bin/bazzite-flathub-setup
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if grep -qz 'fedora' <<< $(flatpak remotes); then
|
||||
flatpak remote-delete --user fedora --force
|
||||
fi
|
||||
flatpak remote-add --if-not-exists --user flathub /etc/flatpak/remotes.d/flathub.flatpakrepo
|
||||
flatpak remote-modify --user --enable flathub
|
@ -132,11 +132,7 @@ fi
|
||||
timedatectl set-ntp true
|
||||
|
||||
# Setup Flathub
|
||||
if grep -qz 'fedora' <<< $(flatpak remotes); then
|
||||
flatpak remote-delete --user fedora --force
|
||||
fi
|
||||
flatpak remote-add --if-not-exists --user flathub /etc/flatpak/remotes.d/flathub.flatpakrepo
|
||||
flatpak remote-modify --user --enable flathub
|
||||
pkexec /usr/bin/bazzite-flathub-setup
|
||||
|
||||
# Prevent future executions
|
||||
echo "Writing state file"
|
||||
|
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
|
||||
<vendor>Bazzite</vendor>
|
||||
<vendor_url>https://github.com/ublue-os/bazzite/</vendor_url>
|
||||
|
||||
<action id="org.bazzite.policykit.flathub.setup">
|
||||
<description>Enables the flathub user repository automatically</description>
|
||||
<icon_name>package-x-generic</icon_name>
|
||||
<defaults>
|
||||
<allow_any>yes</allow_any>
|
||||
<allow_inactive>yes</allow_inactive>
|
||||
<allow_active>yes</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/bazzite-flathub-setup</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
@ -0,0 +1,6 @@
|
||||
polkit.addRule(function(action, subject) {
|
||||
if ((action.id == "org.bazzite.policykit.flathub.setup") &&
|
||||
subject.isInGroup("wheel")) {
|
||||
return polkit.Result.YES;
|
||||
}
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user