mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-02-19 21:40:57 +00:00
chore: Add new script to set rebase branch, allow use with polkit and execute from os-branch-select.
This commit is contained in:
parent
e18fd84e3b
commit
2c55fdd84a
16
system_files/deck/shared/usr/libexec/os-branch-select
Normal file → Executable file
16
system_files/deck/shared/usr/libexec/os-branch-select
Normal file → Executable file
@ -1,13 +1,15 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
|
||||
IMAGE_REF=$(jq -r '."image-ref"' < $IMAGE_INFO)
|
||||
|
||||
if [[ $# -eq 1 ]]; then
|
||||
case "$1" in
|
||||
"-c")
|
||||
branch=$(cut -d ":" -f4 <<< "$(rpm-ostree status | grep -m 1 'bazzite')")
|
||||
if [[ -f /var/ublue-update/branch ]]; then
|
||||
branch=$(cat /var/ublue-update/branch)
|
||||
else
|
||||
branch=$(cut -d ":" -f4 <<< "$(rpm-ostree status | grep -m 1 'bazzite')")
|
||||
fi
|
||||
|
||||
case "$branch" in
|
||||
"latest" | "testing" | "unstable")
|
||||
echo "$branch"
|
||||
@ -28,14 +30,14 @@ if [[ $# -eq 1 ]]; then
|
||||
echo unstable
|
||||
exit 0
|
||||
;;
|
||||
"latest" | "testing" | "unstable")
|
||||
/usr/bin/rpm-ostree rebase "$IMAGE_REF":"$1"
|
||||
"latest" | "testing")
|
||||
/usr/bin/pkexec /usr/libexec/ublue-update-rebase "$1"
|
||||
exit 0
|
||||
;;
|
||||
"unstable")
|
||||
echo "The unstable branch has a high risk of breaking."
|
||||
echo "Do NOT use it unless you know what you are doing."
|
||||
/usr/bin/rpm-ostree rebase "$IMAGE_REF":"$1"
|
||||
/usr/bin/pkexec /usr/libexec/ublue-update-rebase "$1"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
4
system_files/deck/shared/usr/libexec/ublue-update-rebase
Executable file
4
system_files/deck/shared/usr/libexec/ublue-update-rebase
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "$1" | sudo tee -a /var/ublue-update/branch > /dev/null
|
@ -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.rebase.pkexec">
|
||||
<description>Set desired branch for ublue-update rebase</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/libexec/ublue-update-rebase</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
@ -0,0 +1,6 @@
|
||||
polkit.addRule(function(action, subject) {
|
||||
if ((action.id == "org.bazzite.rebase.pkexec") &&
|
||||
subject.isInGroup("wheel")) {
|
||||
return polkit.Result.YES;
|
||||
}
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user