mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-02-21 09:39:49 +00:00
Merge pull request #1 from ublue-os/main
chore(ujust): Improve setup-virtualization user experience (#1237)
This commit is contained in:
commit
e6d229169a
@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Enable libvirtd service after reboot
|
||||||
|
After=local-fs.target
|
||||||
|
ConditionPathExists=/usr/lib/systemd/system/libvirtd.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
# TODO: Rewrite this whenever systemd allows to queue ephemeral commands for next boot without modifying kernel args
|
||||||
|
ExecStart=/usr/bin/bash -c "systemctl enable --now libvirtd; systemctl disable %n"
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
@ -41,29 +41,34 @@ setup-virtualization ACTION="":
|
|||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
if [[ "${OPTION,,}" =~ (^enable[[:space:]]virtualization|virt-on) ]]; then
|
if [[ "${OPTION,,}" =~ (^enable[[:space:]]virtualization|virt-on) ]]; then
|
||||||
virt_test=$(rpm-ostree status | grep -A 4 "●" | grep "virt-manager")
|
(
|
||||||
if [[ -z ${virt_test} ]]; then
|
virt_test=$(rpm-ostree status -v --jsonpath '.deployments[0].packages')
|
||||||
echo "Installing QEMU and virt-manager..."
|
if [[ ${virt_test} == *virt-manager* ]]; then
|
||||||
rpm-ostree install -y virt-manager edk2-ovmf qemu
|
echo "Installing QEMU and virt-manager..."
|
||||||
rpm-ostree kargs \
|
rpm-ostree install -y virt-manager edk2-ovmf qemu
|
||||||
--append-if-missing="kvm.ignore_msrs=1" \
|
rpm-ostree kargs \
|
||||||
--append-if-missing="kvm.report_ignored_msrs=0"
|
--append-if-missing="kvm.ignore_msrs=1" \
|
||||||
echo 'Please re-run "ujust setup-virtualization" after the reboot to enable libvirtd service'
|
--append-if-missing="kvm.report_ignored_msrs=0"
|
||||||
fi
|
sudo systemctl enable bazzite-libvirtd-setup.service \
|
||||||
elif [[ "${OPTION,,}" =~ (^disable[[:space:]]virtualization|virt-off) ]]; then
|
&& echo "libvirtd will be enabled at next reboot"
|
||||||
virt_test=$(rpm-ostree status | grep -A 4 "●" | grep "virt-manager")
|
echo 'Please reboot to apply changes'
|
||||||
if [[ ${virt_test} ]]; then
|
|
||||||
if [ "$(systemctl is-enabled libvirtd.service)" == "enabled" ]; then
|
|
||||||
echo "${red}Disabling${n} libvirtd before removal"
|
|
||||||
sudo systemctl disable --now libvirtd 2> /dev/null
|
|
||||||
fi
|
fi
|
||||||
echo "Removing QEMU and virt-manager..."
|
)
|
||||||
rpm-ostree remove -y virt-manager edk2-ovmf qemu
|
elif [[ "${OPTION,,}" =~ (^disable[[:space:]]virtualization|virt-off) ]]; then
|
||||||
rpm-ostree kargs \
|
if [ "$(systemctl is-enabled libvirtd.service)" == "enabled" ]; then
|
||||||
--delete-if-present="kvm.ignore_msrs=1" \
|
echo "${red}Disabling${n} libvirtd before removal"
|
||||||
--delete-if-present="kvm.report_ignored_msrs=0"
|
sudo systemctl disable --now libvirtd 2> /dev/null
|
||||||
echo 'Please re-run "ujust enable-virtualization" after the reboot to finish setup'
|
|
||||||
fi
|
fi
|
||||||
|
if [ "$(systemctl is-enabled bazzite-libvirtd-setup.service)" == "enabled" ]; then
|
||||||
|
echo "${red}Disabling${n} bazzite-libvirtd-setup"
|
||||||
|
sudo systemctl disable --now bazzite-libvirtd-setup.service 2> /dev/null
|
||||||
|
fi
|
||||||
|
echo "Removing QEMU and virt-manager..."
|
||||||
|
rpm-ostree remove -y virt-manager edk2-ovmf qemu
|
||||||
|
rpm-ostree kargs \
|
||||||
|
--delete-if-present="kvm.ignore_msrs=1" \
|
||||||
|
--delete-if-present="kvm.report_ignored_msrs=0"
|
||||||
|
echo 'Please reboot to apply changes'
|
||||||
elif [[ "${OPTION,,}" =~ (^enable[[:space:]]vfio|vfio-on) ]]; then
|
elif [[ "${OPTION,,}" =~ (^enable[[:space:]]vfio|vfio-on) ]]; then
|
||||||
# Check if we are running on a Steam Deck
|
# Check if we are running on a Steam Deck
|
||||||
if /usr/libexec/hwsupport/valve-hardware; then
|
if /usr/libexec/hwsupport/valve-hardware; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user