Skip to content

Commit

Permalink
Add systemd service to autostart Calamares, improve VM support
Browse files Browse the repository at this point in the history
  • Loading branch information
zstg committed Aug 18, 2024
1 parent 9957b59 commit a85ad83
Show file tree
Hide file tree
Showing 14 changed files with 208 additions and 11 deletions.
2 changes: 1 addition & 1 deletion airootfs/etc/calamares
10 changes: 10 additions & 0 deletions airootfs/etc/systemd/system/Calamares.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Start Calamares
After=graphical-session.target

[Service]
ExecStart=/usr/bin/sudo -E /usr/bin/calamares -D8
Restart=on-failure

[Install]
WantedBy=default.target
1 change: 1 addition & 0 deletions airootfs/etc/systemd/system/pacman-init.service
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/pacman-key --init
ExecStart=/usr/bin/pacman-key --populate
ExecStart=/usr/bin/pacman -Sy

[Install]
WantedBy=multi-user.target
4 changes: 0 additions & 4 deletions airootfs/etc/xdg/autostart/Calamares.desktop

This file was deleted.

4 changes: 0 additions & 4 deletions airootfs/etc/xdg/autostart/custom.desktop

This file was deleted.

10 changes: 10 additions & 0 deletions airootfs/usr/lib/systemd/system/ucode.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Start Calamares
After=graphical-session.target

[Service]
ExecStart=/usr/local/bin/ucode
Restart=on-failure

[Install]
WantedBy=default.target
10 changes: 10 additions & 0 deletions airootfs/usr/lib/systemd/system/virtual-machine-check.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Start Calamares
After=graphical-session.target

[Service]
ExecStart=/usr/local/bin/vcheck
Restart=on-failure

[Install]
WantedBy=default.target
1 change: 1 addition & 0 deletions airootfs/usr/local/bin/StratOS-configure-bedrock
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ echo "Setting up Bedrock!"
# curl -sSL https://github.com/bedrocklinux/bedrocklinux-userland/releases/download/0.7.29/bedrock-linux-0.7.29-x86_64.sh > ./install-bedrock
echo 'Not reversible!' | bash /usr/local/bin/install-bedrock-x86_64 --hijack
rm -f /etc/systemd/system/getty@tty1.service.d/autologin.conf # don't autologin as stratos anymore
rm -f /etc/systemd/system/multi-user.target.wants/Calamares.service /etc/systemd/system/Calamares.service 2>/dev/null # it will NOT run post-install anyways
Empty file modified airootfs/usr/local/bin/StratOS-install-apt
100644 → 100755
Empty file.
21 changes: 21 additions & 0 deletions airootfs/usr/local/bin/ucode
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
#set -e
###############################################################################
# Author : DarkXero
# Website : https://xerolinux.xyz
###############################################################################

cpu_vendor=$(cat /proc/cpuinfo | awk '/vendor_id/ {print $3}' | head -n 1)

if [[ "$cpu_vendor" == "GenuineIntel" ]]; then
echo "Intel CPU detected."
sudo pacman -Rdd --noconfirm amd-ucode
elif [[ "$cpu_vendor" == "AuthenticAMD" ]]; then
echo "AMD CPU detected."
sudo pacman -Rdd --noconfirm intel-ucode
else
echo "Unknown CPU vendor: $cpu_vendor"
sudo pacman -Rdd --noconfirm intel-ucode amd-ucode
fi

rm /usr/local/bin/ucode
149 changes: 149 additions & 0 deletions airootfs/usr/local/bin/vcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
#!/bin/bash
#set -e
###############################################################################
# Author : DarkXero
# Website : https://xerolinux.xyz
###############################################################################
#
# DO NOT JUST RUN THIS. EXAMINE AND JUDGE. RUN AT YOUR OWN RISK.
#
###############################################################################

result=$(systemd-detect-virt)

while [ -e "/var/lib/pacman/db.lck" ];
do
echo 'Pacman is not ready yet. Will try again in 5 seconds.'
seconds=$(($seconds + 5))
sleep 5
if [[ "$seconds" == "30" ]]; then
echo 'Warning: removing pacman db.lck!'
rm /var/lib/pacman/db.lck
fi
done

echo "You are working on "$result

if [ $result = "oracle" ];
then
#remove vmware
if pacman -Qi open-vm-tools &> /dev/null; then
systemctl disable vmtoolsd.service
echo "Disabled vmtoolsd.service"
pacman -Rns open-vm-tools --noconfirm
echo "Removed open-vm-tools"
fi

if pacman -Qi xf86-video-vmware &> /dev/null; then
pacman -Rns xf86-video-vmware --noconfirm
echo "Removed xf86-video-vmware"
fi

if [ -f /etc/systemd/system/multi-user.target.wants/vmtoolsd.service ]; then
rm /etc/systemd/system/multi-user.target.wants/vmtoolsd.service
echo "Removed vmtoolsd.service if still exists"
fi

#remove qemu
if pacman -Qi qemu-guest-agent &> /dev/null; then
systemctl disable qemu-guest-agent.service
pacman -Rns qemu-guest-agent --noconfirm
echo "Removed qemu-guest-agent"
fi
fi

if [ $result = "kvm" ];
then
#remove vmware
if pacman -Qi open-vm-tools &> /dev/null; then
systemctl disable vmtoolsd.service
echo "Disabled vmtoolsd.service"
pacman -Rns open-vm-tools --noconfirm
echo "Removed open-vm-tools"
fi

if pacman -Qi xf86-video-vmware &> /dev/null; then
pacman -Rns xf86-video-vmware --noconfirm
echo "Removed xf86-video-vmware"
fi

if [ -f /etc/systemd/system/multi-user.target.wants/vmtoolsd.service ]; then
rm /etc/systemd/system/multi-user.target.wants/vmtoolsd.service
echo "Removed vmtoolsd.service if still exists"
fi

#remove virtualbox
if pacman -Qi virtualbox-guest-utils &> /dev/null; then
systemctl disable vboxservice.service
pacman -Rns virtualbox-guest-utils --noconfirm
echo "Removed virtualbox-guest-utils"
fi
if pacman -Qi virtualbox-guest-utils-nox &> /dev/null; then
systemctl disable vboxservice.service
pacman -Rns virtualbox-guest-utils-nox --noconfirm
echo "Removed virtualbox-guest-utils-nox"
fi
fi

if [ $result = "vmware" ];
then
#remove virtualbox
if pacman -Qi virtualbox-guest-utils &> /dev/null; then
systemctl disable vboxservice.service
pacman -Rns virtualbox-guest-utils --noconfirm
echo "Removed virtualbox-guest-utils"
fi
if pacman -Qi virtualbox-guest-utils-nox &> /dev/null; then
systemctl disable vboxservice.service
pacman -Rns virtualbox-guest-utils-nox --noconfirm
echo "Removed virtualbox-guest-utils-nox"
fi

#remove qemu
if pacman -Qi qemu-guest-agent &> /dev/null; then
systemctl disable qemu-guest-agent.service
pacman -Rns qemu-guest-agent --noconfirm
echo "Removed qemu-guest-agent"
fi
fi

if [ $result = "none" ];
then
#remove virtualbox
if pacman -Qi virtualbox-guest-utils &> /dev/null; then
systemctl disable vboxservice.service
pacman -Rns virtualbox-guest-utils --noconfirm
echo "Removed virtualbox-guest-utils"
fi

if pacman -Qi virtualbox-guest-utils-nox &> /dev/null; then
systemctl disable vboxservice.service
pacman -Rns virtualbox-guest-utils-nox --noconfirm
echo "Removed virtualbox-guest-utils-nox"
fi

#remove vmware
if pacman -Qi open-vm-tools &> /dev/null; then
systemctl disable vmtoolsd.service
echo "Disabled vmtoolsd.service"
pacman -Rns open-vm-tools --noconfirm
echo "Removed open-vm-tools"
fi

if pacman -Qi xf86-video-vmware &> /dev/null; then
pacman -Rns xf86-video-vmware --noconfirm
echo "Removed xf86-video-vmware"
fi

if [ -f /etc/systemd/system/multi-user.target.wants/vmtoolsd.service ]; then
rm /etc/systemd/system/multi-user.target.wants/vmtoolsd.service
echo "Removed vmtoolsd.service if still exists"
fi

#remove qemu
if pacman -Qi qemu-guest-agent &> /dev/null; then
systemctl disable qemu-guest-agent.service
pacman -Rns qemu-guest-agent --noconfirm
echo "Removed qemu-guest-agent"
fi
fi
5 changes: 3 additions & 2 deletions profiledef.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ file_permissions=(
["/usr/local/bin/neofetch"]="0:0:777"
["/usr/local/bin/install-using-pacman"]="0:0:777"
["/usr/local/bin/install-using-yay"]="0:0:777"
["/usr/local/bin/install-using-flatpak"]="0:0:777"
["/usr/local/bin/StratOS-install-apt"]="0:0:777"
["/usr/local/bin/StratOS-choose-atril"]="0:0:777"
["/usr/local/bin/StratOS-choose-brave"]="0:0:777"
["/usr/local/bin/StratOS-choose-chromium"]="0:0:777"
["/usr/local/bin/StratOS-choose-evince"]="0:0:777"
["/usr/local/bin/StratOS-choose-firefox"]="0:0:777"
Expand All @@ -51,4 +50,6 @@ file_permissions=(
["/usr/local/bin/StratOS-configure-gnome"]="0:0:777"
["/usr/local/bin/StratOS-configure-theme"]="0:0:777"
["/usr/local/bin/StratOS-configure-ubuntu"]="0:0:777"
["/usr/local/bin/ucode"]="0:0:777"
["/usr/local/bin/vcheck"]="0:0:777"
)

0 comments on commit a85ad83

Please sign in to comment.