forked from ChrisTitusTech/linutil
-
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.
Merge branch 'main' into skip-confirmation
- Loading branch information
Showing
24 changed files
with
577 additions
and
77 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,33 @@ | ||
#!/bin/sh -e | ||
|
||
. ../common-script.sh | ||
|
||
installPodmanCompose() { | ||
if ! command_exists podman-compose; then | ||
printf "%b\n" "${YELLOW}Installing Podman Compose...${RC}" | ||
case "$PACKAGER" in | ||
apt-get|nala) | ||
"$ESCALATION_TOOL" "$PACKAGER" install -y podman-compose | ||
;; | ||
zypper) | ||
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install podman-compose | ||
;; | ||
pacman) | ||
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm --needed podman-compose | ||
;; | ||
dnf) | ||
"$ESCALATION_TOOL" "$PACKAGER" install -y podman-compose | ||
;; | ||
*) | ||
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}" | ||
exit 1 | ||
;; | ||
esac | ||
else | ||
printf "%b\n" "${GREEN}Podman Compose is already installed.${RC}" | ||
fi | ||
} | ||
|
||
checkEnv | ||
checkEscalationTool | ||
installPodmanCompose |
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,33 @@ | ||
#!/bin/sh -e | ||
|
||
. ../common-script.sh | ||
|
||
installPodman() { | ||
if ! command_exists podman; then | ||
printf "%b\n" "${YELLOW}Installing Podman...${RC}" | ||
case "$PACKAGER" in | ||
apt-get|nala) | ||
"$ESCALATION_TOOL" "$PACKAGER" install -y podman | ||
;; | ||
zypper) | ||
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install podman | ||
;; | ||
pacman) | ||
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm --needed podman | ||
;; | ||
dnf) | ||
"$ESCALATION_TOOL" "$PACKAGER" install -y podman | ||
;; | ||
*) | ||
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}" | ||
exit 1 | ||
;; | ||
esac | ||
else | ||
printf "%b\n" "${GREEN}Podman is already installed.${RC}" | ||
fi | ||
} | ||
|
||
checkEnv | ||
checkEscalationTool | ||
installPodman |
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,60 @@ | ||
#!/bin/sh -e | ||
|
||
. ../../common-script.sh | ||
|
||
setUpRepos() { | ||
if ! grep -q "^\s*\[jupiter-staging\]" /etc/pacman.conf; then | ||
printf "%b\n" "${CYAN}Adding jupiter-staging to pacman repositories...${RC}" | ||
echo "[jupiter-staging]" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf | ||
echo "Server = https://steamdeck-packages.steamos.cloud/archlinux-mirror/\$repo/os/\$arch" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf | ||
echo "SigLevel = Never" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf | ||
fi | ||
if ! grep -q "^\s*\[holo-staging\]" /etc/pacman.conf; then | ||
printf "%b\n" "${CYAN}Adding holo-staging to pacman repositories...${RC}" | ||
echo "[holo-staging]" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf | ||
echo "Server = https://steamdeck-packages.steamos.cloud/archlinux-mirror/\$repo/os/\$arch" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf | ||
echo "SigLevel = Never" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf | ||
fi | ||
} | ||
|
||
installKernel() { | ||
if ! "$PACKAGER" -Q | grep -q "\blinux-neptune"; then | ||
printf "%b\n" "${CYAN}Installing linux-neptune..." | ||
"$ESCALATION_TOOL" "$PACKAGER" -Syyu --noconfirm | ||
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm linux-neptune linux-neptune-headers steamdeck-dsp jupiter-staging/alsa-ucm-conf | ||
"$ESCALATION_TOOL" mkinitcpio -P | ||
else | ||
printf "%b\n" "${GREEN}linux-neptune detected. Skipping installation.${RC}" | ||
fi | ||
|
||
if [ -f /etc/default/grub ]; then | ||
printf "%b\n" "${CYAN}Updating GRUB...${RC}" | ||
if ! grep -q '^UPDATEDEFAULT=' /etc/default/grub; then | ||
echo 'UPDATEDEFAULT=yes' | "$ESCALATION_TOOL" tee -a /etc/default/grub | ||
else | ||
"$ESCALATION_TOOL" sed -i 's/^UPDATEDEFAULT=.*/UPDATEDEFAULT=yes/' /etc/default/grub | ||
fi | ||
if [ -f /boot/grub/grub.cfg ]; then | ||
"$ESCALATION_TOOL" grub-mkconfig -o /boot/grub/grub.cfg | ||
else | ||
printf "%b\n" "${RED}GRUB configuration file not found. Run grub-mkconfig manually.${RC}" | ||
fi | ||
else | ||
printf "%b\n" "${RED}GRUB not detected. Manually set your bootloader to use linux-neptune.${RC}" | ||
fi | ||
} | ||
|
||
copyFirmwareFiles() { | ||
printf "%b\n" "${CYAN}Copying firmware files...${RC}" | ||
"$ESCALATION_TOOL" mkdir -p /usr/lib/firmware/cirrus | ||
"$ESCALATION_TOOL" cp /usr/lib/firmware/cs35l41-dsp1-spk-cali.bin /usr/lib/firmware/cirrus/ | ||
"$ESCALATION_TOOL" cp /usr/lib/firmware/cs35l41-dsp1-spk-cali.wmfw /usr/lib/firmware/cirrus/ | ||
"$ESCALATION_TOOL" cp /usr/lib/firmware/cs35l41-dsp1-spk-prot.bin /usr/lib/firmware/cirrus/ | ||
"$ESCALATION_TOOL" cp /usr/lib/firmware/cs35l41-dsp1-spk-prot.wmfw /usr/lib/firmware/cirrus/ | ||
} | ||
|
||
checkEnv | ||
checkEscalationTool | ||
setUpRepos | ||
installKernel | ||
copyFirmwareFiles |
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,120 @@ | ||
#!/bin/sh -e | ||
|
||
. ../../common-script.sh | ||
|
||
LIBVA_DIR="$HOME/.local/share/linutil/libva" | ||
MPV_CONF="$HOME/.config/mpv/mpv.conf" | ||
|
||
installDeps() { | ||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel dkms ninja meson git | ||
|
||
installed_kernels=$("$PACKAGER" -Q | grep -E '^linux(| |-rt|-rt-lts|-hardened|-zen|-lts)[^-headers]' | cut -d ' ' -f 1) | ||
|
||
for kernel in $installed_kernels; do | ||
header="${kernel}-headers" | ||
printf "%b\n" "${CYAN}Installing headers for $kernel...${RC}" | ||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$header" | ||
done | ||
} | ||
|
||
checkNvidiaHardware() { | ||
# Refer https://nouveau.freedesktop.org/CodeNames.html for model code names | ||
model=$(lspci -k | grep -A 2 -E "(VGA|3D)" | grep NVIDIA | sed 's/.*Corporation //;s/ .*//' | cut -c 1-2) | ||
case "$model" in | ||
GM | GP | GV) return 1 ;; | ||
TU | GA | AD) return 0 ;; | ||
*) printf "%b\n" "${RED}Unsupported hardware." && exit 1 ;; | ||
esac | ||
} | ||
|
||
checkIntelHardware() { | ||
model=$(grep "model name" /proc/cpuinfo | head -n 1 | cut -d ':' -f 2 | cut -c 2-3) | ||
[ "$model" -ge 11 ] | ||
} | ||
|
||
promptUser() { | ||
printf "%b" "Do you want to $1 ? [y/N]:" | ||
read -r confirm | ||
[ "$confirm" = "y" ] || [ "$confirm" = "Y" ] | ||
} | ||
|
||
setKernelParam() { | ||
PARAMETER="$1" | ||
|
||
if grep -q "$PARAMETER" /etc/default/grub; then | ||
printf "%b\n" "${YELLOW}NVIDIA modesetting is already enabled in GRUB.${RC}" | ||
else | ||
"$ESCALATION_TOOL" sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT=/ s/\"$/ $PARAMETER\"/" /etc/default/grub | ||
printf "%b\n" "${CYAN}Added $PARAMETER to /etc/default/grub.${RC}" | ||
"$ESCALATION_TOOL" grub-mkconfig -o /boot/grub/grub.cfg | ||
fi | ||
} | ||
|
||
setupHardwareAcceleration() { | ||
if ! command_exists grub-mkconfig; then | ||
printf "%b\n" "${RED}Currently hardware acceleration is only available with GRUB.${RC}" | ||
return | ||
fi | ||
|
||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libva-nvidia-driver | ||
|
||
mkdir -p "$HOME/.local/share/linutil" | ||
if [ -d "$LIBVA_DIR" ]; then | ||
rm -rf "$LIBVA_DIR" | ||
fi | ||
|
||
printf "%b\n" "${YELLOW}Cloning libva from https://github.com/intel/libva in ${LIBVA_DIR}${RC}" | ||
git clone --branch=v2.22-branch --depth=1 https://github.com/intel/libva "$LIBVA_DIR" | ||
|
||
mkdir -p "$LIBVA_DIR/build" | ||
cd "$LIBVA_DIR/build" && arch-meson .. -Dwith_legacy=nvctrl && ninja | ||
"$ESCALATION_TOOL" ninja install | ||
|
||
"$ESCALATION_TOOL" sed -i '/^MOZ_DISABLE_RDD_SANDBOX/d' "/etc/environment" | ||
"$ESCALATION_TOOL" sed -i '/^LIBVA_DRIVER_NAME/d' "/etc/environment" | ||
|
||
printf "LIBVA_DRIVER_NAME=nvidia\nMOZ_DISABLE_RDD_SANDBOX=1" | "$ESCALATION_TOOL" tee -a /etc/environment >/dev/null | ||
|
||
printf "%b\n" "${GREEN}Hardware Acceleration setup completed successfully.${RC}" | ||
|
||
if promptUser "enable Hardware Acceleration in MPV player"; then | ||
mkdir -p "$HOME/.config/mpv" | ||
if [ -f "$MPV_CONF" ]; then | ||
sed -i '/^hwdec/d' "$MPV_CONF" | ||
fi | ||
printf "hwdec=auto" | tee -a "$MPV_CONF" >/dev/null | ||
printf "%b\n" "${GREEN}MPV Hardware Acceleration enabled successfully.${RC}" | ||
fi | ||
} | ||
|
||
installDriver() { | ||
# Refer https://wiki.archlinux.org/title/NVIDIA for open-dkms or dkms driver selection | ||
if checkNvidiaHardware && promptUser "install nvidia's open source drivers"; then | ||
printf "%b\n" "${YELLOW}Installing nvidia open source driver...${RC}" | ||
installDeps | ||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-open-dkms nvidia-utils | ||
else | ||
printf "%b\n" "${YELLOW}Installing nvidia proprietary driver...${RC}" | ||
installDeps | ||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-dkms nvidia-utils | ||
fi | ||
|
||
if checkIntelHardware; then | ||
setKernelParam "ibt=off" | ||
fi | ||
|
||
# Refer https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Preserve_video_memory_after_suspend | ||
setKernelParam "nvidia.NVreg_PreserveVideoMemoryAllocations=1" | ||
"$ESCALATION_TOOL" systemctl enable nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service | ||
|
||
printf "%b\n" "${GREEN}Driver installed successfully.${RC}" | ||
if promptUser "setup Hardware Acceleration"; then | ||
setupHardwareAcceleration | ||
fi | ||
|
||
printf "%b\n" "${GREEN}Please reboot your system for the changes to take effect.${RC}" | ||
} | ||
|
||
checkEnv | ||
checkEscalationTool | ||
installDriver |
Oops, something went wrong.