diff --git a/.github/workflows/image-arch-linux-stable.yml b/.github/workflows/image-arch-linux-stable.yml
index d916d60..2ba75e2 100644
--- a/.github/workflows/image-arch-linux-stable.yml
+++ b/.github/workflows/image-arch-linux-stable.yml
@@ -21,13 +21,16 @@ jobs:
- name: Change directory
run: cd $GITHUB_WORKSPACE
- name: Install Bash
- run: sudo apt-get update && sudo apt-get install -y bash
+ run: sudo apt-get update && sudo apt-get install -y bash shellcheck
- name: Check syntax of scripts
run: |
- for i in $(find . -name "*.sh")
- do bash -n "${i}"
- if [ $? -ne 0 ]
- then exit 1
+ for i in $(find . -name "*.sh" | sort)
+ do echo "${i}"
+ if ! bash -n "${i}"; then
+ exit 1
+ fi
+ if ! shellcheck "${i}"; then
+ exit 1
fi
done
- name: Obtain base docker image
diff --git a/.github/workflows/image-arch-linux.yml b/.github/workflows/image-arch-linux.yml
index 4de5527..7eacb2d 100644
--- a/.github/workflows/image-arch-linux.yml
+++ b/.github/workflows/image-arch-linux.yml
@@ -24,13 +24,16 @@ jobs:
- name: Change directory
run: cd $GITHUB_WORKSPACE
- name: Install Bash
- run: sudo apt-get update && sudo apt-get install -y bash
+ run: sudo apt-get update && sudo apt-get install -y bash shellcheck
- name: Check syntax of scripts
run: |
- for i in $(find . -name "*.sh")
- do bash -n "${i}"
- if [ $? -ne 0 ]
- then exit 1
+ for i in $(find . -name "*.sh" | sort)
+ do echo "${i}"
+ if ! bash -n "${i}"; then
+ exit 1
+ fi
+ if ! shellcheck "${i}"; then
+ exit 1
fi
done
- name: Obtain base docker image
diff --git a/.github/workflows/image-manjaro.yml b/.github/workflows/image-manjaro.yml
index 0cbbaf5..039227d 100644
--- a/.github/workflows/image-manjaro.yml
+++ b/.github/workflows/image-manjaro.yml
@@ -24,13 +24,16 @@ jobs:
- name: Change directory
run: cd $GITHUB_WORKSPACE
- name: Install Bash
- run: sudo apt-get update && sudo apt-get install -y bash
+ run: sudo apt-get update && sudo apt-get install -y bash shellcheck
- name: Check syntax of scripts
run: |
- for i in $(find . -name "*.sh")
- do bash -n "${i}"
- if [ $? -ne 0 ]
- then exit 1
+ for i in $(find . -name "*.sh" | sort)
+ do echo "${i}"
+ if ! bash -n "${i}"; then
+ exit 1
+ fi
+ if ! shellcheck "${i}"; then
+ exit 1
fi
done
- name: Obtain base docker image
diff --git a/git/hooks/pre-commit b/git/hooks/pre-commit
index 19d85e1..ce9a09c 100755
--- a/git/hooks/pre-commit
+++ b/git/hooks/pre-commit
@@ -1,8 +1,12 @@
-#!/bin/sh
+#!/bin/bash
-for i in $(find . -name "*.sh")
- do bash -n "${i}"
- if [ $? -ne 0 ]
- then exit 1
+# 'find' does not always return results in the same order so it needs to be 'sort'ed.
+for i in $(find . -name "*.sh" | sort)
+ do echo "${i}"
+ if ! bash -n "${i}"; then
+ exit 1
+ fi
+ if ! shellcheck "${i}"; then
+ exit 1
fi
done
diff --git a/rootfs/home/winesap/.winesapos/winesapos-upgrade-remote-stable.sh b/rootfs/home/winesap/.winesapos/winesapos-upgrade-remote-stable.sh
index 2138ad9..bfcd360 100755
--- a/rootfs/home/winesap/.winesapos/winesapos-upgrade-remote-stable.sh
+++ b/rootfs/home/winesap/.winesapos/winesapos-upgrade-remote-stable.sh
@@ -2,8 +2,7 @@
set -x
-kdialog --title "winesapOS Upgrade" --yesno "Do you want to upgrade winesapOS?\nThis may take a long time."
-if [ $? -eq 0 ]; then
+if kdialog --title "winesapOS Upgrade" --yesno "Do you want to upgrade winesapOS?\nThis may take a long time."; then
# The secure image requires that the "sudo" password be provided for the "winesap" user.
# This password is also required to be reset during the first login so it is unknown.
# Prompt the user to enter in their password.
@@ -11,13 +10,12 @@ if [ $? -eq 0 ]; then
# the command "sudo -S" to read the password from standard input still works as expected.
while true;
do user_pw=$(kdialog --title "winesapOS Upgrade" --password 'Please enter your password (default: "winesap") to start the upgrade.')
- echo ${user_pw} | sudo -S whoami
- if [ $? -eq 0 ]; then
+ if echo "${user_pw}" | sudo -S whoami; then
# Break out of the "while" loop if the password works with the "sudo -S" command.
break 2
fi
done
- echo ${USER} > /tmp/winesapos_user_name.txt
+ echo "${USER}" > /tmp/winesapos_user_name.txt
curl https://raw.githubusercontent.com/winesapOS/winesapOS/stable/scripts/winesapos-upgrade.sh | sudo -E bash
fi
diff --git a/rootfs/usr/local/bin/winesapos-dual-boot.sh b/rootfs/usr/local/bin/winesapos-dual-boot.sh
index c778706..2fdb42b 100755
--- a/rootfs/usr/local/bin/winesapos-dual-boot.sh
+++ b/rootfs/usr/local/bin/winesapos-dual-boot.sh
@@ -1,31 +1,30 @@
#!/bin/bash
+# shellcheck disable=SC2010
echo -e "winesapOS Dual-Boot Installer (Beta)\n"
echo "Please read the full instructions first at: https://github.com/winesapOS/winesapOS?tab=readme-ov-file#dual-boot"
echo "USE AT YOUR OWN RISK! DATA LOSS IS POSSIBLE. CLOSE THIS WINDOW IF YOU DO NOT ACCEPT THE RISK. OTHERWISE, ENTER ANY KEY TO COTINUE."
-read -p ""
+read -r -p ""
-export WINESAPOS_IMAGE_TYPE="$(grep VARIANT_ID /usr/lib/os-release-winesapos | cut -d = -f 2)"
+WINESAPOS_IMAGE_TYPE="$(grep VARIANT_ID /usr/lib/os-release-winesapos | cut -d = -f 2)"
if [[ "${WINESAPOS_IMAGE_TYPE}" == "secure" ]]; then
echo "INFO: Enter the root password when prompted..."
sudo whoami
fi
echo "INFO: Determining the correct device name..."
-ls -1 /dev/disk/by-label/winesapos-root0 &> /dev/null
-if [ $? -eq 0 ]; then
+if ls -1 /dev/disk/by-label/winesapos-root0 &> /dev/null; then
echo "INFO: Partition with label 'winesapos-root0' found."
root_partition=$(ls -l /dev/disk/by-label/winesapos-root0 | grep -o -P "(hdd|mmcblk|nvme|sd).+")
echo "DEBUG: Partition name is ${root_partition}."
- echo ${root_partition} | grep -q nvme
- if [ $? -eq 0 ]; then
- root_device=$(echo ${root_partition} | grep -P -o "/dev/nvme[0-9]+n[0-9]+")
+ if echo "${root_partition}" | grep -q nvme; then
+ root_device=$(echo "${root_partition}" | grep -P -o "/dev/nvme[0-9]+n[0-9]+")
else
- echo ${root_partition} | grep -q mmcblk
- if [ $? -eq 0 ]; then
- root_device=$(echo ${root_partition} | grep -P -o "/dev/mmcblk[0-9]+")
+ if echo "${root_partition}" | grep -q mmcblk; then
+ root_device=$(echo "${root_partition}" | grep -P -o "/dev/mmcblk[0-9]+")
else
- root_device=$(echo ${root_partition} | sed s'/[0-9]//'g)
+ # shellcheck disable=SC2001 disable=SC2026
+ root_device=$(echo "${root_partition}" | sed s'/[0-9]//'g)
fi
fi
echo "DEBUG: Root device name is ${root_device}."
@@ -35,19 +34,17 @@ else
fi
-lsblk --raw -o name,label | grep -q WOS-EFI0
-if [ $? -eq 0 ]; then
+if lsblk --raw -o name,label | grep -q WOS-EFI0; then
echo "INFO: EFI partition label WOS-EFI0 found."
efi_partition="/dev/disk/by-label/WOS-EFI0"
else
- efi_partition=$(sudo fdisk -l /dev/${root_device} | grep "EFI System" | awk '{print $1}')
- echo ${efi_partition} | grep -q -o -P "(hdd|mmcblk|nvme|sd|).+"
- if [ $? -ne 0 ]; then
+ efi_partition=$(sudo fdisk -l "/dev/${root_device}" | grep "EFI System" | awk '{print $1}')
+ if ! echo "${efi_partition}" | grep -q -o -P "(hdd|mmcblk|nvme|sd|).+"; then
echo "ERROR: No EFI partition found."
exit 1
else
echo "INFO: Setting EFI label for a more reliable /etc/fstab later..."
- sudo fatlabel ${efi_partition} WOS-EFI0
+ sudo fatlabel "${efi_partition}" WOS-EFI0
fi
fi
echo "INFO: EFI partition name is ${efi_partition}."
@@ -70,10 +67,9 @@ winesapos_find_tarball() {
"/run/media/${USER}/wos-drive" \
"${HOME}/Desktop" \
"${HOME}/Downloads"; \
- do ls -1 "${i}" 2> /dev/null | grep -q -P ".+-minimal.rootfs.tar.zst$"
- if [ $? -eq 0 ]; then
+ do if ls -1 "${i}" 2> /dev/null | grep -q -P ".+-minimal.rootfs.tar.zst$"; then
echo "${i}/$(ls -1 "${i}" | grep -P ".+-minimal.rootfs.tar.zst$" | tail -n 1)"
- return 0
+ return 0
fi
done
echo "NONE"
@@ -85,9 +81,9 @@ winesapos_tarball="$(winesapos_find_tarball)"
if [[ "${winesapos_tarball}" == "NONE" ]]; then
echo "INFO: No winesapOS tarball found."
WINESAPOS_VERSION_LATEST="$(curl https://raw.githubusercontent.com/winesapOS/winesapOS/stable/files/os-release-winesapos | grep VERSION_ID | cut -d = -f 2)"
- cd "${HOME}/Downloads"
+ cd "${HOME}/Downloads" || exit 1
echo "INFO: Downloading the rootfs tarball..."
- wget https://winesapos.lukeshort.cloud/repo/iso/winesapos-${WINESAPOS_VERSION_LATEST}/winesapos-${WINESAPOS_VERSION_LATEST}-minimal-rootfs.tar.zst
+ wget "https://winesapos.lukeshort.cloud/repo/iso/winesapos-${WINESAPOS_VERSION_LATEST}/winesapos-${WINESAPOS_VERSION_LATEST}-minimal-rootfs.tar.zst"
winesapos_tarball="${HOME}/Downloads/winesapos-${WINESAPOS_VERSION_LATEST}-minimal-rootfs.tar.zst"
fi
diff --git a/rootfs/usr/local/bin/winesapos-mute.sh b/rootfs/usr/local/bin/winesapos-mute.sh
index 7ab2def..9fa2d0a 100755
--- a/rootfs/usr/local/bin/winesapos-mute.sh
+++ b/rootfs/usr/local/bin/winesapos-mute.sh
@@ -2,8 +2,7 @@
set -x
-sudo /usr/bin/dmidecode -s system-product-name | grep -P ^Mac
-if [ $? -eq 0 ]; then
+if sudo /usr/bin/dmidecode -s system-product-name | grep -P ^Mac; then
echo "Mac hardware detected."
/usr/bin/pactl set-sink-volume 0 0
diff --git a/rootfs/usr/local/bin/winesapos-resize-root-file-system.sh b/rootfs/usr/local/bin/winesapos-resize-root-file-system.sh
index 1be7930..c69fd40 100755
--- a/rootfs/usr/local/bin/winesapos-resize-root-file-system.sh
+++ b/rootfs/usr/local/bin/winesapos-resize-root-file-system.sh
@@ -9,41 +9,40 @@ if [[ "${root_partition}" == "/dev/mapper/cryptroot" ]]; then
# Example output: "mmcblk0p5", "nvme0n1p5", "sda5"
root_partition_shortname=$(lsblk -o name,label | grep winesapos-luks | awk '{print $1}' | grep -o -P '[a-z]+.*')
# Example output: 5
- root_partition_number=$(echo ${root_partition_shortname} | grep -o -P "[0-9]+$")
+ root_partition_number=$(echo "${root_partition_shortname}" | grep -o -P "[0-9]+$")
- echo ${root_partition} | grep -q nvme
- if [ $? -eq 0 ]; then
+ if echo "${root_partition}" | grep -q nvme; then
# Example output: /dev/nvme0n1
root_device=$(echo "/dev/${root_partition_shortname}" | grep -P -o "/dev/nvme[0-9]+n[0-9]+")
else
- echo ${root_partition} | grep -q mmcblk
- if [ $? -eq 0 ]; then
+ if echo "${root_partition}" | grep -q mmcblk; then
# Example output: /dev/mmcblk0
+ # shellcheck disable=SC2026
root_device=$(echo "/dev/${root_partition_shortname}" | grep -P -o "/dev/mmcblk[0-9]+")
else
# Example output: /dev/sda
+ # shellcheck disable=SC2026
root_device=$(echo "/dev/${root_partition_shortname}" | sed s'/[0-9]//'g)
fi
fi
- growpart ${root_device} ${root_partition_number}
- echo "password" | cryptsetup resize ${root_partition}
+ growpart "${root_device}" "${root_partition_number}"
+ echo "password" | cryptsetup resize "${root_partition}"
else
- root_partition_number=$(echo ${root_partition} | grep -o -P "[0-9]+$")
+ root_partition_number=$(echo "${root_partition}" | grep -o -P "[0-9]+$")
- echo ${root_partition} | grep -q nvme
- if [ $? -eq 0 ]; then
- root_device=$(echo ${root_partition} | grep -P -o "/dev/nvme[0-9]+n[0-9]+")
+ if echo "${root_partition}" | grep -q nvme; then
+ root_device=$(echo "${root_partition}" | grep -P -o "/dev/nvme[0-9]+n[0-9]+")
else
- echo ${root_partition} | grep -q mmcblk
- if [ $? -eq 0 ]; then
- root_device=$(echo ${root_partition} | grep -P -o "/dev/mmcblk[0-9]+")
+ if echo "${root_partition}" | grep -q mmcblk; then
+ root_device=$(echo "${root_partition}" | grep -P -o "/dev/mmcblk[0-9]+")
else
- root_device=$(echo ${root_partition} | sed s'/[0-9]//'g)
+ # shellcheck disable=SC2001 disable=SC2026
+ root_device=$(echo "${root_partition}" | sed s'/[0-9]//'g)
fi
fi
- growpart ${root_device} ${root_partition_number}
+ growpart "${root_device}" "${root_partition_number}"
fi
btrfs filesystem resize max /
diff --git a/rootfs/usr/local/bin/winesapos-sddm-health-check.sh b/rootfs/usr/local/bin/winesapos-sddm-health-check.sh
index fdc3f25..7eae03a 100755
--- a/rootfs/usr/local/bin/winesapos-sddm-health-check.sh
+++ b/rootfs/usr/local/bin/winesapos-sddm-health-check.sh
@@ -1,15 +1,14 @@
#!/bin/bash
while true
- do journalctl --unit sddm | grep -q "Could not start Display server on"
- if [ $? -eq 0 ]; then
+ do if journalctl --unit sddm | grep -q "Could not start Display server on"; then
echo "Display manager working NOT normally."
echo -e "winesapOS\n\nSDDM has failed to start. You are now in a TTY for troubleshooting.\nPossible causes might be a bad display server configuration or other graphical issues.\nYou can try to fix the issue here or reboot the system.\nFor more detailed logs, use \'journalctl -xe | grep sddm\'.\n\n" > /etc/issue
/usr/bin/chvt 2
- exit
+ exit
else
echo "Display manager working normally."
- echo -e "winesapOS\n\n" > /etc/issue
+ echo -e "winesapOS\n\n" > /etc/issue
fi
sleep 5s
done
diff --git a/rootfs/usr/local/bin/winesapos-ventoy-bootstrap.sh b/rootfs/usr/local/bin/winesapos-ventoy-bootstrap.sh
index 56d534f..74e3fd5 100755
--- a/rootfs/usr/local/bin/winesapos-ventoy-bootstrap.sh
+++ b/rootfs/usr/local/bin/winesapos-ventoy-bootstrap.sh
@@ -7,8 +7,9 @@ wget https://github.com/ventoy/vtoyboot/releases/download/v${VENTOY_VER}/vtoyboo
sudo mount vtoyboot-${VENTOY_VER}.iso /mnt
sudo mkdir /vtoyboot
sudo tar -xvf /mnt/vtoyboot-${VENTOY_VER}.tar.gz -C /vtoyboot
-cd /vtoyboot/vtoyboot-${VENTOY_VER}/
+cd /vtoyboot/vtoyboot-${VENTOY_VER}/ || exit 1
sudo ./vtoyboot.sh
+# shellcheck disable=SC2164
cd -
sudo umount /mnt
sudo rm -r -f /vtoyboot /vtoyboot-${VENTOY_VER}.iso
diff --git a/scripts/env/winesapos-env-chroot.sh b/scripts/env/winesapos-env-chroot.sh
index 35ea4b8..b723e16 100755
--- a/scripts/env/winesapos-env-chroot.sh
+++ b/scripts/env/winesapos-env-chroot.sh
@@ -1,3 +1,6 @@
-. "$(dirname $0)/winesapos-env-minimal.sh"
+#!/bin/bash
+
+# shellcheck disable=SC1091
+. "$(dirname "$0")/winesapos-env-minimal.sh"
export \
WINESAPOS_BUILD_CHROOT_ONLY=true
diff --git a/scripts/env/winesapos-env-defaults.sh b/scripts/env/winesapos-env-defaults.sh
index 71b4364..d182620 100755
--- a/scripts/env/winesapos-env-defaults.sh
+++ b/scripts/env/winesapos-env-defaults.sh
@@ -1,8 +1,11 @@
+#!/bin/bash
+
+winesapos_distro_detected=$(grep -P '^ID=' /etc/os-release | cut -d= -f2)
export \
WINESAPOS_IMAGE_TYPE="${WINESAPOS_IMAGE_TYPE:-performance}" \
WINESAPOS_INSTALL_DIR="${WINESAPOS_INSTALL_DIR:-/winesapos}" \
WINESAPOS_DISTRO="${WINESAPOS_DISTRO:-arch}" \
- WINESAPOS_DISTRO_DETECTED=$(grep -P '^ID=' /etc/os-release | cut -d= -f2) \
+ WINESAPOS_DISTRO_DETECTED="${winesapos_distro_detected}" \
WINESAPOS_ENABLE_TESTING_REPO="${WINESAPOS_ENABLE_TESTING_REPO:-false}" \
WINESAPOS_DE="${WINESAPOS_DE:-plasma}" \
WINESAPOS_ENCRYPT="${WINESAPOS_ENCRYPT:-false}" \
diff --git a/scripts/env/winesapos-env-minimal.sh b/scripts/env/winesapos-env-minimal.sh
index 7b2a739..fe7a25b 100755
--- a/scripts/env/winesapos-env-minimal.sh
+++ b/scripts/env/winesapos-env-minimal.sh
@@ -1,3 +1,5 @@
+#!/bin/bash
+
export \
WINESAPOS_IMAGE_TYPE=minimal \
WINESAPOS_ENABLE_PORTABLE_STORAGE=false \
diff --git a/scripts/env/winesapos-env-secure.sh b/scripts/env/winesapos-env-secure.sh
index 4ccc333..5b3ac26 100755
--- a/scripts/env/winesapos-env-secure.sh
+++ b/scripts/env/winesapos-env-secure.sh
@@ -1,3 +1,5 @@
+#!/bin/bash
+
export \
WINESAPOS_IMAGE_TYPE=secure \
WINESAPOS_ENCRYPT=true \
diff --git a/scripts/repo/winesapos-build-repo.sh b/scripts/repo/winesapos-build-repo.sh
index 24daf7c..7de025e 100755
--- a/scripts/repo/winesapos-build-repo.sh
+++ b/scripts/repo/winesapos-build-repo.sh
@@ -1,17 +1,21 @@
#!/bin/bash
+# shellcheck disable=SC2164
set -x
WORK_DIR="${WORK_DIR:-/tmp}"
OUTPUT_DIR="${OUTPUT_DIR:-/output}"
CMD_PACMAN_INSTALL=(/usr/bin/pacman --noconfirm -S --needed)
+# Sometimes this is needed to install additional dependencies from the AUR first.
+# shellcheck disable=SC2034
CMD_YAY_INSTALL=(yay --noconfirm -S --removemake)
+# shellcheck disable=SC2016
echo 'MAKEFLAGS="-j $(nproc)"' | sudo tee -a /etc/makepkg.conf
sudo pacman -S -y -y -u --noconfirm
# Install yay for helping install AUR build dependencies.
-sudo -E ${CMD_PACMAN_INSTALL[*]} base-devel binutils cmake curl dkms git make tar wget
+sudo -E "${CMD_PACMAN_INSTALL[@]}" base-devel binutils cmake curl dkms git make tar wget
export YAY_VER="12.4.1"
sudo -E curl https://github.com/Jguer/yay/releases/download/v${YAY_VER}/yay_${YAY_VER}_x86_64.tar.gz --remote-name --location
sudo -E tar -x -v -f yay_${YAY_VER}_x86_64.tar.gz
@@ -20,9 +24,11 @@ sudo rm -rf ./yay*
failed_builds=0
makepkg_build_failure_check() {
+ # shellcheck disable=SC2010
if ls -1 | grep pkg\.tar; then
echo "${1} build PASSED"
else
+ # shellcheck disable=SC2003 disable=SC2086
failed_builds=$(expr ${failed_builds} + 1)
echo "${1} build FAILED"
fi
@@ -30,16 +36,16 @@ makepkg_build_failure_check() {
# Usage: makepkg_fn <PACKAGE_NAME> [install|noinstall]
makepkg_fn() {
- cd ${WORK_DIR}
- git clone https://aur.archlinux.org/${1}.git
- cd ${1}
+ cd "${WORK_DIR}"
+ git clone "https://aur.archlinux.org/${1}.git"
+ cd "${1}"
if [[ "${2}" == "install" ]]; then
makepkg -s --noconfirm -i
else
makepkg -s --noconfirm
fi
- cp ./*.pkg.tar.* ${OUTPUT_DIR}
- makepkg_build_failure_check ${1}
+ cp ./*.pkg.tar.* "${OUTPUT_DIR}"
+ makepkg_build_failure_check "${1}"
}
# Usage: makepkg_local_fn [install|noop|noinstall]
@@ -51,8 +57,8 @@ makepkg_local_fn() {
else
makepkg -s --noconfirm
fi
- cp ./*.pkg.tar.* ${OUTPUT_DIR}
- makepkg_build_failure_check ${1}
+ cp ./*.pkg.tar.* "${OUTPUT_DIR}"
+ makepkg_build_failure_check "${1}"
}
# A proper git configuration is required to build some packages.
@@ -73,6 +79,7 @@ makepkg_fn linux-apfs-rw-dkms-git
makepkg_fn linux-firmware-asus
makepkg_fn linux-firmware-valve
# Remove source packages downloaded by the 'linux-firmware-valve' PKGBUILD.
+# shellcheck disable=SC2086
rm -f ${OUTPUT_DIR}/linux-firmware-neptune* ${OUTPUT_DIR}/steamdeck-dsp-*
makepkg_fn nexusmods-app-bin
makepkg_fn oxp-sensors-dkms-git
@@ -135,37 +142,37 @@ if [[ "${WINESAPOS_REPO_BUILD_LINUX_GIT}" == "true" ]]; then
gpg --recv-keys 79BE3E4300411886
## Greg Kroah-Hartman:
gpg --recv-keys 38DBBDC86092693E
- cd ${WORK_DIR}
+ cd "${WORK_DIR}"
git clone https://aur.archlinux.org/linux-git.git
cd linux-git
makepkg -s --noconfirm
- cp ./*.pkg.tar.zst ${OUTPUT_DIR}
+ cp ./*.pkg.tar.zst "${OUTPUT_DIR}"
makepkg_build_failure_check linux-git
fi
WINESAPOS_REPO_BUILD_MESA_GIT="${WINESAPOS_REPO_BUILD_MESA_GIT:-false}"
if [[ "${WINESAPOS_REPO_BUILD_MESA_GIT}" == "true" ]]; then
- cd ${WORK_DIR}
+ cd "${WORK_DIR}"
git clone https://aur.archlinux.org/mesa-git.git
cd mesa-git
makepkg -s --noconfirm
- cp ./*.pkg.tar.zst ${OUTPUT_DIR}
+ cp ./*.pkg.tar.zst "${OUTPUT_DIR}"
makepkg_build_failure_check mesa-git
- cd ${WORK_DIR}
+ cd "${WORK_DIR}"
git clone https://aur.archlinux.org/lib32-mesa-git.git
cd lib32-mesa-git
makepkg -s --noconfirm
- cp ./*.pkg.tar.zst ${OUTPUT_DIR}
+ cp ./*.pkg.tar.zst "${OUTPUT_DIR}"
makepkg_build_failure_check lib32-mesa-git
fi
# Build Pacman repository metadata.
WINESAPOS_REPO_BUILD_TESTING="${WINESAPOS_REPO_BUILD_TESTING:-false}"
if [[ "${WINESAPOS_REPO_BUILD_TESTING}" == "true" ]]; then
- repo-add ${OUTPUT_DIR}/winesapos-testing.db.tar.gz ${OUTPUT_DIR}/*pkg.tar.zst
+ repo-add "${OUTPUT_DIR}/winesapos-testing.db.tar.gz" "${OUTPUT_DIR}/*pkg.tar.zst"
else
- repo-add ${OUTPUT_DIR}/winesapos.db.tar.gz ${OUTPUT_DIR}/*pkg.tar.zst
+ repo-add "${OUTPUT_DIR}/winesapos.db.tar.gz" "${OUTPUT_DIR}/*pkg.tar.zst"
fi
-echo ${failed_builds} > ${OUTPUT_DIR}/winesapos-build-repo_exit-code.txt
-exit ${failed_builds}
+echo "${failed_builds}" > "${OUTPUT_DIR}/winesapos-build-repo_exit-code.txt"
+exit "${failed_builds}"
diff --git a/scripts/winesapos-build.sh b/scripts/winesapos-build.sh
index e2c2c29..36b676c 100755
--- a/scripts/winesapos-build.sh
+++ b/scripts/winesapos-build.sh
@@ -6,7 +6,8 @@ export \
WINESAPOS_CREATE_DEVICE=true \
WINESAPOS_BUILD_IN_VM_ONLY=false
-if [[ ! -z "${WINESAPOS_ENV_FILE}" ]]; then
+if [[ -n "${WINESAPOS_ENV_FILE}" ]]; then
+ # shellcheck disable=SC1090
source "/workdir/scripts/env/${WINESAPOS_ENV_FILE}"
fi
diff --git a/scripts/winesapos-convert.sh b/scripts/winesapos-convert.sh
index e6f0e3e..b0cc1f7 100755
--- a/scripts/winesapos-convert.sh
+++ b/scripts/winesapos-convert.sh
@@ -41,13 +41,12 @@ WINESAPOS_DISTRO_DETECTED=$(grep -P '^ID=' /etc/os-release | cut -d= -f2)
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "arch" ]] || [[ "${WINESAPOS_DISTRO_DETECTED}" == "manjaro" ]]; then
echo "Arch Linux or Manjaro detected. winesapOS conversion will attempt to install all packages."
sudo pacman -S -y
- ${CMD_PACMAN_INSTALL[*]} base-devel flatpak git wget
+ "${CMD_PACMAN_INSTALL[@]}" base-devel flatpak git wget
curl https://raw.githubusercontent.com/winesapOS/winesapOS/stable/files/os-release-winesapos --location --output /usr/lib/os-release-winesapos
ln -s /usr/lib/os-release-winesapos /etc/os-release-winesapos
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "arch" ]]; then
- grep -P "^\[multilib\]" /etc/pacman.conf
- if [ $? -ne 0 ]; then
+ if ! grep -q -P "^\[multilib\]" /etc/pacman.conf; then
echo "Adding the 32-bit multilb repository..."
# 32-bit multilib libraries.
echo -e '\n\n[multilib]\nInclude=/etc/pacman.d/mirrorlist' | sudo tee -a /etc/pacman.conf
@@ -56,8 +55,7 @@ if [[ "${WINESAPOS_DISTRO_DETECTED}" == "arch" ]] || [[ "${WINESAPOS_DISTRO_DETE
fi
fi
- grep "\[winesapos\]" /etc/pacman.conf
- if [ $? -ne 0 ]; then
+ if ! grep -q "\[winesapos\]" /etc/pacman.conf; then
echo "Adding the winesapOS repository..."
echo "[winesapos]" | sudo tee -a /etc/pacman.conf
echo "Server = https://winesapos.lukeshort.cloud/repo/winesapos/\$arch/" | sudo tee -a /etc/pacman.conf
@@ -70,8 +68,7 @@ if [[ "${WINESAPOS_DISTRO_DETECTED}" == "arch" ]] || [[ "${WINESAPOS_DISTRO_DETE
echo "Adding the winesapOS repository complete."
fi
- grep "\[chaotic-aur\]" /etc/pacman.conf
- if [ $? -ne 0 ]; then
+ if ! grep -q "\[chaotic-aur\]" /etc/pacman.conf; then
# https://aur.chaotic.cx/
echo "Adding the Chaotic AUR repository..."
sudo pacman-key --recv-keys 3056513887B78AEB --keyserver keyserver.ubuntu.com
@@ -94,8 +91,9 @@ Include = /etc/pacman.d/chaotic-mirrorlist" | sudo tee -a /etc/pacman.conf
echo "Installing all AUR packages..."
git clone https://aur.archlinux.org/yay.git
- cd yay
+ cd yay || exit 1
makepkg -si --noconfirm
+ # shellcheck disable=SC2103
cd ..
sudo rm -rf yay
yay --noconfirm -S --needed --removemake \
diff --git a/scripts/winesapos-install.sh b/scripts/winesapos-install.sh
index fa10af3..2a0f065 100755
--- a/scripts/winesapos-install.sh
+++ b/scripts/winesapos-install.sh
@@ -18,42 +18,40 @@ if [[ "${current_shell}" != "bash" ]]; then
fi
# Load default environment variables.
+# shellcheck disable=SC1091
. ./env/winesapos-env-defaults.sh
if [[ "${WINESAPOS_BUILD_IN_VM_ONLY}" == "true" ]]; then
- lscpu | grep "Hypervisor vendor:"
- if [ $? -ne 0 ]
- then
+ if ! lscpu | grep "Hypervisor vendor:"; then
echo "This build is not running in a virtual machine. Exiting to be safe."
exit 1
fi
fi
# Increase the temporary storage up from 256 MB on the Arch Linux ISO live environment.
-ls /run/archiso/cowspace &> /dev/null
-if [ $? -eq 0 ]; then
+if ls /run/archiso/cowspace &> /dev/null; then
mount -o remount,size=3G /run/archiso/cowspace
fi
clear_cache() {
- chroot ${WINESAPOS_INSTALL_DIR} pacman --noconfirm -S -c -c
+ chroot "${WINESAPOS_INSTALL_DIR}" pacman --noconfirm -S -c -c
# Each directory gets deleted separately in case the directory does not exist yet.
# Otherwise, the entire 'rm' command will not run if one of the directories is not found.
- rm -rf ${WINESAPOS_INSTALL_DIR}/var/cache/pacman/pkg/*
- rm -rf ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.cache/go-build/*
- rm -rf ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.cache/paru/*
- rm -rf ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.cache/yay/*
- rm -rf ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.cargo/*
- rm -rf ${WINESAPOS_INSTALL_DIR}/tmp/*
+ rm -rf "${WINESAPOS_INSTALL_DIR}"/var/cache/pacman/pkg/*
+ rm -rf "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.cache/go-build/*
+ rm -rf "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.cache/paru/*
+ rm -rf "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.cache/yay/*
+ rm -rf "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.cargo/*
+ rm -rf "${WINESAPOS_INSTALL_DIR}"/tmp/*
}
pacman_install_chroot() {
- chroot ${WINESAPOS_INSTALL_DIR} /usr/bin/pacman --noconfirm -S --needed $@
+ chroot "${WINESAPOS_INSTALL_DIR}" /usr/bin/pacman --noconfirm -S --needed "$@"
clear_cache
}
yay_install_chroot() {
- chroot ${WINESAPOS_INSTALL_DIR} sudo -u ${WINESAPOS_USER_NAME} yay --noconfirm -S --removemake $@
+ chroot "${WINESAPOS_INSTALL_DIR}" sudo -u "${WINESAPOS_USER_NAME}" yay --noconfirm -S --removemake "$@"
clear_cache
}
@@ -74,7 +72,7 @@ if [ -n "${WINESAPOS_HTTP_PROXY}" ]; then
export FTP_PROXY="${http_proxy}"
export RSYNC_PROXY="${http_proxy}"
export NO_PROXY="${no_proxy}"
- if echo ${WINESAPOS_HTTP_PROXY} | grep -P "^https://"; then
+ if echo "${WINESAPOS_HTTP_PROXY}" | grep -P "^https://"; then
export https_proxy="${http_proxy}"
export HTTPS_PROXY="${http_proxy}"
fi
@@ -100,12 +98,11 @@ if [[ "${WINESAPOS_CREATE_DEVICE}" == "true" ]]; then
echo "${DEVICE}" | tee /tmp/winesapos-device.txt
fi
-mkdir -p ${WINESAPOS_INSTALL_DIR}
+mkdir -p "${WINESAPOS_INSTALL_DIR}"
if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
DEVICE_WITH_PARTITION="${DEVICE}"
- echo ${DEVICE} | grep -q -P "^/dev/(nvme|loop)"
- if [ $? -eq 0 ]; then
+ if echo "${DEVICE}" | grep -q -P "^/dev/(nvme|loop)"; then
# "nvme" and "loop" devices separate the device name and partition number by using a "p".
# Example output: /dev/loop0p
DEVICE_WITH_PARTITION="${DEVICE}p"
@@ -113,32 +110,32 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
echo "Creating partitions..."
# GPT is required for UEFI boot.
- parted ${DEVICE} mklabel gpt
+ parted "${DEVICE}" mklabel gpt
# An empty partition is required for BIOS boot backwards compatibility.
- parted ${DEVICE} mkpart primary 2048s 2MiB
+ parted "${DEVICE}" mkpart primary 2048s 2MiB
if [[ "${WINESAPOS_ENABLE_PORTABLE_STORAGE}" == "true" ]]; then
# exFAT partition for generic flash drive storage.
- parted ${DEVICE} mkpart primary 2MiB 16GiB
+ parted "${DEVICE}" mkpart primary 2MiB 16GiB
## Configure this partition to be automatically mounted on Windows.
- parted ${DEVICE} set 2 msftdata on
+ parted "${DEVICE}" set 2 msftdata on
# EFI partition.
- parted ${DEVICE} mkpart primary fat32 16GiB 16.5GiB
- parted ${DEVICE} set 3 boot on
- parted ${DEVICE} set 3 esp on
+ parted "${DEVICE}" mkpart primary fat32 16GiB 16.5GiB
+ parted "${DEVICE}" set 3 boot on
+ parted "${DEVICE}" set 3 esp on
# Boot partition.
- parted ${DEVICE} mkpart primary ext4 16.5GiB 17.5GiB
+ parted "${DEVICE}" mkpart primary ext4 16.5GiB 17.5GiB
# Root partition uses the rest of the space.
- parted ${DEVICE} mkpart primary btrfs 17.5GiB 100%
+ parted "${DEVICE}" mkpart primary btrfs 17.5GiB 100%
else
# EFI partition.
- parted ${DEVICE} mkpart primary fat32 2MiB 512MiB
- parted ${DEVICE} set 2 boot on
- parted ${DEVICE} set 2 esp on
+ parted "${DEVICE}" mkpart primary fat32 2MiB 512MiB
+ parted "${DEVICE}" set 2 boot on
+ parted "${DEVICE}" set 2 esp on
# Boot partition.
- parted ${DEVICE} mkpart primary ext4 512MiB 1.5GiB
+ parted "${DEVICE}" mkpart primary ext4 512MiB 1.5GiB
# Root partition uses the rest of the space.
- parted ${DEVICE} mkpart primary btrfs 1.5GiB 100%
+ parted "${DEVICE}" mkpart primary btrfs 1.5GiB 100%
fi
# Avoid a race-condition where formatting devices may happen before the system detects the new partitions.
@@ -147,19 +144,19 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
if [[ "${WINESAPOS_ENABLE_PORTABLE_STORAGE}" == "true" ]]; then
# Formatting via 'parted' does not work so we need to reformat those partitions again.
- mkfs -t exfat ${DEVICE_WITH_PARTITION}2
+ mkfs -t exfat "${DEVICE_WITH_PARTITION}2"
# exFAT file systems require labels that are 11 characters or shorter.
- exfatlabel ${DEVICE_WITH_PARTITION}2 wos-drive
- mkfs -t vfat ${DEVICE_WITH_PARTITION}3
+ exfatlabel "${DEVICE_WITH_PARTITION}2" wos-drive
+ mkfs -t vfat "${DEVICE_WITH_PARTITION}3"
# FAT32 file systems require upper-case labels that are 11 characters or shorter.
- fatlabel ${DEVICE_WITH_PARTITION}3 WOS-EFI
- mkfs -t ext4 ${DEVICE_WITH_PARTITION}4
- e2label ${DEVICE_WITH_PARTITION}4 winesapos-boot
+ fatlabel "${DEVICE_WITH_PARTITION}3" WOS-EFI
+ mkfs -t ext4 "${DEVICE_WITH_PARTITION}4"
+ e2label "${DEVICE_WITH_PARTITION}4" winesapos-boot
if [[ "${WINESAPOS_ENCRYPT}" == "true" ]]; then
- echo "${WINESAPOS_ENCRYPT_PASSWORD}" | cryptsetup -q luksFormat ${DEVICE_WITH_PARTITION}5
- cryptsetup config ${DEVICE_WITH_PARTITION}5 --label winesapos-luks
- echo "${WINESAPOS_ENCRYPT_PASSWORD}" | cryptsetup luksOpen ${DEVICE_WITH_PARTITION}5 cryptroot
+ echo "${WINESAPOS_ENCRYPT_PASSWORD}" | cryptsetup -q luksFormat "${DEVICE_WITH_PARTITION}5"
+ cryptsetup config "${DEVICE_WITH_PARTITION}5" --label winesapos-luks
+ echo "${WINESAPOS_ENCRYPT_PASSWORD}" | cryptsetup luksOpen "${DEVICE_WITH_PARTITION}5" cryptroot
root_partition="/dev/mapper/cryptroot"
else
root_partition="${DEVICE_WITH_PARTITION}5"
@@ -167,40 +164,40 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
else
# Formatting via 'parted' does not work so we need to reformat those partitions again.
- mkfs -t vfat ${DEVICE_WITH_PARTITION}2
+ mkfs -t vfat "${DEVICE_WITH_PARTITION}2"
# FAT32 file systems require upper-case labels that are 11 characters or shorter.
- fatlabel ${DEVICE_WITH_PARTITION}2 WOS-EFI
- mkfs -t ext4 ${DEVICE_WITH_PARTITION}3
- e2label ${DEVICE_WITH_PARTITION}3 winesapos-boot
+ fatlabel "${DEVICE_WITH_PARTITION}2" WOS-EFI
+ mkfs -t ext4 "${DEVICE_WITH_PARTITION}3"
+ e2label "${DEVICE_WITH_PARTITION}3" winesapos-boot
if [[ "${WINESAPOS_ENCRYPT}" == "true" ]]; then
- echo "${WINESAPOS_ENCRYPT_PASSWORD}" | cryptsetup -q luksFormat ${DEVICE_WITH_PARTITION}4
- cryptsetup config ${DEVICE_WITH_PARTITION}4 --label winesapos-luks
- echo "${WINESAPOS_ENCRYPT_PASSWORD}" | cryptsetup luksOpen ${DEVICE_WITH_PARTITION}4 cryptroot
+ echo "${WINESAPOS_ENCRYPT_PASSWORD}" | cryptsetup -q luksFormat "${DEVICE_WITH_PARTITION}4"
+ cryptsetup config "${DEVICE_WITH_PARTITION}"4 --label winesapos-luks
+ echo "${WINESAPOS_ENCRYPT_PASSWORD}" | cryptsetup luksOpen "${DEVICE_WITH_PARTITION}4" cryptroot
root_partition="/dev/mapper/cryptroot"
else
root_partition="${DEVICE_WITH_PARTITION}4"
fi
fi
- mkfs -t btrfs ${root_partition}
- btrfs filesystem label ${root_partition} winesapos-root
+ mkfs -t btrfs "${root_partition}"
+ btrfs filesystem label "${root_partition}" winesapos-root
echo "Creating partitions complete."
echo "Mounting partitions..."
- mount -t btrfs -o subvol=/,compress-force=zstd:1,discard,noatime,nodiratime ${root_partition} ${WINESAPOS_INSTALL_DIR}
- btrfs subvolume create ${WINESAPOS_INSTALL_DIR}/home
- mount -t btrfs -o subvol=/home,compress-force=zstd:1,discard,noatime,nodiratime ${root_partition} ${WINESAPOS_INSTALL_DIR}/home
- btrfs subvolume create ${WINESAPOS_INSTALL_DIR}/swap
- mount -t btrfs -o subvol=/swap,compress-force=zstd:1,discard,noatime,nodiratime ${root_partition} ${WINESAPOS_INSTALL_DIR}/swap
- mkdir ${WINESAPOS_INSTALL_DIR}/boot
+ mount -t btrfs -o subvol=/,compress-force=zstd:1,discard,noatime,nodiratime "${root_partition}" "${WINESAPOS_INSTALL_DIR}"
+ btrfs subvolume create "${WINESAPOS_INSTALL_DIR}/home"
+ mount -t btrfs -o subvol=/home,compress-force=zstd:1,discard,noatime,nodiratime "${root_partition}" "${WINESAPOS_INSTALL_DIR}/home"
+ btrfs subvolume create "${WINESAPOS_INSTALL_DIR}/swap"
+ mount -t btrfs -o subvol=/swap,compress-force=zstd:1,discard,noatime,nodiratime "${root_partition}" "${WINESAPOS_INSTALL_DIR}/swap"
+ mkdir "${WINESAPOS_INSTALL_DIR}/boot"
if [[ "${WINESAPOS_ENABLE_PORTABLE_STORAGE}" == "true" ]]; then
- mount -t ext4 ${DEVICE_WITH_PARTITION}4 ${WINESAPOS_INSTALL_DIR}/boot
+ mount -t ext4 "${DEVICE_WITH_PARTITION}4" "${WINESAPOS_INSTALL_DIR}/boot"
else
- mount -t ext4 ${DEVICE_WITH_PARTITION}3 ${WINESAPOS_INSTALL_DIR}/boot
+ mount -t ext4 "${DEVICE_WITH_PARTITION}3" "${WINESAPOS_INSTALL_DIR}/boot"
fi
- mkdir ${WINESAPOS_INSTALL_DIR}/boot/efi
+ mkdir "${WINESAPOS_INSTALL_DIR}"/boot/efi
export efi_partition=""
if [[ "${WINESAPOS_ENABLE_PORTABLE_STORAGE}" == "true" ]]; then
export efi_partition="${DEVICE_WITH_PARTITION}3"
@@ -209,14 +206,14 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
fi
if [[ "${WINESAPOS_BOOTLOADER}" == "grub" ]]; then
- mount -t vfat ${efi_partition} ${WINESAPOS_INSTALL_DIR}/boot/efi
+ mount -t vfat "${efi_partition}" "${WINESAPOS_INSTALL_DIR}/boot/efi"
elif [[ "${WINESAPOS_BOOTLOADER}" == "systemd-boot" ]]; then
- mount -t vfat ${efi_partition} ${WINESAPOS_INSTALL_DIR}/boot
+ mount -t vfat "${efi_partition}" "${WINESAPOS_INSTALL_DIR}/boot"
fi
for i in tmp var/log var/tmp; do
- mkdir -p ${WINESAPOS_INSTALL_DIR}/${i}
- mount tmpfs -t tmpfs -o nodev,nosuid ${WINESAPOS_INSTALL_DIR}/${i}
+ mkdir -p "${WINESAPOS_INSTALL_DIR}"/${i}
+ mount tmpfs -t tmpfs -o nodev,nosuid "${WINESAPOS_INSTALL_DIR}/${i}"
done
echo "Mounting partitions complete."
@@ -246,7 +243,7 @@ echo "Creating the keyrings used by Pacman done."
echo "Setting up Pacman parallel package downloads on live media..."
# Increase from the default 1 package download at a time to 5.
-sed -i s'/\#ParallelDownloads.*/ParallelDownloads=5/'g /etc/pacman.conf
+sed -i 's/\#ParallelDownloads.*/ParallelDownloads=5/g' /etc/pacman.conf
echo "Setting up Pacman parallel package downloads on live media complete."
echo "Install wget to help download packages..."
@@ -254,7 +251,7 @@ pacman -S --needed --noconfirm wget
echo "Install wget to help download packages complete."
echo "Configuring Pacman to use 'curl' for more reliable downloads on slow internet connections..."
-sed -i s'/\[options\]/\[options\]\nXferCommand = \/usr\/bin\/curl --connect-timeout 60 --retry 10 --retry-delay 5 -L -C - -f -o %o %u/'g /etc/pacman.conf
+sed -i 's/\[options\]/\[options\]\nXferCommand = \/usr\/bin\/curl --connect-timeout 60 --retry 10 --retry-delay 5 -L -C - -f -o %o %u/g' /etc/pacman.conf
echo "Configuring Pacman to use 'curl' for more reliable downloads on slow internet connections complete."
echo "Updating all system packages on the live media before starting the build..."
@@ -270,79 +267,82 @@ echo "Installing Arch Linux installation tools on the live media complete."
echo "Installing ${WINESAPOS_DISTRO}..."
-pacstrap -i ${WINESAPOS_INSTALL_DIR} base base-devel curl fwupd --noconfirm
+pacstrap -i "${WINESAPOS_INSTALL_DIR}" base base-devel curl fwupd --noconfirm
-# When building winesapOS using a container, ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf does not get created.
+# When building winesapOS using a container, "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf does not get created.
# https://github.com/winesapOS/winesapOS/issues/631
if [ ! -f "${WINESAPOS_INSTALL_DIR}/etc/pacman.conf" ]; then
- cp /etc/pacman.conf ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
+ cp /etc/pacman.conf "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf
else
- sed -i s'/\[options\]/\[options\]\nXferCommand = \/usr\/bin\/curl --connect-timeout 60 --retry 10 --retry-delay 5 -L -C - -f -o %o %u/'g ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
+ # shellcheck disable=SC2016
+ sed -i 's/\[options\]/\[options\]\nXferCommand = \/usr\/bin\/curl --connect-timeout 60 --retry 10 --retry-delay 5 -L -C - -f -o %o %u/g' "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf
fi
echo "Adding the winesapOS repository..."
if [[ "${WINESAPOS_ENABLE_TESTING_REPO}" == "false" ]]; then
- sed -i s'/\[core]/[winesapos]\nServer = http:\/\/winesapos.lukeshort.cloud\/repo\/$repo\/$arch\n\n[core]/'g ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
+ # shellcheck disable=SC2016
+ sed -i 's/\[core]/[winesapos]\nServer = http:\/\/winesapos.lukeshort.cloud\/repo\/$repo\/$arch\n\n[core]/g' "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf
else
- sed -i s'/\[core]/[winesapos-testing]\nServer = http:\/\/winesapos.lukeshort.cloud\/repo\/$repo\/$arch\nSigLevel = Never\n\n[core]/'g ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
+ # shellcheck disable=SC2016
+ sed -i 's/\[core]/[winesapos-testing]\nServer = http:\/\/winesapos.lukeshort.cloud\/repo\/$repo\/$arch\nSigLevel = Never\n\n[core]/g' "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf
fi
# DNS resolvers need to be configured first before accessing the GPG key server.
-echo -e "nameserver 8.8.8.8\nnameserver 1.1.1.1" > ${WINESAPOS_INSTALL_DIR}/etc/resolv.conf
+echo -e "nameserver 8.8.8.8\nnameserver 1.1.1.1" > "${WINESAPOS_INSTALL_DIR}"/etc/resolv.conf
# Before we perform our first 'chroot', we need to mount the necessary Linux device, process, and system file systems.
-mount --rbind /dev ${WINESAPOS_INSTALL_DIR}/dev
-mount -t proc /proc ${WINESAPOS_INSTALL_DIR}/proc
-mount --rbind /sys ${WINESAPOS_INSTALL_DIR}/sys
+mount --rbind /dev "${WINESAPOS_INSTALL_DIR}"/dev
+mount -t proc /proc "${WINESAPOS_INSTALL_DIR}"/proc
+mount --rbind /sys "${WINESAPOS_INSTALL_DIR}"/sys
echo "Importing the public GPG key for the winesapOS repository..."
-chroot ${WINESAPOS_INSTALL_DIR} pacman-key --recv-keys 1805E886BECCCEA99EDF55F081CA29E4A4B01239
-chroot ${WINESAPOS_INSTALL_DIR} pacman-key --init
-chroot ${WINESAPOS_INSTALL_DIR} pacman-key --lsign-key 1805E886BECCCEA99EDF55F081CA29E4A4B01239
+chroot "${WINESAPOS_INSTALL_DIR}" pacman-key --recv-keys 1805E886BECCCEA99EDF55F081CA29E4A4B01239
+chroot "${WINESAPOS_INSTALL_DIR}" pacman-key --init
+chroot "${WINESAPOS_INSTALL_DIR}" pacman-key --lsign-key 1805E886BECCCEA99EDF55F081CA29E4A4B01239
echo "Importing the public GPG key for the winesapOS repository complete."
echo "Adding the winesapOS repository complete."
if [[ "${WINESAPOS_DISTRO}" == "arch" ]]; then
echo "Adding the 32-bit multilb repository..."
# 32-bit multilib libraries.
- echo -e '\n\n[multilib]\nInclude=/etc/pacman.d/mirrorlist' >> ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
+ echo -e '\n\n[multilib]\nInclude=/etc/pacman.d/mirrorlist' >> "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf
echo "Adding the 32-bit multilb repository complete."
fi
# Use the fast mirrors that were already configured for the live environment.
-rm -f ${WINESAPOS_INSTALL_DIR}/etc/pacman.d/mirrorlist
-cp /etc/pacman.d/mirrorlist ${WINESAPOS_INSTALL_DIR}/etc/pacman.d/mirrorlist
+rm -f "${WINESAPOS_INSTALL_DIR}"/etc/pacman.d/mirrorlist
+cp /etc/pacman.d/mirrorlist "${WINESAPOS_INSTALL_DIR}"/etc/pacman.d/mirrorlist
# Update repository cache for [winesapos] and [multilib] repositories.
# Otherwise, 'pacman' commands will fail.
-chroot ${WINESAPOS_INSTALL_DIR} pacman -S -y
+chroot "${WINESAPOS_INSTALL_DIR}" pacman -S -y
# https://aur.chaotic.cx/
echo "Adding the Chaotic AUR repository..."
-chroot ${WINESAPOS_INSTALL_DIR} pacman-key --recv-keys 3056513887B78AEB --keyserver keyserver.ubuntu.com
-chroot ${WINESAPOS_INSTALL_DIR} pacman-key --lsign-key 3056513887B78AEB
-wget 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' -LO ${WINESAPOS_INSTALL_DIR}/chaotic-keyring.pkg.tar.zst
-chroot ${WINESAPOS_INSTALL_DIR} pacman --noconfirm -U /chaotic-keyring.pkg.tar.zst
-wget 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' -LO ${WINESAPOS_INSTALL_DIR}/chaotic-mirrorlist.pkg.tar.zst
-chroot ${WINESAPOS_INSTALL_DIR} pacman --noconfirm -U /chaotic-mirrorlist.pkg.tar.zst
-rm -f ${WINESAPOS_INSTALL_DIR}/chaotic-*.pkg.tar.zst
+chroot "${WINESAPOS_INSTALL_DIR}" pacman-key --recv-keys 3056513887B78AEB --keyserver keyserver.ubuntu.com
+chroot "${WINESAPOS_INSTALL_DIR}" pacman-key --lsign-key 3056513887B78AEB
+wget 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' -LO "${WINESAPOS_INSTALL_DIR}"/chaotic-keyring.pkg.tar.zst
+chroot "${WINESAPOS_INSTALL_DIR}" pacman --noconfirm -U /chaotic-keyring.pkg.tar.zst
+wget 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' -LO "${WINESAPOS_INSTALL_DIR}"/chaotic-mirrorlist.pkg.tar.zst
+chroot "${WINESAPOS_INSTALL_DIR}" pacman --noconfirm -U /chaotic-mirrorlist.pkg.tar.zst
+rm -f "${WINESAPOS_INSTALL_DIR}"/chaotic-*.pkg.tar.zst
echo "
[chaotic-aur]
-Include = /etc/pacman.d/chaotic-mirrorlist" >> ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
+Include = /etc/pacman.d/chaotic-mirrorlist" >> "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf
if [ -n "${WINESAPOS_HTTP_PROXY_CA}" ]; then
echo "Configuring the proxy certificate authority in the chroot..."
- cp "${WINESAPOS_HTTP_PROXY_CA}" ${WINESAPOS_INSTALL_DIR}/etc/ca-certificates/trust-source/anchors/
- chroot ${WINESAPOS_INSTALL_DIR} update-ca-trust
+ cp "${WINESAPOS_HTTP_PROXY_CA}" "${WINESAPOS_INSTALL_DIR}"/etc/ca-certificates/trust-source/anchors/
+ chroot "${WINESAPOS_INSTALL_DIR}" update-ca-trust
echo "Configuring the proxy certificate authority in the chroot complete."
fi
# Update repository cache. The extra '-y' is to accept any new keyrings.
-chroot ${WINESAPOS_INSTALL_DIR} pacman -S -y -y
+chroot "${WINESAPOS_INSTALL_DIR}" pacman -S -y -y
pacman_install_chroot efibootmgr iwd mkinitcpio modem-manager-gui networkmanager usb_modeswitch zram-generator
-echo -e "[device]\nwifi.backend=iwd" > ${WINESAPOS_INSTALL_DIR}/etc/NetworkManager/conf.d/wifi_backend.conf
-chroot ${WINESAPOS_INSTALL_DIR} systemctl enable fstrim.timer NetworkManager systemd-timesyncd
+echo -e "[device]\nwifi.backend=iwd" > "${WINESAPOS_INSTALL_DIR}"/etc/NetworkManager/conf.d/wifi_backend.conf
+chroot "${WINESAPOS_INSTALL_DIR}" systemctl enable fstrim.timer NetworkManager systemd-timesyncd
# Prioritize IPv4 over IPv6 traffic.
# https://github.com/winesapOS/winesapOS/issues/740
echo "label ::1/128 0
@@ -354,16 +354,16 @@ precedence ::1/128 50
precedence ::/0 40
precedence 2002::/16 30
precedence ::/96 20
-precedence ::ffff:0:0/96 100" > ${WINESAPOS_INSTALL_DIR}/etc/gai.conf
-sed -i s'/MODULES=(/MODULES=(btrfs\ usbhid\ xhci_hcd\ nvme\ vmd\ /'g ${WINESAPOS_INSTALL_DIR}/etc/mkinitcpio.conf
-echo "${WINESAPOS_LOCALE}" >> ${WINESAPOS_INSTALL_DIR}/etc/locale.gen
-chroot ${WINESAPOS_INSTALL_DIR} locale-gen
+precedence ::ffff:0:0/96 100" > "${WINESAPOS_INSTALL_DIR}"/etc/gai.conf
+sed -i 's/MODULES=(/MODULES=(btrfs\ usbhid\ xhci_hcd\ nvme\ vmd\ /g' "${WINESAPOS_INSTALL_DIR}"/etc/mkinitcpio.conf
+echo "${WINESAPOS_LOCALE}" >> "${WINESAPOS_INSTALL_DIR}"/etc/locale.gen
+chroot "${WINESAPOS_INSTALL_DIR}" locale-gen
# Example output: LANG=en_US.UTF-8
-echo "LANG=$(echo ${WINESAPOS_LOCALE} | cut -d' ' -f1)" > ${WINESAPOS_INSTALL_DIR}/etc/locale.conf
+echo "LANG=$(echo "${WINESAPOS_LOCALE}" | cut -d' ' -f1)" > "${WINESAPOS_INSTALL_DIR}"/etc/locale.conf
# Hostname.
-echo winesapos > ${WINESAPOS_INSTALL_DIR}/etc/hostname
+echo winesapos > "${WINESAPOS_INSTALL_DIR}"/etc/hostname
## This is not a typo. The IPv4 address should '127.0.1.1' instead of '127.0.0.1' to work with systemd.
-echo "127.0.1.1 winesapos" >> ${WINESAPOS_INSTALL_DIR}/etc/hosts
+echo "127.0.1.1 winesapos" >> "${WINESAPOS_INSTALL_DIR}"/etc/hosts
## This package provides the 'hostname' command along with other useful network utilities.
pacman_install_chroot inetutils
# Install fingerprint scanning support.
@@ -373,7 +373,7 @@ echo "Installing ${WINESAPOS_DISTRO} complete."
pacman_install_chroot spice-vdagent
echo "Setting up Pacman parallel package downloads in chroot..."
# Increase from the default 1 package download at a time to 5.
-sed -i s'/\#ParallelDownloads.*/ParallelDownloads=5/'g ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
+sed -i 's/\#ParallelDownloads.*/ParallelDownloads=5/g' "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf
echo "Setting up Pacman parallel package downloads in chroot complete."
if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
@@ -389,45 +389,45 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
# 'genfstab' now uses 'lsblk' which does not work in a container.
# Instead, manually create the '/etc/fstab' file.
# https://github.com/winesapOS/winesapOS/issues/826
- #genfstab -L ${WINESAPOS_INSTALL_DIR} | grep -v tracefs > ${WINESAPOS_INSTALL_DIR}/etc/fstab
+ #genfstab -L "${WINESAPOS_INSTALL_DIR}" | grep -v tracefs > "${WINESAPOS_INSTALL_DIR}"/etc/fstab
echo "LABEL=winesapos-root / btrfs rw,noatime,nodiratime,compress-force=zstd:1,discard,space_cache=v2,subvolid=$(btrfs subvolume show /winesapos | grep "Subvolume ID" | awk '{print $3}'),subvol=/ 0 0
LABEL=winesapos-root /home btrfs rw,noatime,nodiratime,compress-force=zstd:1,discard,space_cache=v2,subvolid=$(btrfs subvolume show /winesapos/home | grep "Subvolume ID" | awk '{print $3}'),subvol=/home 0 0
LABEL=winesapos-root /swap btrfs rw,noatime,nodiratime,compress-force=zstd:1,discard,space_cache=v2,subvolid=$(btrfs subvolume show /winesapos/swap | grep "Subvolume ID" | awk '{print $3}'),subvol=/swap 0 0
LABEL=winesapos-boot /boot ext4 rw,relatime 0 2
-LABEL=WOS-EFI /boot/efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 2" > ${WINESAPOS_INSTALL_DIR}/etc/fstab
+LABEL=WOS-EFI /boot/efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 2" > "${WINESAPOS_INSTALL_DIR}"/etc/fstab
# Add temporary mounts separately instead of using 'genfstab -P' to avoid extra file systems.
echo "tmpfs /tmp tmpfs rw,nosuid,nodev,inode64 0 0
tmpfs /var/log tmpfs rw,nosuid,nodev,inode64 0 0
-tmpfs /var/tmp tmpfs rw,nosuid,nodev,inode64 0 0" >> ${WINESAPOS_INSTALL_DIR}/etc/fstab
+tmpfs /var/tmp tmpfs rw,nosuid,nodev,inode64 0 0" >> "${WINESAPOS_INSTALL_DIR}"/etc/fstab
elif [[ "${WINESAPOS_BOOTLOADER}" == "systemd-boot" ]]; then
echo "LABEL=winesapos-root / btrfs rw,noatime,nodiratime,compress-force=zstd:1,discard,space_cache=v2,subvolid=$(btrfs subvolume show /winesapos | grep "Subvolume ID" | awk '{print $3}'),subvol=/ 0 0
LABEL=winesapos-root /home btrfs rw,noatime,nodiratime,compress-force=zstd:1,discard,space_cache=v2,subvolid=$(btrfs subvolume show /winesapos/home | grep "Subvolume ID" | awk '{print $3}'),subvol=/home 0 0
LABEL=winesapos-root /swap btrfs rw,noatime,nodiratime,compress-force=zstd:1,discard,space_cache=v2,subvolid=$(btrfs subvolume show /winesapos/swap | grep "Subvolume ID" | awk '{print $3}'),subvol=/swap 0 0
-LABEL=WOS-EFI /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 2" > ${WINESAPOS_INSTALL_DIR}/etc/fstab
+LABEL=WOS-EFI /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 2" > "${WINESAPOS_INSTALL_DIR}"/etc/fstab
fi
# Add temporary mounts separately instead of using 'genfstab -P' to avoid extra file systems.
echo "tmpfs /tmp tmpfs rw,nosuid,nodev,inode64 0 0
tmpfs /var/log tmpfs rw,nosuid,nodev,inode64 0 0
-tmpfs /var/tmp tmpfs rw,nosuid,nodev,inode64 0 0" >> ${WINESAPOS_INSTALL_DIR}/etc/fstab
+tmpfs /var/tmp tmpfs rw,nosuid,nodev,inode64 0 0" >> "${WINESAPOS_INSTALL_DIR}"/etc/fstab
echo "View final /etc/fstab file:"
- cat ${WINESAPOS_INSTALL_DIR}/etc/fstab
+ cat "${WINESAPOS_INSTALL_DIR}"/etc/fstab
echo "Saving partition mounts to /etc/fstab complete."
fi
echo "Configuring fastest mirror in the chroot..."
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "manjaro" ]]; then
- cp ../rootfs/etc/systemd/system/pacman-mirrors.service ${WINESAPOS_INSTALL_DIR}/etc/systemd/system/
+ cp ../rootfs/etc/systemd/system/pacman-mirrors.service "${WINESAPOS_INSTALL_DIR}"/etc/systemd/system/
# This is required for 'pacman-mirrors' to determine if an IP address has been assigned yet.
# Once an IP address is assigned, then the `pacman-mirrors' service will start.
- chroot ${WINESAPOS_INSTALL_DIR} systemctl enable NetworkManager-wait-online.service
+ chroot "${WINESAPOS_INSTALL_DIR}" systemctl enable NetworkManager-wait-online.service
elif [[ "${WINESAPOS_DISTRO_DETECTED}" == "arch" ]]; then
pacman_install_chroot reflector
fi
# Re-use the mirror list that was created earlier.
-rm -f ${WINESAPOS_INSTALL_DIR}/etc/pacman.d/mirrorlist
-cp /etc/pacman.d/mirrorlist ${WINESAPOS_INSTALL_DIR}/etc/pacman.d/mirrorlist
+rm -f "${WINESAPOS_INSTALL_DIR}"/etc/pacman.d/mirrorlist
+cp /etc/pacman.d/mirrorlist "${WINESAPOS_INSTALL_DIR}"/etc/pacman.d/mirrorlist
echo "Configuring fastest mirror in the chroot complete."
@@ -441,17 +441,18 @@ else
export YAY_VER="12.4.1"
curl https://github.com/Jguer/yay/releases/download/v${YAY_VER}/yay_${YAY_VER}_x86_64.tar.gz --remote-name --location
tar -x -v -f yay_${YAY_VER}_x86_64.tar.gz
- mv yay_${YAY_VER}_x86_64/yay ${WINESAPOS_INSTALL_DIR}/usr/local/bin/yay
+ mv yay_${YAY_VER}_x86_64/yay "${WINESAPOS_INSTALL_DIR}"/usr/local/bin/yay
rm -rf ./yay*
fi
# Development packages required for building other packages.
pacman_install_chroot binutils cmake dkms fakeroot gcc git make
-echo 'MAKEFLAGS="-j $(nproc)"' >> ${WINESAPOS_INSTALL_DIR}/etc/makepkg.conf
+# shellcheck disable=SC2016
+echo 'MAKEFLAGS="-j $(nproc)"' >> "${WINESAPOS_INSTALL_DIR}"/etc/makepkg.conf
# Add the 'pacman-static' command for more stable upgrades.
# https://github.com/winesapOS/winesapOS/issues/623
-wget https://pkgbuild.com/~morganamilo/pacman-static/x86_64/bin/pacman-static -LO ${WINESAPOS_INSTALL_DIR}/usr/local/bin/pacman-static
-chmod +x ${WINESAPOS_INSTALL_DIR}/usr/local/bin/pacman-static
+wget https://pkgbuild.com/~morganamilo/pacman-static/x86_64/bin/pacman-static -LO "${WINESAPOS_INSTALL_DIR}"/usr/local/bin/pacman-static
+chmod +x "${WINESAPOS_INSTALL_DIR}"/usr/local/bin/pacman-static
pacman_install_chroot \
mesa \
@@ -477,13 +478,13 @@ echo "
options radeon si_support=0
options radeon cik_support=0
options amdgpu si_support=1
-options amdgpu cik_support=1" > ${WINESAPOS_INSTALL_DIR}/etc/modprobe.d/winesapos-amd.conf
+options amdgpu cik_support=1" > "${WINESAPOS_INSTALL_DIR}"/etc/modprobe.d/winesapos-amd.conf
# Workaround a known AMD driver issue:
# https://www.phoronix.com/news/AMDGPU-APU-noretry
# https://gitlab.freedesktop.org/drm/amd/-/issues/934
echo "
-options amdgpu noretry=0" >> ${WINESAPOS_INSTALL_DIR}/etc/modprobe.d/winesapos-amd.conf
+options amdgpu noretry=0" >> "${WINESAPOS_INSTALL_DIR}"/etc/modprobe.d/winesapos-amd.conf
# Flatpak.
pacman_install_chroot flatpak
@@ -491,24 +492,24 @@ echo "Installing additional package managers complete."
if [[ "${WINESAPOS_FIREWALL}" == "true" ]]; then
pacman_install_chroot firewalld
- chroot ${WINESAPOS_INSTALL_DIR} systemctl enable firewalld
+ chroot "${WINESAPOS_INSTALL_DIR}" systemctl enable firewalld
fi
echo "Configuring user accounts..."
-echo -e "root\nroot" | chroot ${WINESAPOS_INSTALL_DIR} passwd root
-chroot ${WINESAPOS_INSTALL_DIR} useradd --create-home ${WINESAPOS_USER_NAME}
-echo -e "${WINESAPOS_USER_NAME}\n${WINESAPOS_USER_NAME}" | chroot ${WINESAPOS_INSTALL_DIR} passwd ${WINESAPOS_USER_NAME}
-echo "${WINESAPOS_USER_NAME} ALL=(root) NOPASSWD:ALL" > ${WINESAPOS_INSTALL_DIR}/etc/sudoers.d/${WINESAPOS_USER_NAME}
-chmod 0440 ${WINESAPOS_INSTALL_DIR}/etc/sudoers.d/${WINESAPOS_USER_NAME}
-mkdir ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop
+echo -e "root\nroot" | chroot "${WINESAPOS_INSTALL_DIR}" passwd root
+chroot "${WINESAPOS_INSTALL_DIR}" useradd --create-home "${WINESAPOS_USER_NAME}"
+echo -e "${WINESAPOS_USER_NAME}\n${WINESAPOS_USER_NAME}" | chroot "${WINESAPOS_INSTALL_DIR}" passwd "${WINESAPOS_USER_NAME}"
+echo "${WINESAPOS_USER_NAME} ALL=(root) NOPASSWD:ALL" > "${WINESAPOS_INSTALL_DIR}"/etc/sudoers.d/"${WINESAPOS_USER_NAME}"
+chmod 0440 "${WINESAPOS_INSTALL_DIR}"/etc/sudoers.d/"${WINESAPOS_USER_NAME}"
+mkdir "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop
# Create a symlink for the "deck" user for compatibility with Steam Deck apps.
-chroot ${WINESAPOS_INSTALL_DIR} ln -s /home/${WINESAPOS_USER_NAME} /home/deck
+chroot "${WINESAPOS_INSTALL_DIR}" ln -s /home/"${WINESAPOS_USER_NAME}" /home/deck
echo "Configuring user accounts complete."
echo "Installing AUR package managers..."
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "arch" ]]; then
yay_install_chroot yay
- rm -f ${WINESAPOS_INSTALL_DIR}/usr/local/bin/yay
+ rm -f "${WINESAPOS_INSTALL_DIR}"/usr/local/bin/yay
fi
yay_install_chroot paru
@@ -521,8 +522,8 @@ if [[ "${WINESAPOS_APPARMOR}" == "true" ]]; then
echo "Installing AppArmor..."
pacman_install_chroot apparmor
yay_install_chroot krathalans-apparmor-profiles-git
- chroot ${WINESAPOS_INSTALL_DIR} systemctl enable apparmor
- chroot ${WINESAPOS_INSTALL_DIR} find /etc/apparmor.d/ -exec aa-enforce {} \;
+ chroot "${WINESAPOS_INSTALL_DIR}" systemctl enable apparmor
+ chroot "${WINESAPOS_INSTALL_DIR}" find /etc/apparmor.d/ -exec aa-enforce {} \;
echo "Installing AppArmor complete."
fi
@@ -538,11 +539,12 @@ echo "Installing 'crudini' from the AUR complete."
echo "Installing Wi-Fi drivers..."
# Download an offline copy of the "broadcom-wl-dkms" driver.
# It can optionally be installed during the first-time setup.
-mkdir -p ${WINESAPOS_INSTALL_DIR}/var/lib/winesapos/
-chroot ${WINESAPOS_INSTALL_DIR} pacman -S -w --noconfirm broadcom-wl-dkms
+mkdir -p "${WINESAPOS_INSTALL_DIR}"/var/lib/winesapos/
+chroot "${WINESAPOS_INSTALL_DIR}" pacman -S -w --noconfirm broadcom-wl-dkms
# Find the exact package name.
-for i in $(ls -1 ${WINESAPOS_INSTALL_DIR}/var/cache/pacman/pkg/ | grep broadcom-wl-dkms)
- do cp ${WINESAPOS_INSTALL_DIR}/var/cache/pacman/pkg/${i} ${WINESAPOS_INSTALL_DIR}/var/lib/winesapos/
+# shellcheck disable=SC2010
+for i in $(ls -1 "${WINESAPOS_INSTALL_DIR}"/var/cache/pacman/pkg/ | grep broadcom-wl-dkms)
+ do cp "${WINESAPOS_INSTALL_DIR}"/var/cache/pacman/pkg/"${i}" "${WINESAPOS_INSTALL_DIR}"/var/lib/winesapos/
done
echo "Installing Wi-Fi drivers complete."
@@ -554,14 +556,14 @@ pacman_install_chroot libpipewire lib32-libpipewire wireplumber
pacman_install_chroot pipewire-alsa pipewire-jack lib32-pipewire-jack pipewire-pulse pipewire-v4l2 lib32-pipewire-v4l2
## Enable the required services.
## Manually create the 'systemctl --user enable' symlinks as the command does not work in a chroot.
-mkdir -p ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.config/systemd/user/default.target.wants/
-chroot ${WINESAPOS_INSTALL_DIR} ln -s /usr/lib/systemd/user/pipewire.service /home/${WINESAPOS_USER_NAME}/.config/systemd/user/default.target.wants/pipewire.service
-chroot ${WINESAPOS_INSTALL_DIR} ln -s /usr/lib/systemd/user/pipewire-pulse.service /home/${WINESAPOS_USER_NAME}/.config/systemd/user/default.target.wants/pipewire-pulse.service
+mkdir -p "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.config/systemd/user/default.target.wants/
+chroot "${WINESAPOS_INSTALL_DIR}" ln -s /usr/lib/systemd/user/pipewire.service /home/"${WINESAPOS_USER_NAME}"/.config/systemd/user/default.target.wants/pipewire.service
+chroot "${WINESAPOS_INSTALL_DIR}" ln -s /usr/lib/systemd/user/pipewire-pulse.service /home/"${WINESAPOS_USER_NAME}"/.config/systemd/user/default.target.wants/pipewire-pulse.service
# Custom systemd service to mute the audio on start.
# https://github.com/winesapOS/winesapOS/issues/172
-cp ../rootfs/etc/systemd/user/winesapos-mute.service ${WINESAPOS_INSTALL_DIR}/etc/systemd/user/
-cp ../rootfs/usr/local/bin/winesapos-mute.sh ${WINESAPOS_INSTALL_DIR}/usr/local/bin/
-chroot ${WINESAPOS_INSTALL_DIR} ln -s /etc/systemd/user/winesapos-mute.service /home/${WINESAPOS_USER_NAME}/.config/systemd/user/default.target.wants/winesapos-mute.service
+cp ../rootfs/etc/systemd/user/winesapos-mute.service "${WINESAPOS_INSTALL_DIR}"/etc/systemd/user/
+cp ../rootfs/usr/local/bin/winesapos-mute.sh "${WINESAPOS_INSTALL_DIR}"/usr/local/bin/
+chroot "${WINESAPOS_INSTALL_DIR}" ln -s /etc/systemd/user/winesapos-mute.service /home/"${WINESAPOS_USER_NAME}"/.config/systemd/user/default.target.wants/winesapos-mute.service
# PulseAudio Control is a GUI used for managing PulseAudio (or, in our case, PipeWire-Pulse).
pacman_install_chroot pavucontrol
echo "Installing sound drivers complete."
@@ -569,8 +571,8 @@ echo "Installing sound drivers complete."
echo "Installing balenaEtcher..."
# Etcher by balena.
export ETCHER_VER="1.19.21"
-wget "https://github.com/balena-io/etcher/releases/download/v${ETCHER_VER}/balenaEtcher-${ETCHER_VER}-x64.AppImage" -O ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/balenaEtcher.AppImage
-chmod +x ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/balenaEtcher.AppImage
+wget "https://github.com/balena-io/etcher/releases/download/v${ETCHER_VER}/balenaEtcher-${ETCHER_VER}-x64.AppImage" -O "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/balenaEtcher.AppImage
+chmod +x "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/balenaEtcher.AppImage
echo "Installing balenaEtcher complete."
if [[ "${WINESAPOS_INSTALL_PRODUCTIVITY_TOOLS}" == "true" ]]; then
@@ -580,7 +582,7 @@ if [[ "${WINESAPOS_INSTALL_PRODUCTIVITY_TOOLS}" == "true" ]]; then
# ClamAV anti-virus.
pacman_install_chroot clamav clamtk
## Download an offline database for ClamAV.
- chroot ${WINESAPOS_INSTALL_DIR} freshclam
+ chroot "${WINESAPOS_INSTALL_DIR}" freshclam
# Distrobox.
pacman_install_chroot distrobox podman
@@ -602,8 +604,8 @@ echo "Installing Firefox ESR complete."
echo "Installing Oh My Zsh..."
pacman_install_chroot zsh
yay_install_chroot oh-my-zsh-git
-cp ${WINESAPOS_INSTALL_DIR}/usr/share/oh-my-zsh/zshrc ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.zshrc
-chown 1000:1000 ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.zshrc
+cp "${WINESAPOS_INSTALL_DIR}"/usr/share/oh-my-zsh/zshrc "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.zshrc
+chown 1000:1000 "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.zshrc
echo "Installing Oh My Zsh complete."
if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
@@ -617,8 +619,8 @@ SigLevel = Never
[Redecorating-t2]
Server = https://github.com/Redecorating/archlinux-t2-packages/releases/download/packages
-SigLevel = Never" >> ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
- chroot ${WINESAPOS_INSTALL_DIR} pacman -S -y
+SigLevel = Never" >> "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf
+ chroot "${WINESAPOS_INSTALL_DIR}" pacman -S -y
# linux-fsync-nobara-bin provides many patches including patches from linux-t2.
# https://pagure.io/kernel-fsync/blob/main/f/SOURCES/t2linux.patch
yay_install_chroot linux-fsync-nobara-bin
@@ -634,9 +636,9 @@ SigLevel = Never" >> ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
echo "Setting up Pacman to disable Linux kernel updates..."
if [[ "${WINESAPOS_DISTRO}" == "manjaro" ]]; then
- chroot ${WINESAPOS_INSTALL_DIR} crudini --set /etc/pacman.conf options IgnorePkg "linux66 linux66-headers linux-fsync-nobara-bin filesystem"
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --set /etc/pacman.conf options IgnorePkg "linux66 linux66-headers linux-fsync-nobara-bin filesystem"
elif [[ "${WINESAPOS_DISTRO}" == "arch" ]]; then
- chroot ${WINESAPOS_INSTALL_DIR} crudini --set /etc/pacman.conf options IgnorePkg "linux-lts linux-lts-headers linux-fsync-nobara-bin filesystem"
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --set /etc/pacman.conf options IgnorePkg "linux-lts linux-lts-headers linux-fsync-nobara-bin filesystem"
fi
echo "Setting up Pacman to disable Linux kernel updates complete."
@@ -726,33 +728,33 @@ echo "XFS"
pacman_install_chroot xfsprogs
echo "ZFS"
yay_install_chroot zfs-dkms zfs-utils
-echo -e "apfs\nbtrfs\next4\nexfat\nfat\nhfs\nhfsplus\nntfs3\nzfs" > ${WINESAPOS_INSTALL_DIR}/etc/modules-load.d/winesapos-file-systems.conf
+echo -e "apfs\nbtrfs\next4\nexfat\nfat\nhfs\nhfsplus\nntfs3\nzfs" > "${WINESAPOS_INSTALL_DIR}"/etc/modules-load.d/winesapos-file-systems.conf
echo "Installing additional file system support complete."
echo "Optimizing battery life..."
yay_install_chroot auto-cpufreq
-chroot ${WINESAPOS_INSTALL_DIR} systemctl enable auto-cpufreq
+chroot "${WINESAPOS_INSTALL_DIR}" systemctl enable auto-cpufreq
echo "Optimizing battery life complete."
echo "Minimizing writes to the disk..."
-chroot ${WINESAPOS_INSTALL_DIR} crudini --set /etc/systemd/journald.conf Journal Storage volatile
+chroot "${WINESAPOS_INSTALL_DIR}" crudini --set /etc/systemd/journald.conf Journal Storage volatile
echo "Minimizing writes to the disk compelete."
#echo "Increasing open file limits..."
# This is no longer needed as of filesystem-2024.04.07-1.
# https://archlinux.org/news/increasing-the-default-vmmax_map_count-value/
#echo "vm.max_map_count=16777216
-#fs.file-max=524288" >> ${WINESAPOS_INSTALL_DIR}/etc/sysctl.d/00-winesapos.conf
+#fs.file-max=524288" >> "${WINESAPOS_INSTALL_DIR}"/etc/sysctl.d/00-winesapos.conf
echo "Increasing RAM cache size and time for writes..."
echo "vm.dirty_background_ratio = 40
vm.dirty_ratio = 80
-vm.vfs_cache_pressure = 50" >> ${WINESAPOS_INSTALL_DIR}/etc/sysctl.d/50-winesapos-ram-write-cache.conf
+vm.vfs_cache_pressure = 50" >> "${WINESAPOS_INSTALL_DIR}"/etc/sysctl.d/50-winesapos-ram-write-cache.conf
echo "Increasing RAM cache size and time for writes complete."
-mkdir -p ${WINESAPOS_INSTALL_DIR}/etc/systemd/system.conf.d/
+mkdir -p "${WINESAPOS_INSTALL_DIR}"/etc/systemd/system.conf.d/
echo "[Manager]
-DefaultLimitNOFILE=524288" > ${WINESAPOS_INSTALL_DIR}/etc/systemd/system.conf.d/20-file-limits.conf
+DefaultLimitNOFILE=524288" > "${WINESAPOS_INSTALL_DIR}"/etc/systemd/system.conf.d/20-file-limits.conf
echo "Increasing open file limits complete."
echo "Setting up the desktop environment..."
@@ -764,26 +766,26 @@ yay_install_chroot xwayland-run-git weston libwayland-server
pacman_install_chroot sddm
# Hide UIDs of Nix build users.
# https://github.com/winesapOS/winesapOS/issues/840
-mkdir -p ${WINESAPOS_INSTALL_DIR}/etc/sddm.conf.d/
-touch ${WINESAPOS_INSTALL_DIR}/etc/sddm.conf.d/uid.conf
-chroot ${WINESAPOS_INSTALL_DIR} crudini --set /etc/sddm.conf.d/uid.conf Users MaximumUid 2999
+mkdir -p "${WINESAPOS_INSTALL_DIR}"/etc/sddm.conf.d/
+touch "${WINESAPOS_INSTALL_DIR}"/etc/sddm.conf.d/uid.conf
+chroot "${WINESAPOS_INSTALL_DIR}" crudini --set /etc/sddm.conf.d/uid.conf Users MaximumUid 2999
# Set up the SDDM failover handler.
-mkdir -p ${WINESAPOS_INSTALL_DIR}/etc/systemd/system/sddm.service.d
-cp ../rootfs/etc/systemd/system/winesapos-sddm-health-check.service ${WINESAPOS_INSTALL_DIR}/etc/systemd/system/
-cp ../rootfs/usr/local/bin/winesapos-sddm-health-check.sh ${WINESAPOS_INSTALL_DIR}/usr/local/bin/
-chroot ${WINESAPOS_INSTALL_DIR} systemctl enable winesapos-sddm-health-check
+mkdir -p "${WINESAPOS_INSTALL_DIR}"/etc/systemd/system/sddm.service.d
+cp ../rootfs/etc/systemd/system/winesapos-sddm-health-check.service "${WINESAPOS_INSTALL_DIR}"/etc/systemd/system/
+cp ../rootfs/usr/local/bin/winesapos-sddm-health-check.sh "${WINESAPOS_INSTALL_DIR}"/usr/local/bin/
+chroot "${WINESAPOS_INSTALL_DIR}" systemctl enable winesapos-sddm-health-check
# iPhone file transfer and and Internet tethering support.
## Install these dependencies first because 'plasma-meta' depends on 'usbmuxd'.
pacman_install_chroot libimobiledevice usbmuxd
## Replace the udev rules with new ones that workaround Mac driver issues.
## https://github.com/winesapOS/winesapOS/issues/660
-rm -f ${WINESAPOS_INSTALL_DIR}/usr/lib/udev/rules.d/39-usbmuxd.rules
-wget "https://raw.githubusercontent.com/libimobiledevice/usbmuxd/master/udev/39-usbmuxd.rules.in" -O ${WINESAPOS_INSTALL_DIR}/usr/lib/udev/rules.d/39-usbmuxd.rules
+rm -f "${WINESAPOS_INSTALL_DIR}"/usr/lib/udev/rules.d/39-usbmuxd.rules
+wget "https://raw.githubusercontent.com/libimobiledevice/usbmuxd/master/udev/39-usbmuxd.rules.in" -O "${WINESAPOS_INSTALL_DIR}"/usr/lib/udev/rules.d/39-usbmuxd.rules
# Lenovo Legion Go controller support for Linux kernel < 6.8.
echo "# Lenovo Legion Go
-ACTION==\"add\", ATTRS{idVendor}==\"17ef\", ATTRS{idProduct}==\"6182\", RUN+=\"/sbin/modprobe xpad\" RUN+=\"/bin/sh -c 'echo 17ef 6182 > /sys/bus/usb/drivers/xpad/new_id'\"" > ${WINESAPOS_INSTALL_DIR}/usr/lib/udev/rules.d/50-lenovo-legion-controller.rules
+ACTION==\"add\", ATTRS{idVendor}==\"17ef\", ATTRS{idProduct}==\"6182\", RUN+=\"/sbin/modprobe xpad\" RUN+=\"/bin/sh -c 'echo 17ef 6182 > /sys/bus/usb/drivers/xpad/new_id'\"" > "${WINESAPOS_INSTALL_DIR}"/usr/lib/udev/rules.d/50-lenovo-legion-controller.rules
# AYANEO LED controls.
yay_install_chroot ayaneo-platform-dkms-git ayaled-updated
@@ -829,7 +831,7 @@ elif [[ "${WINESAPOS_DE}" == "plasma" ]]; then
pacman_install_chroot plasma-meta plasma-nm
# Dolphin file manager and related plugins.
pacman_install_chroot dolphin ffmpegthumbs kdegraphics-thumbnailers konsole
- chroot ${WINESAPOS_INSTALL_DIR} crudini --ini-options=nospace --set /etc/xdg/konsolerc "Desktop Entry" DefaultProfile Vapor.profile
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --ini-options=nospace --set /etc/xdg/konsolerc "Desktop Entry" DefaultProfile Vapor.profile
# Image gallery and text editor.
pacman_install_chroot gwenview kate
@@ -840,35 +842,35 @@ elif [[ "${WINESAPOS_DE}" == "plasma" ]]; then
fi
if [[ "${WINESAPOS_DISABLE_KWALLET}" == "true" ]]; then
- mkdir -p ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.config/
- touch ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.config/kwalletrc
- chroot ${WINESAPOS_INSTALL_DIR} crudini --set /home/${WINESAPOS_USER_NAME}/.config/kwalletrc Wallet Enabled false
- chroot ${WINESAPOS_INSTALL_DIR} chown -R ${WINESAPOS_USER_NAME}:${WINESAPOS_USER_NAME} /home/${WINESAPOS_USER_NAME}/.config
+ mkdir -p "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.config/
+ touch "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.config/kwalletrc
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --set /home/"${WINESAPOS_USER_NAME}"/.config/kwalletrc Wallet Enabled false
+ chroot "${WINESAPOS_INSTALL_DIR}" chown -R "${WINESAPOS_USER_NAME}":"${WINESAPOS_USER_NAME}" /home/"${WINESAPOS_USER_NAME}"/.config
fi
# Klipper cannot be fully disabled via the CLI so we limit this service as much as possible.
# https://github.com/winesapOS/winesapOS/issues/368
if [[ "${WINESAPOS_ENABLE_KLIPPER}" == "false" ]]; then
- mkdir -p ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.config/
- mkdir -p ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.local/share/klipper
- touch ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.config/klipperrc
+ mkdir -p "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.config/
+ mkdir -p "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.local/share/klipper
+ touch "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.config/klipperrc
# Clear out the history during logout.
- chroot ${WINESAPOS_INSTALL_DIR} crudini --set /home/${WINESAPOS_USER_NAME}/.config/klipperrc General KeepClipboardContents false
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --set /home/"${WINESAPOS_USER_NAME}"/.config/klipperrc General KeepClipboardContents false
# Lower the number of items to keep in history from 20 down to 1.
- chroot ${WINESAPOS_INSTALL_DIR} crudini --set /home/${WINESAPOS_USER_NAME}/.config/klipperrc General MaxClipItems 1
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --set /home/"${WINESAPOS_USER_NAME}"/.config/klipperrc General MaxClipItems 1
# Allow password managers to set an empty clipboard.
- chroot ${WINESAPOS_INSTALL_DIR} crudini --set /home/${WINESAPOS_USER_NAME}/.config/klipperrc General PreventEmptyClipboard false
- chroot ${WINESAPOS_INSTALL_DIR} chown -R ${WINESAPOS_USER_NAME}:${WINESAPOS_USER_NAME} /home/${WINESAPOS_USER_NAME}/.config
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --set /home/"${WINESAPOS_USER_NAME}"/.config/klipperrc General PreventEmptyClipboard false
+ chroot "${WINESAPOS_INSTALL_DIR}" chown -R "${WINESAPOS_USER_NAME}":"${WINESAPOS_USER_NAME}" /home/"${WINESAPOS_USER_NAME}"/.config
# Ensure that the history is never saved to the local storage and only lives in RAM.
- echo "ramfs /home/${WINESAPOS_USER_NAME}/.local/share/klipper ramfs rw,nosuid,nodev 0 0" >> ${WINESAPOS_INSTALL_DIR}/etc/fstab
+ echo "ramfs /home/${WINESAPOS_USER_NAME}/.local/share/klipper ramfs rw,nosuid,nodev 0 0" >> "${WINESAPOS_INSTALL_DIR}"/etc/fstab
fi
# Configure the Plasma (Wayland) session to be the default.
# https://github.com/winesapOS/winesapOS/issues/841
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "manjaro" ]]; then
- mv ${WINESAPOS_INSTALL_DIR}/usr/share/wayland-sessions/plasmawayland.desktop ${WINESAPOS_INSTALL_DIR}/usr/share/wayland-sessions/0plasmawayland.desktop
+ mv "${WINESAPOS_INSTALL_DIR}"/usr/share/wayland-sessions/plasmawayland.desktop "${WINESAPOS_INSTALL_DIR}"/usr/share/wayland-sessions/0plasmawayland.desktop
else
- mv ${WINESAPOS_INSTALL_DIR}/usr/share/wayland-sessions/plasma.desktop ${WINESAPOS_INSTALL_DIR}/usr/share/wayland-sessions/0plasma.desktop
+ mv "${WINESAPOS_INSTALL_DIR}"/usr/share/wayland-sessions/plasma.desktop "${WINESAPOS_INSTALL_DIR}"/usr/share/wayland-sessions/0plasma.desktop
fi
pacman_install_chroot kdeconnect
@@ -882,29 +884,29 @@ elif [[ "${WINESAPOS_DE}" == "plasma-mobile" ]]; then
fi
# Start SDDM. This will provide an option of which desktop environment to load.
-chroot ${WINESAPOS_INSTALL_DIR} systemctl enable sddm
+chroot "${WINESAPOS_INSTALL_DIR}" systemctl enable sddm
# Install Bluetooth.
pacman_install_chroot bluez bluez-utils blueman bluez-qt
-chroot ${WINESAPOS_INSTALL_DIR} systemctl enable bluetooth
+chroot "${WINESAPOS_INSTALL_DIR}" systemctl enable bluetooth
## This is required to turn Bluetooth on or off.
-chroot ${WINESAPOS_INSTALL_DIR} usermod -a -G rfkill ${WINESAPOS_USER_NAME}
+chroot "${WINESAPOS_INSTALL_DIR}" usermod -a -G rfkill "${WINESAPOS_USER_NAME}"
# Install printer drivers.
pacman_install_chroot cups libcups lib32-libcups bluez-cups cups-pdf usbutils
-chroot ${WINESAPOS_INSTALL_DIR} systemctl enable cups
-mkdir -p ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+chroot "${WINESAPOS_INSTALL_DIR}" systemctl enable cups
+mkdir -p "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
echo "Setting up the desktop environment complete."
echo 'Setting up the additional package managers...'
yay_install_chroot appimagepool-appimage bauh snapd
-chroot ${WINESAPOS_INSTALL_DIR} systemctl enable snapd
+chroot "${WINESAPOS_INSTALL_DIR}" systemctl enable snapd
# Enable support for classic Snaps.
-mkdir -p ${WINESAPOS_INSTALL_DIR}/var/lib/snapd/snap
-ln -s /var/lib/snapd/snap ${WINESAPOS_INSTALL_DIR}/snap
+mkdir -p "${WINESAPOS_INSTALL_DIR}"/var/lib/snapd/snap
+ln -s /var/lib/snapd/snap "${WINESAPOS_INSTALL_DIR}"/snap
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "manjaro" ]]; then
- chroot ${WINESAPOS_INSTALL_DIR} ${CMD_PACMAN_INSTALL[*]} appimagelauncher
+ chroot "${WINESAPOS_INSTALL_DIR}" "${CMD_PACMAN_INSTALL[@]}" appimagelauncher
else
- chroot ${WINESAPOS_INSTALL_DIR} ${CMD_YAY_INSTALL[*]} appimagelauncher
+ chroot "${WINESAPOS_INSTALL_DIR}" "${CMD_YAY_INSTALL[@]}" appimagelauncher
fi
echo 'Setting up additional package managers complete.'
@@ -926,7 +928,7 @@ if [[ "${WINESAPOS_INSTALL_GAMING_TOOLS}" == "true" ]]; then
# OpenRazer.
pacman_install_chroot openrazer-daemon openrazer-driver-dkms python-pyqt5 python-openrazer
yay_install_chroot polychromatic
- chroot ${WINESAPOS_INSTALL_DIR} gpasswd -a ${WINESAPOS_USER_NAME} plugdev
+ chroot "${WINESAPOS_INSTALL_DIR}" gpasswd -a "${WINESAPOS_USER_NAME}" plugdev
# MangoHud.
yay_install_chroot mangohud-git lib32-mangohud-git
# GOverlay.
@@ -947,8 +949,8 @@ if [[ "${WINESAPOS_INSTALL_GAMING_TOOLS}" == "true" ]]; then
# EmuDeck.
EMUDECK_GITHUB_URL="https://api.github.com/repos/EmuDeck/emudeck-electron/releases/latest"
EMUDECK_URL="$(curl -s ${EMUDECK_GITHUB_URL} | grep -E 'browser_download_url.*AppImage' | cut -d '"' -f 4)"
- wget "${EMUDECK_URL}" -O ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/EmuDeck.AppImage
- chmod +x ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/EmuDeck.AppImage
+ wget "${EMUDECK_URL}" -O "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/EmuDeck.AppImage
+ chmod +x "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/EmuDeck.AppImage
# Steam.
pacman_install_chroot steam steam-native-runtime
# Steam Tinker Launch.
@@ -956,97 +958,97 @@ if [[ "${WINESAPOS_INSTALL_GAMING_TOOLS}" == "true" ]]; then
# Decky Loader.
## First install the 'zenity' dependency.
pacman_install_chroot zenity
- wget "https://github.com/SteamDeckHomebrew/decky-installer/releases/latest/download/decky_installer.desktop" -O ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/decky_installer.desktop
- chroot ${WINESAPOS_INSTALL_DIR} crudini --ini-options=nospace --set /home/${WINESAPOS_USER_NAME}/Desktop/decky_installer.desktop "Desktop Entry" Icon steam
+ wget "https://github.com/SteamDeckHomebrew/decky-installer/releases/latest/download/decky_installer.desktop" -O "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/decky_installer.desktop
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --ini-options=nospace --set /home/"${WINESAPOS_USER_NAME}"/Desktop/decky_installer.desktop "Desktop Entry" Icon steam
# NonSteamLaunchers.
- wget "https://raw.githubusercontent.com/moraroy/NonSteamLaunchers-On-Steam-Deck/refs/heads/main/NonSteamLaunchers.desktop" -O ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/NonSteamLaunchers.desktop
+ wget "https://raw.githubusercontent.com/moraroy/NonSteamLaunchers-On-Steam-Deck/refs/heads/main/NonSteamLaunchers.desktop" -O "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/NonSteamLaunchers.desktop
echo "Installing gaming tools complete."
fi
echo "Setting up desktop shortcuts..."
-cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/appimagepool.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
-cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/bauh.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
-cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/blueman-manager.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
-cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/firefox-esr.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
-cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/terminator.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/appimagepool.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
+cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/bauh.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
+cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/blueman-manager.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
+cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/firefox-esr.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
+cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/terminator.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
if [[ "${WINESAPOS_DE}" == "cinnamon" ]]; then
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/nemo.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/org.kde.pix.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/nemo.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/org.kde.pix.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
elif [[ "${WINESAPOS_DE}" == "gnome" ]]; then
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/org.gnome.eog.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/org.gnome.Nautilus.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/org.gnome.eog.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/org.gnome.Nautilus.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
elif [[ "${WINESAPOS_DE}" == "plasma" ]]; then
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/org.kde.dolphin.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/org.kde.gwenview.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/org.kde.dolphin.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/org.kde.gwenview.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
fi
-mkdir -p ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.winesapos/
-cp ../rootfs/home/winesap/.winesapos/winesapos-ngfn.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.winesapos/
-cp ../rootfs/home/winesap/.winesapos/winesapos-xcloud.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.winesapos/
+mkdir -p "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.winesapos/
+cp ../rootfs/home/winesap/.winesapos/winesapos-ngfn.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.winesapos/
+cp ../rootfs/home/winesap/.winesapos/winesapos-xcloud.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.winesapos/
if [[ "${WINESAPOS_INSTALL_GAMING_TOOLS}" == "true" ]]; then
# GOverlay.
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/io.github.benjamimgois.goverlay.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/io.github.benjamimgois.goverlay.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
# Ludusavi.
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/com.github.mtkennerly.ludusavi.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/com.github.mtkennerly.ludusavi.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
# Nexus Mods app.
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/com.nexusmods.app.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/com.nexusmods.app.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
# Oversteer.
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/io.github.berarma.Oversteer.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/io.github.berarma.Oversteer.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
# Polychromatic.
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/polychromatic.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/polychromatic.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
# Steam.
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/steam.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/steam.desktop
- chmod +x ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/steam.desktop
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/steamtinkerlaunch.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
- chmod +x ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/steamtinkerlaunch.desktop
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/steam.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/steam.desktop
+ chmod +x "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/steam.desktop
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/steamtinkerlaunch.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
+ chmod +x "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/steamtinkerlaunch.desktop
# ZeroTier GUI.
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/zerotier-gui.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/zerotier-gui.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
fi
if [[ "${WINESAPOS_INSTALL_PRODUCTIVITY_TOOLS}" == "true" ]]; then
# ClamTk (ClamAV GUI).
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/clamtk.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/clamtk.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
# CoolerControl.
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/org.coolercontrol.CoolerControl.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/org.coolercontrol.CoolerControl.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
# GParted.
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/gparted.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/gparted.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
# QDirStat.
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/qdirstat.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/qdirstat.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
# Spectacle.
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/org.kde.spectacle.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/org.kde.spectacle.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
# VeraCrypt.
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/veracrypt.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/veracrypt.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
fi
if [[ "${WINESAPOS_FIREWALL}" == "true" ]]; then
- cp ${WINESAPOS_INSTALL_DIR}/usr/share/applications/firewall-config.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/
+ cp "${WINESAPOS_INSTALL_DIR}"/usr/share/applications/firewall-config.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/
fi
# Fix permissions on the desktop shortcuts.
-chmod +x ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/*.desktop
-chown -R 1000:1000 ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop
+chmod +x "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/*.desktop
+chown -R 1000:1000 "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop
echo "Setting up desktop shortcuts complete."
echo "Setting up additional Mac drivers..."
# Enable the T2 driver on boot.
-sed -i s'/MODULES=(/MODULES=(apple-bce /'g ${WINESAPOS_INSTALL_DIR}/etc/mkinitcpio.conf
-echo apple-bce >> ${WINESAPOS_INSTALL_DIR}/etc/modules-load.d/winesapos-mac.conf
+sed -i 's/MODULES=(/MODULES=(apple-bce /g' "${WINESAPOS_INSTALL_DIR}"/etc/mkinitcpio.conf
+echo apple-bce >> "${WINESAPOS_INSTALL_DIR}"/etc/modules-load.d/winesapos-mac.conf
# Delay the start of the Touch Bar driver.
# This works around a known bug where the driver cannot be configured.
# https://wiki.t2linux.org/guides/postinstall/
-echo -e "install apple-touchbar /bin/sleep 10; /sbin/modprobe --ignore-install apple-touchbar" >> ${WINESAPOS_INSTALL_DIR}/etc/modprobe.d/winesapos-mac.conf
+echo -e "install apple-touchbar /bin/sleep 10; /sbin/modprobe --ignore-install apple-touchbar" >> "${WINESAPOS_INSTALL_DIR}"/etc/modprobe.d/winesapos-mac.conf
echo "Setting up additional Mac drivers complete."
echo "Setting up fan drivers..."
# Apple Macs.
yay_install_chroot mbpfan-git
-chroot ${WINESAPOS_INSTALL_DIR} crudini --set /etc/mbpfan.conf general min_fan_speed 1300
-chroot ${WINESAPOS_INSTALL_DIR} crudini --set /etc/mbpfan.conf general max_fan_speed 6200
-chroot ${WINESAPOS_INSTALL_DIR} crudini --set /etc/mbpfan.conf general max_temp 105
+chroot "${WINESAPOS_INSTALL_DIR}" crudini --set /etc/mbpfan.conf general min_fan_speed 1300
+chroot "${WINESAPOS_INSTALL_DIR}" crudini --set /etc/mbpfan.conf general max_fan_speed 6200
+chroot "${WINESAPOS_INSTALL_DIR}" crudini --set /etc/mbpfan.conf general max_temp 105
# OneXPlayer handhelds.
yay_install_chroot oxp-sensors-dkms-git
@@ -1058,9 +1060,9 @@ echo "Setting mkinitcpio modules and hooks order..."
# https://github.com/winesapOS/winesapOS/issues/94
if [[ "${WINESAPOS_ENCRYPT}" == "true" ]]; then
# Also add 'keymap' and 'encrypt' for LUKS encryption support.
- sed -i s'/HOOKS=.*/HOOKS=(base microcode udev block keyboard keymap modconf encrypt filesystems fsck)/'g ${WINESAPOS_INSTALL_DIR}/etc/mkinitcpio.conf
+ sed -i 's/HOOKS=.*/HOOKS=(base microcode udev block keyboard keymap modconf encrypt filesystems fsck)/g' "${WINESAPOS_INSTALL_DIR}"/etc/mkinitcpio.conf
else
- sed -i s'/HOOKS=.*/HOOKS=(base microcode udev block keyboard modconf filesystems fsck)/'g ${WINESAPOS_INSTALL_DIR}/etc/mkinitcpio.conf
+ sed -i 's/HOOKS=.*/HOOKS=(base microcode udev block keyboard modconf filesystems fsck)/g' "${WINESAPOS_INSTALL_DIR}"/etc/mkinitcpio.conf
fi
echo "Setting mkinitcpio modules and hooks order complete."
@@ -1068,85 +1070,86 @@ echo "Setting mkinitcpio modules and hooks order complete."
if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
echo "Setting up the bootloader..."
if [[ "${WINESAPOS_BOOTLOADER}" == "grub" ]]; then
- cp ../rootfs/usr/share/libalpm/hooks/winesapos-etc-grub.d-10_linux.hook ${WINESAPOS_INSTALL_DIR}/usr/share/libalpm/hooks/
- cp ../rootfs/usr/share/libalpm/hooks/winesapos-usr-share-grub-grub-mkconfig_lib.hook ${WINESAPOS_INSTALL_DIR}/usr/share/libalpm/hooks/
+ cp ../rootfs/usr/share/libalpm/hooks/winesapos-etc-grub.d-10_linux.hook "${WINESAPOS_INSTALL_DIR}"/usr/share/libalpm/hooks/
+ cp ../rootfs/usr/share/libalpm/hooks/winesapos-usr-share-grub-grub-mkconfig_lib.hook "${WINESAPOS_INSTALL_DIR}"/usr/share/libalpm/hooks/
pacman_install_chroot core/grub
# Remove the redundant fallback initramfs because our normal initramfs is exactly the same.
- sed -i s"/PRESETS=('default' 'fallback')/PRESETS=('default')/"g ${WINESAPOS_INSTALL_DIR}/etc/mkinitcpio.d/*.preset
- rm -f ${WINESAPOS_INSTALL_DIR}/boot/*-fallback.img
- chroot ${WINESAPOS_INSTALL_DIR} mkinitcpio -P
+ sed -i "s/PRESETS=('default' 'fallback')/PRESETS=('default')/g" "${WINESAPOS_INSTALL_DIR}"/etc/mkinitcpio.d/*.preset
+ rm -f "${WINESAPOS_INSTALL_DIR}"/boot/*-fallback.img
+ chroot "${WINESAPOS_INSTALL_DIR}" mkinitcpio -P
# These two configuration lines allow the GRUB menu to show on boot.
# https://github.com/winesapOS/winesapOS/issues/41
- chroot ${WINESAPOS_INSTALL_DIR} crudini --ini-options=nospace --set /etc/default/grub "" GRUB_TIMEOUT 10
- chroot ${WINESAPOS_INSTALL_DIR} crudini --ini-options=nospace --set /etc/default/grub "" GRUB_TIMEOUT_STYLE menu
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --ini-options=nospace --set /etc/default/grub "" GRUB_TIMEOUT 10
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --ini-options=nospace --set /etc/default/grub "" GRUB_TIMEOUT_STYLE menu
if [[ "${WINESAPOS_APPARMOR}" == "true" ]]; then
echo "Enabling AppArmor in the Linux kernel..."
- sed -i s'/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="apparmor=1 security=apparmor /'g ${WINESAPOS_INSTALL_DIR}/etc/default/grub
+ sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="apparmor=1 security=apparmor /g' "${WINESAPOS_INSTALL_DIR}"/etc/default/grub
echo "Enabling AppArmor in the Linux kernel complete."
fi
if [[ "${WINESAPOS_CPU_MITIGATIONS}" == "false" ]]; then
echo "Enabling Linux kernel-level CPU exploit mitigations..."
- sed -i s'/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="mitigations=off /'g ${WINESAPOS_INSTALL_DIR}/etc/default/grub
+ sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="mitigations=off /g' "${WINESAPOS_INSTALL_DIR}"/etc/default/grub
echo "Enabling Linux kernel-level CPU exploit mitigations done."
fi
# Enable Btrfs with zstd compression support.
# This will help allow GRUB to save the selected kernel for the next boot.
- sed -i s'/GRUB_PRELOAD_MODULES="/GRUB_PRELOAD_MODULES="btrfs zstd /'g ${WINESAPOS_INSTALL_DIR}/etc/default/grub
+ sed -i 's/GRUB_PRELOAD_MODULES="/GRUB_PRELOAD_MODULES="btrfs zstd /g' "${WINESAPOS_INSTALL_DIR}"/etc/default/grub
# Disable the submenu to show all boot kernels/options on the main GRUB menu.
- chroot ${WINESAPOS_INSTALL_DIR} crudini --ini-options=nospace --set /etc/default/grub "" GRUB_DISABLE_SUBMENU y
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --ini-options=nospace --set /etc/default/grub "" GRUB_DISABLE_SUBMENU y
# Configure the default Linux kernel for the first boot.
# This should be linux-fsync-nobara-bin.
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "manjaro" ]]; then
- chroot ${WINESAPOS_INSTALL_DIR} crudini --ini-options=nospace --set /etc/default/grub "" GRUB_DEFAULT '"winesapOS Linux (Kernel: bin)"'
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --ini-options=nospace --set /etc/default/grub "" GRUB_DEFAULT '"winesapOS Linux (Kernel: bin)"'
else
- chroot ${WINESAPOS_INSTALL_DIR} crudini --ini-options=nospace --set /etc/default/grub "" GRUB_DEFAULT '"winesapOS Linux, with Linux linux-fsync-nobara-bin"'
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --ini-options=nospace --set /etc/default/grub "" GRUB_DEFAULT '"winesapOS Linux, with Linux linux-fsync-nobara-bin"'
fi
# Use partitions labels for maximum portability.
- chroot ${WINESAPOS_INSTALL_DIR} crudini --ini-options=nospace --set /etc/default/grub "" GRUB_DISABLE_LINUX_UUID true
- chroot ${WINESAPOS_INSTALL_DIR} crudini --ini-options=nospace --set /etc/default/grub "" GRUB_DISABLE_LINUX_PARTUUID true
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --ini-options=nospace --set /etc/default/grub "" GRUB_DISABLE_LINUX_UUID true
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --ini-options=nospace --set /etc/default/grub "" GRUB_DISABLE_LINUX_PARTUUID true
# Setup the GRUB theme.
pacman_install_chroot grub-theme-vimix
## This theme needs to exist in the '/boot/' mount because if the root file system is encrypted, then the theme cannot be found.
- mkdir -p ${WINESAPOS_INSTALL_DIR}/boot/grub/themes/
- cp -R ${WINESAPOS_INSTALL_DIR}/usr/share/grub/themes/Vimix ${WINESAPOS_INSTALL_DIR}/boot/grub/themes/Vimix
- chroot ${WINESAPOS_INSTALL_DIR} crudini --ini-options=nospace --set /etc/default/grub "" GRUB_THEME /boot/grub/themes/Vimix/theme.txt
+ mkdir -p "${WINESAPOS_INSTALL_DIR}"/boot/grub/themes/
+ cp -R "${WINESAPOS_INSTALL_DIR}"/usr/share/grub/themes/Vimix "${WINESAPOS_INSTALL_DIR}"/boot/grub/themes/Vimix
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --ini-options=nospace --set /etc/default/grub "" GRUB_THEME /boot/grub/themes/Vimix/theme.txt
## Target 720p for the GRUB menu as a minimum to support devices such as the GPD Win.
## https://github.com/winesapOS/winesapOS/issues/327
- chroot ${WINESAPOS_INSTALL_DIR} crudini --ini-options=nospace --set /etc/default/grub "" GRUB_GFXMODE 1280x720,auto
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --ini-options=nospace --set /etc/default/grub "" GRUB_GFXMODE 1280x720,auto
## Setting the GFX payload to 'text' instead 'keep' makes booting more reliable by supporting all graphics devices.
## https://github.com/winesapOS/winesapOS/issues/327
- chroot ${WINESAPOS_INSTALL_DIR} crudini --ini-options=nospace --set /etc/default/grub "" GRUB_GFXPAYLOAD_LINUX text
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --ini-options=nospace --set /etc/default/grub "" GRUB_GFXPAYLOAD_LINUX text
# Set winesapOS name in the GRUB menu.
- chroot ${WINESAPOS_INSTALL_DIR} crudini --ini-options=nospace --set /etc/default/grub "" GRUB_DISTRIBUTOR winesapOS
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --ini-options=nospace --set /etc/default/grub "" GRUB_DISTRIBUTOR winesapOS
- chroot ${WINESAPOS_INSTALL_DIR} grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=winesapOS --removable --no-nvram
- parted ${DEVICE} set 1 bios_grub on
- chroot ${WINESAPOS_INSTALL_DIR} grub-install --target=i386-pc ${DEVICE}
+ chroot "${WINESAPOS_INSTALL_DIR}" grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=winesapOS --removable --no-nvram
+ parted "${DEVICE}" set 1 bios_grub on
+ chroot "${WINESAPOS_INSTALL_DIR}" grub-install --target=i386-pc "${DEVICE}"
if [[ "${WINESAPOS_ENCRYPT}" == "true" ]]; then
- sed -i s'/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="cryptdevice=LABEL=winesapos-luks:cryptroot root='$(echo ${root_partition} | sed -e s'/\//\\\//'g)' /'g ${WINESAPOS_INSTALL_DIR}/etc/default/grub
+ # shellcheck disable=SC2046
+ sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="cryptdevice=LABEL=winesapos-luks:cryptroot root='$(echo "${root_partition}" | sed -e 's/\//\\\//g')' /g' "${WINESAPOS_INSTALL_DIR}"/etc/default/grub
fi
# Configure higher polling frequencies for better compatibility with input devices.
- sed -i s'/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="usbhid.jspoll=1 usbhid.kbpoll=1 usbhid.mousepoll=1 /'g ${WINESAPOS_INSTALL_DIR}/etc/default/grub
+ sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="usbhid.jspoll=1 usbhid.kbpoll=1 usbhid.mousepoll=1 /g' "${WINESAPOS_INSTALL_DIR}"/etc/default/grub
# Configure support for NVMe drives.
- sed -i s'/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="nvme_load=yes /'g ${WINESAPOS_INSTALL_DIR}/etc/default/grub
+ sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="nvme_load=yes /g' "${WINESAPOS_INSTALL_DIR}"/etc/default/grub
# Configure the Intel Xe driver to work for the first generation of devices.
- sed -i s'/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="i915.force_probe=!9a49 xe.force_probe=9149 /'g ${WINESAPOS_INSTALL_DIR}/etc/default/grub
+ sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="i915.force_probe=!9a49 xe.force_probe=9149 /g' "${WINESAPOS_INSTALL_DIR}"/etc/default/grub
efi_partition=2
if [[ "${WINESAPOS_ENABLE_PORTABLE_STORAGE}" == "true" ]]; then
efi_partition=3
fi
- chroot ${WINESAPOS_INSTALL_DIR} grub-mkconfig -o /boot/grub/grub.cfg
+ chroot "${WINESAPOS_INSTALL_DIR}" grub-mkconfig -o /boot/grub/grub.cfg
elif [[ "${WINESAPOS_BOOTLOADER}" == "systemd-boot" ]]; then
- chroot ${WINESAPOS_INSTALL_DIR} bootctl --path=/boot install
+ chroot "${WINESAPOS_INSTALL_DIR}" bootctl --path=/boot install
echo "default winesapos.conf
timeout 4
console-mode max" > /boot/loader/loader.conf
@@ -1159,29 +1162,29 @@ options root=LABEL=winesapos-root rootflags=subvol=/ rw" > /boot/loader/entries/
fi
echo "Enabling Ventoy support..."
- cp ../rootfs/usr/local/bin/winesapos-ventoy-bootstrap.sh ${WINESAPOS_INSTALL_DIR}/usr/local/bin/
- chroot ${WINESAPOS_INSTALL_DIR} /usr/local/bin/winesapos-ventoy-bootstrap.sh
+ cp ../rootfs/usr/local/bin/winesapos-ventoy-bootstrap.sh "${WINESAPOS_INSTALL_DIR}"/usr/local/bin/
+ chroot "${WINESAPOS_INSTALL_DIR}" /usr/local/bin/winesapos-ventoy-bootstrap.sh
echo "Enabling Ventoy support complete."
echo "Setting up the bootloader complete."
fi
echo "Enabling optimal IO schedulers..."
-mkdir -p ${WINESAPOS_INSTALL_DIR}/etc/udev/rules.d/
+mkdir -p "${WINESAPOS_INSTALL_DIR}"/etc/udev/rules.d/
echo '# Serial drives and SD cards.
ACTION=="add|change", KERNEL=="sd[a-z]*|mmcblk[0-9]*", ATTR{queue/scheduler}="bfq"
# NVMe drives.
-ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/scheduler}="kyber"' > ${WINESAPOS_INSTALL_DIR}/etc/udev/rules.d/60-winesapos-io-schedulers.rules
+ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/scheduler}="kyber"' > "${WINESAPOS_INSTALL_DIR}"/etc/udev/rules.d/60-winesapos-io-schedulers.rules
echo "Enabling optimal IO schedulers complete."
echo "Setting up root file system resize script..."
# This package provides the required 'growpart' command.
pacman_install_chroot cloud-guest-utils
# Copy from the current directory which should be "scripts".
-cp ../rootfs/usr/local/bin/winesapos-resize-root-file-system.sh ${WINESAPOS_INSTALL_DIR}/usr/local/bin/
-cp ../rootfs/etc/systemd/system/winesapos-resize-root-file-system.service ${WINESAPOS_INSTALL_DIR}/etc/systemd/system/
-chroot ${WINESAPOS_INSTALL_DIR} systemctl enable winesapos-resize-root-file-system
+cp ../rootfs/usr/local/bin/winesapos-resize-root-file-system.sh "${WINESAPOS_INSTALL_DIR}"/usr/local/bin/
+cp ../rootfs/etc/systemd/system/winesapos-resize-root-file-system.service "${WINESAPOS_INSTALL_DIR}"/etc/systemd/system/
+chroot "${WINESAPOS_INSTALL_DIR}" systemctl enable winesapos-resize-root-file-system
echo "Setting up root file system resize script complete."
echo "Setting up the first-time setup script..."
@@ -1193,29 +1196,29 @@ pacman_install_chroot jq
## https://github.com/winesapOS/winesapOS/issues/848
yay_install_chroot tzupdate
# winesapOS first-time setup script.
-mkdir -p ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.config/autostart/
-cp ./winesapos-setup.sh ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.winesapos/
-cp ../rootfs/home/winesap/.winesapos/winesapos-setup.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.winesapos/
-sed -i s"/home\/winesap/home\/${WINESAPOS_USER_NAME}/"g ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-setup.desktop
-ln -s /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-setup.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.config/autostart/winesapos-setup.desktop
-ln -s /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-setup.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/winesapos-setup.desktop
+mkdir -p "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.config/autostart/
+cp ./winesapos-setup.sh "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.winesapos/
+cp ../rootfs/home/winesap/.winesapos/winesapos-setup.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.winesapos/
+sed -i "s/home\/winesap/home\/${WINESAPOS_USER_NAME}/g" "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-setup.desktop
+ln -s /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-setup.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.config/autostart/winesapos-setup.desktop
+ln -s /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-setup.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/winesapos-setup.desktop
## Install th required dependency for the setup script.
pacman_install_chroot kdialog
# winesapOS remote upgrade script.
-cp ../rootfs/home/winesap/.winesapos/winesapos-upgrade-remote-stable.sh ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.winesapos/
-cp ../rootfs/home/winesap/.winesapos/winesapos-upgrade.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.winesapos/
-sed -i s"/home\/winesap/home\/${WINESAPOS_USER_NAME}/"g ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade.desktop
-ln -s /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/winesapos-upgrade.desktop
+cp ../rootfs/home/winesap/.winesapos/winesapos-upgrade-remote-stable.sh "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.winesapos/
+cp ../rootfs/home/winesap/.winesapos/winesapos-upgrade.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.winesapos/
+sed -i "s/home\/winesap/home\/${WINESAPOS_USER_NAME}/g" "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade.desktop
+ln -s /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/winesapos-upgrade.desktop
# winesapOS icon used for both desktop shortcuts and the SDDM profile picture.
-cp ../rootfs/home/winesap/.winesapos/winesapos_logo_icon.png ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.winesapos/winesapos_logo_icon.png
+cp ../rootfs/home/winesap/.winesapos/winesapos_logo_icon.png "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos_logo_icon.png
## Using an actual file instead of a symlink works more reliably for loading it.
-cp ../rootfs/home/winesap/.winesapos/winesapos_logo_icon.png ${WINESAPOS_INSTALL_DIR}/usr/share/sddm/faces/${WINESAPOS_USER_NAME}.face.icon
+cp ../rootfs/home/winesap/.winesapos/winesapos_logo_icon.png "${WINESAPOS_INSTALL_DIR}"/usr/share/sddm/faces/"${WINESAPOS_USER_NAME}".face.icon
echo "Setting up the first-time setup script complete."
echo "Setting up the dual-boot script..."
-cp ../rootfs/usr/local/bin/winesapos-dual-boot.sh ${WINESAPOS_INSTALL_DIR}/usr/local/bin/
-cp ../rootfs/home/winesap/.winesapos/winesapos-dual-boot.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.winesapos/
-ln -s /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-dual-boot.desktop ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/winesapos-dual-boot.desktop
+cp ../rootfs/usr/local/bin/winesapos-dual-boot.sh "${WINESAPOS_INSTALL_DIR}"/usr/local/bin/
+cp ../rootfs/home/winesap/.winesapos/winesapos-dual-boot.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.winesapos/
+ln -s /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-dual-boot.desktop "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/winesapos-dual-boot.desktop
echo "Setting up the dual-boot script complete."
if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
@@ -1224,55 +1227,56 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
pacman_install_chroot grub-btrfs
fi
pacman_install_chroot snapper snap-pac
- chroot ${WINESAPOS_INSTALL_DIR} crudini --ini-options=nospace --set /etc/default/grub-btrfs/config "" GRUB_BTRFS_SUBMENUNAME "\"winesapOS snapshots\""
- cp ../rootfs/etc/snapper/configs/root ${WINESAPOS_INSTALL_DIR}/etc/snapper/configs/root
- cp ../rootfs/etc/snapper/configs/root ${WINESAPOS_INSTALL_DIR}/etc/snapper/configs/home
+ chroot "${WINESAPOS_INSTALL_DIR}" crudini --ini-options=nospace --set /etc/default/grub-btrfs/config "" GRUB_BTRFS_SUBMENUNAME "\"winesapOS snapshots\""
+ cp ../rootfs/etc/snapper/configs/root "${WINESAPOS_INSTALL_DIR}"/etc/snapper/configs/root
+ cp ../rootfs/etc/snapper/configs/root "${WINESAPOS_INSTALL_DIR}"/etc/snapper/configs/home
# Disable the timeline for the root configuration. Rely on 'snap-pac' instead.
- sed -i s'/TIMELINE_CREATE=.*/TIMELINE_CREATE=\"no\"/'g ${WINESAPOS_INSTALL_DIR}/etc/snapper/configs/root
- sed -i s'/SUBVOLUME=.*/SUBVOLUME=\"\/home\"/'g ${WINESAPOS_INSTALL_DIR}/etc/snapper/configs/home
- chroot ${WINESAPOS_INSTALL_DIR} chown -R root:root /etc/snapper/configs
- btrfs subvolume create ${WINESAPOS_INSTALL_DIR}/.snapshots
- btrfs subvolume create ${WINESAPOS_INSTALL_DIR}/home/.snapshots
+ sed -i 's/TIMELINE_CREATE=.*/TIMELINE_CREATE=\"no\"/g' "${WINESAPOS_INSTALL_DIR}"/etc/snapper/configs/root
+ sed -i 's/SUBVOLUME=.*/SUBVOLUME=\"\/home\"/g' "${WINESAPOS_INSTALL_DIR}"/etc/snapper/configs/home
+ chroot "${WINESAPOS_INSTALL_DIR}" chown -R root:root /etc/snapper/configs
+ btrfs subvolume create "${WINESAPOS_INSTALL_DIR}"/.snapshots
+ btrfs subvolume create "${WINESAPOS_INSTALL_DIR}"/home/.snapshots
# Ensure the new "root" and "home" configurations will be loaded.
- sed -i s'/SNAPPER_CONFIGS=\"\"/SNAPPER_CONFIGS=\"root home\"/'g ${WINESAPOS_INSTALL_DIR}/etc/conf.d/snapper
- chroot ${WINESAPOS_INSTALL_DIR} systemctl enable snapper-cleanup.timer snapper-timeline.timer
+ sed -i 's/SNAPPER_CONFIGS=\"\"/SNAPPER_CONFIGS=\"root home\"/g' "${WINESAPOS_INSTALL_DIR}"/etc/conf.d/snapper
+ chroot "${WINESAPOS_INSTALL_DIR}" systemctl enable snapper-cleanup.timer snapper-timeline.timer
echo "Configuring Btrfs backup tools complete."
fi
echo "Resetting the machine-id file..."
-echo -n | tee ${WINESAPOS_INSTALL_DIR}/etc/machine-id
-rm -f ${WINESAPOS_INSTALL_DIR}/var/lib/dbus/machine-id
-chroot ${WINESAPOS_INSTALL_DIR} ln -s /etc/machine-id /var/lib/dbus/machine-id
+echo -n | tee "${WINESAPOS_INSTALL_DIR}"/etc/machine-id
+rm -f "${WINESAPOS_INSTALL_DIR}"/var/lib/dbus/machine-id
+chroot "${WINESAPOS_INSTALL_DIR}" ln -s /etc/machine-id /var/lib/dbus/machine-id
echo "Resetting the machine-id file complete."
echo "Setting up winesapOS files..."
-mkdir ${WINESAPOS_INSTALL_DIR}/var/winesapos/
+mkdir "${WINESAPOS_INSTALL_DIR}"/var/winesapos/
# Create a symlink for backwards compatibility.
-chroot ${WINESAPOS_INSTALL_DIR} ln -s /var/winesapos /etc/winesapos
+chroot "${WINESAPOS_INSTALL_DIR}" ln -s /var/winesapos /etc/winesapos
# Secure this directory as it contains the verbose build log.
-chmod 0700 ${WINESAPOS_INSTALL_DIR}/var/winesapos/
-cp ../rootfs/usr/lib/os-release-winesapos ${WINESAPOS_INSTALL_DIR}/usr/lib/
-echo -e "VARIANT=\""${WINESAPOS_IMAGE_TYPE}""\"\\nVARIANT_ID=${WINESAPOS_IMAGE_TYPE} | tee -a ${WINESAPOS_INSTALL_DIR}/usr/lib/os-release-winesapos
-chroot ${WINESAPOS_INSTALL_DIR} ln -s /usr/lib/os-release-winesapos /etc/os-release-winesapos
-cp /tmp/winesapos-install.log ${WINESAPOS_INSTALL_DIR}/var/winesapos/
+chmod 0700 "${WINESAPOS_INSTALL_DIR}"/var/winesapos/
+cp ../rootfs/usr/lib/os-release-winesapos "${WINESAPOS_INSTALL_DIR}"/usr/lib/
+# shellcheck disable=SC2140
+echo -e "VARIANT=\"${WINESAPOS_IMAGE_TYPE}"\"\\nVARIANT_ID="${WINESAPOS_IMAGE_TYPE}" | tee -a "${WINESAPOS_INSTALL_DIR}"/usr/lib/os-release-winesapos
+chroot "${WINESAPOS_INSTALL_DIR}" ln -s /usr/lib/os-release-winesapos /etc/os-release-winesapos
+cp /tmp/winesapos-install.log "${WINESAPOS_INSTALL_DIR}"/var/winesapos/
# Continue to log to the file after it has been copied over.
-exec > >(tee -a ${WINESAPOS_INSTALL_DIR}/var/winesapos/winesapos-install.log) 2>&1
+exec > >(tee -a "${WINESAPOS_INSTALL_DIR}"/var/winesapos/winesapos-install.log) 2>&1
echo "Setting up winesapOS files complete."
echo "Setting up default text editor..."
-echo "EDITOR=nano" >> ${WINESAPOS_INSTALL_DIR}/etc/environment
+echo "EDITOR=nano" >> "${WINESAPOS_INSTALL_DIR}"/etc/environment
echo "Setting up default text editor complete."
echo "Cleaning up..."
# Temporarily add write permissions back to the file so we can modify it.
-chmod 0644 ${WINESAPOS_INSTALL_DIR}/etc/sudoers.d/winesap
+chmod 0644 "${WINESAPOS_INSTALL_DIR}"/etc/sudoers.d/winesap
if [[ "${WINESAPOS_SUDO_NO_PASSWORD}" == "false" ]]; then
echo "Require the 'winesap' user to enter a password when using sudo..."
- echo "${WINESAPOS_USER_NAME} ALL=(root) ALL" > ${WINESAPOS_INSTALL_DIR}/etc/sudoers.d/${WINESAPOS_USER_NAME}
+ echo "${WINESAPOS_USER_NAME} ALL=(root) ALL" > "${WINESAPOS_INSTALL_DIR}"/etc/sudoers.d/"${WINESAPOS_USER_NAME}"
# This command is required for the user 'winesapos-mute.service'.
- echo "${WINESAPOS_USER_NAME} ALL=(root) NOPASSWD: /usr/bin/dmidecode" >> ${WINESAPOS_INSTALL_DIR}/etc/sudoers.d/${WINESAPOS_USER_NAME}
+ echo "${WINESAPOS_USER_NAME} ALL=(root) NOPASSWD: /usr/bin/dmidecode" >> "${WINESAPOS_INSTALL_DIR}"/etc/sudoers.d/"${WINESAPOS_USER_NAME}"
echo "Require the 'winesap' user to enter a password when using sudo complete."
fi
@@ -1281,30 +1285,32 @@ fi
# Set the timeout to infinity (no timeout) by using a negative number.
# "sudo" also only allows 3 failed passwords before locking a user out from running privileged commands
# for a short period of time. Increase that to 20 tries to allow users to figure out their password.
-echo "Defaults:${WINESAPOS_USER_NAME} passwd_tries=20,timestamp_timeout=-1" >> ${WINESAPOS_INSTALL_DIR}/etc/sudoers.d/${WINESAPOS_USER_NAME}
-chmod 0440 ${WINESAPOS_INSTALL_DIR}/etc/sudoers.d/${WINESAPOS_USER_NAME}
+echo "Defaults:${WINESAPOS_USER_NAME} passwd_tries=20,timestamp_timeout=-1" >> "${WINESAPOS_INSTALL_DIR}"/etc/sudoers.d/"${WINESAPOS_USER_NAME}"
+chmod 0440 "${WINESAPOS_INSTALL_DIR}"/etc/sudoers.d/"${WINESAPOS_USER_NAME}"
-chown -R 1000:1000 ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}
+chown -R 1000:1000 "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"
# For some unknown reason, this empty directory gets populated in the chroot using the name of the live environment kernel.
# https://github.com/winesapOS/winesapOS/issues/607
LIVE_UNAME_R=$(uname -r)
-rm -r -f ${WINESAPOS_INSTALL_DIR}/lib/modules/${LIVE_UNAME_R}
+rm -r -f "${WINESAPOS_INSTALL_DIR}"/lib/modules/"${LIVE_UNAME_R}"
# Fix GPG errors due to incomplete keys.
# These configuration files will get properly recreated the next time GPG is used.
# https://github.com/winesapOS/winesapOS/issues/851
-rm -r -f ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.gnupg
+rm -r -f "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.gnupg
echo "Cleaning up complete."
if [[ "${WINESAPOS_PASSWD_EXPIRE}" == "true" ]]; then
- chroot ${WINESAPOS_INSTALL_DIR} passwd --expire root
+ chroot "${WINESAPOS_INSTALL_DIR}" passwd --expire root
fi
if [ -n "${WINESAPOS_HTTP_PROXY_CA}" ]; then
echo "Removing the proxy certificate authority from the chroot..."
- rm -f ${WINESAPOS_INSTALL_DIR}/etc/ca-certificates/trust-source/anchors/$(echo ${WINESAPOS_HTTP_PROXY_CA} | grep -o -P '[^\/]*$')
- chroot ${WINESAPOS_INSTALL_DIR} update-ca-trust
+ #TODO: Fix this ShellCheck error.
+ # shellcheck disable=SC2046
+ rm -f "${WINESAPOS_INSTALL_DIR}"/etc/ca-certificates/trust-source/anchors/$(echo "${WINESAPOS_HTTP_PROXY_CA}" | grep -o -P '[^\/]*$')
+ chroot "${WINESAPOS_INSTALL_DIR}" update-ca-trust
echo "Removing the proxy certificate authority from the chroot complete."
fi
@@ -1324,7 +1330,7 @@ if [[ -n "${WINESAPOS_CUSTOM_SCRIPT}" ]]; then
fi
echo "Defragmenting Btrfs root file system..."
-btrfs filesystem defragment -r ${WINESAPOS_INSTALL_DIR}
+btrfs filesystem defragment -r "${WINESAPOS_INSTALL_DIR}"
echo "Defragmenting Btrfs root file system complete."
echo "Syncing files to disk..."
@@ -1332,7 +1338,7 @@ sync
echo "Syncing files to disk complete."
echo "Viewing final list of installed packages..."
-chroot ${WINESAPOS_INSTALL_DIR} pacman -Q
+chroot "${WINESAPOS_INSTALL_DIR}" pacman -Q
echo "Viewing final list of installed packages complete."
echo "Running tests..."
@@ -1343,7 +1349,7 @@ echo "Running tests complete."
echo "Viewing final storage space usage..."
df -h
-btrfs filesystem df -h ${WINESAPOS_INSTALL_DIR}
+btrfs filesystem df -h "${WINESAPOS_INSTALL_DIR}"
lsblk
echo "Viewing final storage space usage complete."
@@ -1351,12 +1357,12 @@ echo "Done."
echo "End time: $(date)"
if [[ "${WINESAPOS_CREATE_DEVICE}" == "true" ]]; then
- chroot ${WINESAPOS_INSTALL_DIR} pacman -Q > ../output/winesapos-packages.txt
+ chroot "${WINESAPOS_INSTALL_DIR}" pacman -Q > ../output/winesapos-packages.txt
echo ${winesapos_tests_rc} > ../output/winesapos-install-rc.txt
- cp ${WINESAPOS_INSTALL_DIR}/var/winesapos/winesapos-install.log ../output/
+ cp "${WINESAPOS_INSTALL_DIR}"/var/winesapos/winesapos-install.log ../output/
fi
-if (( ${winesapos_tests_rc} == 0 )); then
+if (( winesapos_tests_rc == 0 )); then
exit 0
else
exit ${winesapos_tests_rc}
diff --git a/scripts/winesapos-setup.sh b/scripts/winesapos-setup.sh
index 91716fc..2c67af3 100755
--- a/scripts/winesapos-setup.sh
+++ b/scripts/winesapos-setup.sh
@@ -10,8 +10,7 @@ WINESAPOS_IMAGE_TYPE="$(grep VARIANT_ID /usr/lib/os-release-winesapos | cut -d =
if [[ "${WINESAPOS_IMAGE_TYPE}" == "secure" ]]; then
while true;
do user_pw=$(kdialog --title "winesapOS First-Time Setup" --password 'Please enter your password (default: "winesap") to start the first-time setup.')
- echo ${user_pw} | sudo -S whoami
- if [ $? -eq 0 ]; then
+ if echo "${user_pw}" | sudo -S whoami; then
# Break out of the "while" loop if the password works with the "sudo -S" command.
break 2
fi
@@ -21,7 +20,7 @@ fi
# Enable shell debugging.
set -x
START_TIME=$(date --iso-8601=seconds)
-exec > >(sudo tee /var/winesapos/setup_${START_TIME}.log) 2>&1
+exec > >(sudo tee "/var/winesapos/setup_${START_TIME}.log") 2>&1
echo "Start time: ${START_TIME}"
current_shell=$(cat /proc/$$/comm)
@@ -60,36 +59,34 @@ sudo btrfs qgroup limit 50G /home/.snapshots
# Only install Broadcom Wi-Fi drivers if (1) there is a Broadcom network adapter and (2) there is no Internet connection detected.
broadcom_wifi_auto() {
- lspci | grep -i network | grep -i -q broadcom
- if [ $? -eq 0 ]; then
+ if lspci | grep -i network | grep -i -q broadcom; then
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Checking Internet connection..." 2 | cut -d" " -f1)
test_internet_connection
if [ $? -ne 1 ]; then
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog showCancelButton false
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog showCancelButton false
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for Broadcom proprietary Wi-Fi drivers to be installed..." 3 | cut -d" " -f1)
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
# Blacklist drives that are known to cause conflicts with the official Broadcom 'wl' driver.
echo -e "\nblacklist b43\nblacklist b43legacy\nblacklist bcm43xx\nblacklist bcma\nblacklist brcm80211\nblacklist brcmsmac\nblacklist brcmfmac\nblacklist brcmutil\nblacklist ndiswrapper\nblacklist ssb\nblacklist tg3\n" | sudo tee /etc/modprobe.d/winesapos.conf
+ # shellcheck disable=SC2010
broadcom_wl_dkms_pkg=$(ls -1 /var/lib/winesapos/ | grep broadcom-wl-dkms | grep -P "zst$")
- sudo pacman -U --noconfirm /var/lib/winesapos/${broadcom_wl_dkms_pkg}
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
+ sudo pacman -U --noconfirm /var/lib/winesapos/"${broadcom_wl_dkms_pkg}"
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
echo "wl" | sudo tee -a /etc/modules-load.d/winesapos-wifi.conf
sudo mkinitcpio -P
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
kdialog --title "winesapOS First-Time Setup" --msgbox "Please reboot to load new changes."
else
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog showCancelButton false
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog showCancelButton false
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
fi
fi
}
broadcom_wifi_ask() {
- lspci | grep -i network | grep -i -q broadcom
- if [ $? -eq 0 ]; then
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to install the Broadcom proprietary Wi-Fi driver? Try this if Wi-Fi is not working. A reboot is required when done."
- if [ $? -eq 0 ]; then
+ if lspci | grep -i network | grep -i -q broadcom; then
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to install the Broadcom proprietary Wi-Fi driver? Try this if Wi-Fi is not working. A reboot is required when done."; then
broadcom_wifi_auto
fi
fi
@@ -97,26 +94,25 @@ broadcom_wifi_ask() {
test_internet_connection() {
# Check with https://ping.archlinux.org/ to see if we have an Internet connection.
+ # shellcheck disable=SC2046 disable=SC2126
return $(curl -s https://ping.archlinux.org/ | grep "This domain is used for connectivity checking" | wc -l)
}
loop_test_internet_connection() {
while true;
do kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Checking Internet connection..." 2 | cut -d" " -f1)
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog showCancelButton false
- test_internet_connection
- if [ $? -eq 1 ]; then
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog showCancelButton false
+ if ! test_internet_connection; then
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
# Break out of the "while" loop if we have an Internet connection.
break 2
fi
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
- kdialog --title "winesapOS First-Time Setup" \
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ if ! kdialog --title "winesapOS First-Time Setup" \
--yesno "A working Internet connection for setting up graphics drivers is not detected. \
\nPlease connect to the Internet and try again, or select Cancel to quit Setup." \
--yes-label "Retry" \
- --no-label "Cancel"
- if [ $? -eq 1 ]; then
+ --no-label "Cancel"; then
# Exit the script if the user selects "Cancel".
exit 1
fi
@@ -124,26 +120,26 @@ loop_test_internet_connection() {
}
screen_rotate_ask() {
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to rotate the screen (for devices that have a tablet screen)?"
- if [ $? -eq 0 ]; then
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to rotate the screen (for devices that have a tablet screen)?"; then
rotation_selected=$(kdialog --title "winesapOS First-Time Setup" --menu "Select the desired screen orientation..." right "90 degrees right (clockwise)" left "90 degrees left (counter-clockwise)" inverted "180 degrees inverted (upside-down)")
export fbcon_rotate=0
if [[ "${rotation_selected}" == "right" ]]; then
export fbcon_rotate=1
- sudo sed -i s'/GRUB_GFXMODE=.*/GRUB_GFXMODE=720x1280,auto/'g /etc/default/grub
+ sudo sed -i 's/GRUB_GFXMODE=.*/GRUB_GFXMODE=720x1280,auto/g' /etc/default/grub
elif [[ "${rotation_selected}" == "left" ]]; then
export fbcon_rotate=3
- sudo sed -i s'/GRUB_GFXMODE=.*/GRUB_GFXMODE=720x1280,auto/'g /etc/default/grub
+ sudo sed -i 's/GRUB_GFXMODE=.*/GRUB_GFXMODE=720x1280,auto/g' /etc/default/grub
elif [[ "${rotation_selected}" == "inverted" ]]; then
export fbcon_rotate=2
fi
# Rotate the TTY output.
- sudo -E sed -i s"/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"fbcon:rotate=${fbcon_rotate} /"g /etc/default/grub
+ sudo -E sed -i "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"fbcon:rotate=${fbcon_rotate} /g" /etc/default/grub
echo ${fbcon_rotate} | sudo tee /sys/class/graphics/fbcon/rotate_all
# Rotate the desktop temporarily.
- export embedded_display_port=$(xrandr | grep eDP | grep " connected" | cut -d" " -f1)
- if [ ! -z ${embedded_display_port} ]; then
- xrandr --output ${embedded_display_port} --rotate ${rotation_selected}
+ embedded_display_port=$(xrandr | grep eDP | grep " connected" | cut -d" " -f1)
+ export embedded_display_port
+ if [ -n "${embedded_display_port}" ]; then
+ xrandr --output "${embedded_display_port}" --rotate "${rotation_selected}"
# Rotate the desktop permanently.
echo "xrandr --output ${embedded_display_port} --rotate ${rotation_selected}" | sudo tee /etc/profile.d/xrandr.sh
fi
@@ -154,8 +150,8 @@ asus_setup() {
if sudo dmidecode -s system-manufacturer | grep -P "^ASUS"; then
echo "ASUS computer detected."
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for ASUS utilities to be installed..." 1 | cut -d" " -f1)
- ${CMD_YAY_INSTALL[*]} asusctl-git
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${CMD_YAY_INSTALL[@]}" asusctl-git
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
else
echo "ASUS computer not detected."
fi
@@ -166,22 +162,21 @@ framework_setup() {
if [[ "${system_manufacturer}" == "Framework" ]]; then
echo "Framework laptop detected."
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for Framework drivers to be installed..." 8 | cut -d" " -f1)
- lscpu | grep -q Intel
- if [ $? -eq 0 ]; then
+ if lscpu | grep -q Intel; then
# Enable better power management of NVMe devices on Intel Framework devices.
- sudo sed -i s'/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="nvme.noacpi=1 /'g /etc/default/grub
+ sudo sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="nvme.noacpi=1 /g' /etc/default/grub
fi
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
# Fix keyboard.
echo "blacklist hid_sensor_hub" | sudo tee /etc/modprobe.d/framework-als-deactivate.conf
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
# Fix firmware updates.
sudo mkdir /etc/fwupd/
echo -e "[uefi_capsule]\nDisableCapsuleUpdateOnDisk=true" | sudo tee /etc/fwupd/uefi_capsule.conf
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
# Enable support for the ambient light sensor.
- sudo ${CMD_PACMAN_INSTALL[*]} iio-sensor-proxy
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
+ sudo "${CMD_PACMAN_INSTALL[@]}" iio-sensor-proxy
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
# Enable the ability to disable the touchpad while typing.
sudo touch /usr/share/libinput/50-framework.quirks
echo '[Framework Laptop 16 Keyboard Module]
@@ -189,32 +184,34 @@ MatchName=Framework Laptop 16 Keyboard Module*
MatchUdevType=keyboard
MatchDMIModalias=dmi:*svnFramework:pnLaptop16*
AttrKeyboardIntegration=internal' | sudo tee /usr/share/libinput/50-framework.quirks
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
# Enable a better audio profile for Framework Laptops.
# https://github.com/cab404/framework-dsp
- sudo ${CMD_PACMAN_INSTALL[*]} easyeffects
+ sudo "${CMD_PACMAN_INSTALL[@]}" easyeffects
# 'unzip' is not installed on the winesapOS minimal image.
- sudo ${CMD_PACMAN_INSTALL[*]} unzip
+ sudo "${CMD_PACMAN_INSTALL[@]}" unzip
TMP=$(mktemp -d) && \
CFG=${XDG_CONFIG_HOME:-~/.config}/easyeffects && \
- mkdir -p "$CFG" && \
- curl -Lo $TMP/fwdsp.zip https://github.com/cab404/framework-dsp/archive/refs/heads/master.zip && \
- unzip -d $TMP $TMP/fwdsp.zip 'framework-dsp-master/config/*/*' && \
- sed -i 's|%CFG%|'$CFG'|g' $TMP/framework-dsp-master/config/*/*.json && \
- cp -rv $TMP/framework-dsp-master/config/* $CFG && \
- rm -rf $TMP
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
+ mkdir -p "${CFG}" && \
+ curl -Lo "${TMP}/fwdsp.zip https://github.com/cab404/framework-dsp/archive/refs/heads/master.zip" && \
+ unzip -d "${TMP}" "$TMP"/fwdsp.zip 'framework-dsp-master/config/*/*' && \
+ sed -i 's|%CFG%|'"$CFG"'|g' "${TMP}"/framework-dsp-master/config/*/*.json && \
+ cp -rv "${TMP}"/framework-dsp-master/config/* "${CFG}" && \
+ rm -rf "${TMP}"
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
# Automatically configure the correct region for the Wi-Fi device.
- export COUNTRY_CODE="$(curl -s ipinfo.io | jq -r .country)"
+ COUNTRY_CODE="$(curl -s ipinfo.io | jq -r .country)"
+ export COUNTRY_CODE
## Temporarily.
- sudo -E iw reg set ${COUNTRY_CODE}
+ sudo -E iw reg set "${COUNTRY_CODE}"
## Permanently.
- sudo ${CMD_PACMAN_INSTALL[*]} wireless-regdb
- echo "WIRELESS_REGDOM=\"${COUNTRY_CODE}\"" | sudo tee -a /etc/conf.d/wireless-regdom
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
+ sudo "${CMD_PACMAN_INSTALL[@]}" wireless-regdb
+ # shellcheck disable=SC2027 disable=SC2086
+ echo "WIRELESS_REGDOM=\""${COUNTRY_CODE}"\"" | sudo tee -a /etc/conf.d/wireless-regdom
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
# Enable support for the LED matrix on the Framework Laptop 16.
- ${CMD_YAY_INSTALL[*]} inputmodule-control
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${CMD_YAY_INSTALL[@]}" inputmodule-control
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
else
echo "Framework laptop not detected."
fi
@@ -222,15 +219,14 @@ AttrKeyboardIntegration=internal' | sudo tee /usr/share/libinput/50-framework.qu
mac_setup() {
echo "Turning on the Mac fan service if the hardware is Apple..."
- sudo dmidecode -s system-product-name | grep -P ^Mac
- if [ $? -eq 0 ]; then
+ if sudo dmidecode -s system-product-name | grep -P ^Mac; then
echo "Mac hardware detected."
sudo systemctl enable --now mbpfan
# Networking over USB does not work on T2 Macs.
# https://wiki.t2linux.org/guides/postinstall/
echo -e "blacklist cdc_ncm\nblacklist cdc_mbim\n" | sudo tee -a /etc/modprobe.d/winesapos-mac.conf
# Enable audio workaround for T2 Macs.
- sudo sed -i s'/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="efi=noruntime intel_iommu=on iommu=pt pcie_ports=compat /'g /etc/default/grub
+ sudo sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="efi=noruntime intel_iommu=on iommu=pt pcie_ports=compat /g' /etc/default/grub
else
echo "No Mac hardware detected."
fi
@@ -238,10 +234,9 @@ mac_setup() {
}
steam_deck_setup() {
- sudo dmidecode -s system-product-name | grep -P "^(Galileo|Jupiter)"
- if [ $? -eq 0 ]; then
+ if sudo dmidecode -s system-product-name | grep -P "^(Galileo|Jupiter)"; then
# Configure S3 deep sleep.
- sudo sed -i s'/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="mem_sleep_default=deep /'g /etc/default/grub
+ sudo sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="mem_sleep_default=deep /g' /etc/default/grub
fi
}
@@ -252,16 +247,17 @@ surface_setup() {
echo "Microsoft Surface laptop detected."
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for Microsoft Surface drivers to be installed..." 3 | cut -d" " -f1)
# The recommended GPG key is no longer valid.
+ # shellcheck disable=SC2016
echo -e "\n[linux-surface]\nServer = https://pkg.surfacelinux.com/arch/\nSigLevel = Never" | sudo tee -a /etc/pacman.conf
sudo pacman -S -y
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
- sudo ${CMD_PACMAN_INSTALL[*]} iptsd
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ sudo "${CMD_PACMAN_INSTALL[@]}" iptsd
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
sudo pacman -R -n --nodeps --nodeps --noconfirm libwacom
# Install build dependencies for 'libwacom-surface' first.
- sudo ${CMD_PACMAN_INSTALL[*]} meson ninja
- ${CMD_YAY_INSTALL[*]} libwacom-surface
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ sudo "${CMD_PACMAN_INSTALL[@]}" meson ninja
+ "${CMD_YAY_INSTALL[@]}" libwacom-surface
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
else
echo "Microsoft Surface laptop not detected."
fi
@@ -272,11 +268,11 @@ winesapos_version_check() {
winesapos_ver_current="$(grep VERSION_ID /usr/lib/os-release-winesapos | cut -d = -f 2)"
# 'sort -V' does not work with semantic numbers.
# As a workaround, adding an underline to versions without a suffix allows the semantic sort to work.
+ # shellcheck disable=SC2086
if [[ $(echo -e "${winesapos_ver_latest}\n${winesapos_ver_current}" | sed '/-/!{s/$/_/}' | sort -V) == "$(echo -e ${winesapos_ver_latest}"\n"${winesapos_ver_current} | sed '/-/!{s/$/_/}')" ]]; then
echo "No newer version found."
else
- kdialog --title "winesapOS First-Time Setup" --yesno "This is an older version of winesapOS. It is recommended to either download the latest image or run the winesapOS Upgrade on the desktop first. Do you want to continue the first-time setup?"
- if [ $? -ne 0 ]; then
+ if ! kdialog --title "winesapOS First-Time Setup" --yesno "This is an older version of winesapOS. It is recommended to either download the latest image or run the winesapOS Upgrade on the desktop first. Do you want to continue the first-time setup?"; then
exit 0
fi
fi
@@ -294,32 +290,34 @@ steam_bootstrap() {
screen_rotate_auto() {
# "Jupiter" is the code name for the Steam Deck LCD.
# "Galileo" is the code name for the Steam Deck OLED.
- sudo dmidecode -s system-product-name | grep -P "^(Galileo|Jupiter)"
- if [ $? -eq 0 ]; then
+ if sudo dmidecode -s system-product-name | grep -P "^(Galileo|Jupiter)"; then
echo "Steam Deck hardware detected."
# Rotate the desktop temporarily.
- export embedded_display_port=$(xrandr | grep eDP | grep " connected" | cut -d" " -f1)
- xrandr --output ${embedded_display_port} --rotate right
+ embedded_display_port=$(xrandr | grep eDP | grep " connected" | cut -d" " -f1)
+ export embedded_display_port
+ xrandr --output "${embedded_display_port}" --rotate right
# Rotate the desktop permanently.
echo "xrandr --output ${embedded_display_port} --rotate right" | sudo tee /etc/profile.d/xrandr.sh
# Rotate GRUB.
- sudo sed -i s'/GRUB_GFXMODE=.*/GRUB_GFXMODE=720x1280,auto/'g /etc/default/grub
+ sudo sed -i 's/GRUB_GFXMODE=.*/GRUB_GFXMODE=720x1280,auto/g' /etc/default/grub
# Rotate the initramfs output.
- sudo sed -i s'/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="fbcon:rotate=1 /'g /etc/default/grub
+ sudo sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="fbcon:rotate=1 /g' /etc/default/grub
fi
}
repo_mirrors_region_auto() {
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for the setup to update the Pacman cache..." 2 | cut -d" " -f1)
if [ "${os_detected}" = "arch" ]; then
+ # shellcheck disable=SC2016
echo 'Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch' | sudo tee /etc/pacman.d/mirrorlist
+ # shellcheck disable=SC2016
echo 'Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch' | sudo tee -a /etc/pacman.d/mirrorlist
elif [[ "${os_detected}" == "manjaro" ]]; then
sudo pacman-mirrors --geoip -f 5
fi
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
sudo pacman -S -y
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
}
repo_mirrors_region_ask() {
@@ -327,14 +325,15 @@ repo_mirrors_region_ask() {
# Dialog to ask the user what mirror region they want to use
if [ "${os_detected}" = "arch" ]; then
# Fetch the list of regions from the Arch Linux mirror status JSON API.
- # Some regions contain a space. We need to map each newline into an array here.
- mapfile -t mirror_regions < <(curl -s https://archlinux.org/mirrors/status/json/ | jq -r '.urls[].country' | sort | uniq | sed '1d')
+ # Some regions contain a space. We need to map each newline into an array here.
+ mapfile -t mirror_regions < <(curl -s https://archlinux.org/mirrors/status/json/ | jq -r '.urls[].country' | sort | uniq | sed '1d')
elif [ "${os_detected}" = "manjaro" ]; then
# Fetch the list of regions from the Manjaro mirror status JSON API.
- # Unlike Arch Linux, Manjaro uses underscores instead of spaces so the logic is cleaner.
- mirror_regions=( $(curl -s https://repo.manjaro.org/status.json | jq -r '.[].country' | sort | uniq) )
+ # Unlike Arch Linux, Manjaro uses underscores instead of spaces so the logic is cleaner.
+ # shellcheck disable=SC2207
+ mirror_regions=( $(curl -s https://repo.manjaro.org/status.json | jq -r '.[].country' | sort | uniq) )
fi
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for the setup to update the Pacman cache..." 2 | cut -d" " -f1)
chosen_region=$(kdialog --title "winesapOS First-Time Setup" \
@@ -349,7 +348,9 @@ repo_mirrors_region_ask() {
# Ideally we should be sorting by `rate` for consistency but it may get too slow.
else
# Fallback to the Arch Linux and Rackspace global mirrors.
+ # shellcheck disable=SC2016
echo 'Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch' | sudo tee /etc/pacman.d/mirrorlist
+ # shellcheck disable=SC2016
echo 'Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch' | sudo tee -a /etc/pacman.d/mirrorlist
fi
elif [[ "${os_detected}" == "manjaro" ]]; then
@@ -359,9 +360,9 @@ repo_mirrors_region_ask() {
sudo pacman-mirrors -f 5
fi
fi
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
sudo pacman -S -y
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
}
graphics_drivers_auto() {
@@ -369,7 +370,7 @@ graphics_drivers_auto() {
echo mesa | sudo tee /var/winesapos/graphics
# Enable GSP firmware support for older NVIDIA graphics cards.
- sudo sed -i s'/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="nouveau.config=NvGspRm=1 /'g /etc/default/grub
+ sudo sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="nouveau.config=NvGspRm=1 /g' /etc/default/grub
# Enable experimental support for old graphics cards starting with Kepler.
echo "NVK_I_WANT_A_BROKEN_VULKAN_DRIVER=1" | sudo tee -a /etc/environment
@@ -391,15 +392,15 @@ graphics_drivers_auto() {
vmtoolsd \
vmware-vmblock-fuse
fi
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
}
graphics_drivers_ask() {
graphics_selected=$(kdialog --title "winesapOS First-Time Setup" --menu "Select your desired graphics driver..." amd AMD intel Intel nvidia-open "NVIDIA Open (for DLSS, Turing and newer)" nvidia-mesa "NVIDIA Mesa (for portability, Kepler and newer)" virtualbox VirtualBox vmware VMware)
# Keep track of the selected graphics drivers for upgrade purposes.
- echo ${graphics_selected} | sudo tee /var/winesapos/graphics
+ echo "${graphics_selected}" | sudo tee /var/winesapos/graphics
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for the graphics driver to be installed..." 2 | cut -d" " -f1)
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
if [[ "${graphics_selected}" == "amd" ]]; then
true
@@ -416,7 +417,7 @@ graphics_drivers_ask() {
multilib/lib32-opencl-nvidia
# Enable Wayland support.
- sudo sed -i s'/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="nvidia_drm.modeset=1 nvidia_drm.fbdev=1 /'g /etc/default/grub
+ sudo sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="nvidia_drm.modeset=1 nvidia_drm.fbdev=1 /g' /etc/default/grub
# Block the loading of conflicting open source NVIDIA drivers.
sudo touch /etc/modprobe.d/winesapos-nvidia.conf
@@ -433,7 +434,7 @@ blacklist uvcvideo" | sudo tee /etc/modprobe.d/winesapos-nvidia.conf
sudo systemctl enable nvidia-hibernate nvidia-persistenced nvidia-powerd nvidia-resume nvidia-suspend
elif [[ "${graphics_selected}" == "nvidia-mesa" ]]; then
# Enable GSP firmware support for older graphics cards.
- sudo sed -i s'/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="nouveau.config=NvGspRm=1 /'g /etc/default/grub
+ sudo sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="nouveau.config=NvGspRm=1 /g' /etc/default/grub
# Enable experimental support for old NVIDIA graphics cards starting with Kepler.
echo "NVK_I_WANT_A_BROKEN_VULKAN_DRIVER=1" | sudo tee -a /etc/environment
@@ -458,7 +459,7 @@ blacklist i2c_nvidia_gpu" | sudo tee /etc/modprobe.d/winesapos-nvidia.conf
vmtoolsd \
vmware-vmblock-fuse
fi
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
}
swap_method_auto() {
@@ -472,7 +473,7 @@ vm.page-cluster = 1" | sudo tee /etc/sysctl.d/99-vm-zram-parameters.conf
zram-size = ram * 2
compression-algorithm = lz4" | sudo tee /etc/systemd/zram-generator.conf
sudo systemctl daemon-reload && sudo systemctl enable systemd-zram-setup@zram0.service
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
}
swap_method_ask() {
@@ -481,10 +482,10 @@ swap_method_ask() {
swap_method_auto
elif [[ "${swap_selected}" == "swapfile" ]]; then
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for the swapfile to be enabled..." 1 | cut -d" " -f1)
+ # shellcheck disable=SC1083 disable=SC2003 disable=SC2046
swap_size_suggested="$(expr $(grep MemTotal /proc/meminfo | awk {'print $2'}) / 1024 / 1024 + 1)"
swap_size_selected=$(kdialog --title "winesapOS First-Time Setup" --inputbox "Swap size in GB. Set to RAM size or more for hibernation support." "${swap_size_suggested}")
- echo ${swap_size_selected} | grep -q -P "^[1-9]"
- if [ $? -eq 0 ]; then
+ if echo "${swap_size_selected}" | grep -q -P "^[1-9]"; then
echo "vm.swappiness=1" | sudo tee -a /etc/sysctl.d/00-winesapos.conf
sudo touch /swap/swapfile
# Avoid Btrfs copy-on-write.
@@ -498,7 +499,7 @@ swap_method_ask() {
sudo swapon /swap/swapfile
echo "/swap/swapfile none swap defaults 0 0" | sudo tee -a /etc/fstab
fi
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
fi
}
@@ -508,47 +509,44 @@ time_auto() {
}
locale_ask() {
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to change the current locale (en_US.UTF-8 UTF-8)?"
- if [ $? -eq 0 ]; then
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to see all availables locales in /etc/locale.gen?"
- if [ $? -eq 0 ]; then
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to change the current locale (en_US.UTF-8 UTF-8)?"; then
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to see all availables locales in /etc/locale.gen?"; then
kdialog --title "winesapOS First-Time Setup" --textbox /etc/locale.gen
fi
locale_selected=$(kdialog --title "winesapOS First-Time Setup" --inputbox "Locale for /etc/locale.gen:" "en_US.UTF-8 UTF-8")
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for the locale to be setup..." 2 | cut -d" " -f1)
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
echo "${locale_selected}" | sudo tee -a /etc/locale.gen
sudo locale-gen
sudo sed -i '/^LANG/d' /etc/locale.conf
- echo "LANG=$(echo ${locale_selected} | cut -d' ' -f1)" | sudo tee -a /etc/locale.conf
- sed -i '/^LANG/d' /home/${USER}/.config/plasma-localerc
- echo "LANG=$(echo ${locale_selected} | cut -d' ' -f1)" >> /home/${USER}/.config/plasma-localerc
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ echo "LANG=$(echo "${locale_selected}" | cut -d' ' -f1)" | sudo tee -a /etc/locale.conf
+ sed -i '/^LANG/d' /home/"${USER}"/.config/plasma-localerc
+ echo "LANG=$(echo "${locale_selected}" | cut -d' ' -f1)" >> /home/"${USER}"/.config/plasma-localerc
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
fi
}
time_ask() {
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to change the current time zone (UTC)?"
- if [ $? -eq 0 ]; then
- selected_time_zone=$(kdialog --title "winesapOS First-Time Setup" --combobox "Select the desired time zone:" $(timedatectl list-timezones))
- sudo timedatectl set-timezone ${selected_time_zone}
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to change the current time zone (UTC)?"; then
+ selected_time_zone=$(kdialog --title "winesapOS First-Time Setup" --combobox "Select the desired time zone:" "$(timedatectl list-timezones)")
+ sudo timedatectl set-timezone "${selected_time_zone}"
fi
}
nix_auto() {
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for the Nix package manager to be installed..." 2 | cut -d" " -f1)
curl -L https://install.determinate.systems/nix | sudo sh -s -- install --no-confirm
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
sudo systemctl enable --now nix-daemon
+ # shellcheck disable=SC1091
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
}
nix_ask() {
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to install the Nix package manager?"
- if [ $? -eq 0 ]; then
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to install the Nix package manager?"; then
nix_auto
fi
}
@@ -556,49 +554,49 @@ nix_ask() {
productivity_auto() {
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for recommended productivity applications to be installed..." 11 | cut -d" " -f1)
# Calibre for an ebook manager.
- sudo ${CMD_FLATPAK_INSTALL[*]} com.calibre_ebook.calibre
- cp /var/lib/flatpak/app/com.calibre_ebook.calibre/current/active/export/share/applications/com.calibre_ebook.calibre.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ sudo "${CMD_FLATPAK_INSTALL[@]}" com.calibre_ebook.calibre
+ cp /var/lib/flatpak/app/com.calibre_ebook.calibre/current/active/export/share/applications/com.calibre_ebook.calibre.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
# Cheese for a webcam utility.
- sudo ${CMD_FLATPAK_INSTALL[*]} org.gnome.Cheese
- cp /var/lib/flatpak/app/org.gnome.Cheese/current/active/export/share/applications/org.gnome.Cheese.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
+ sudo "${CMD_FLATPAK_INSTALL[@]}" org.gnome.Cheese
+ cp /var/lib/flatpak/app/org.gnome.Cheese/current/active/export/share/applications/org.gnome.Cheese.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
# CoolerControl for computer fan management.
- ${CMD_YAY_INSTALL[*]} coolercontrol
- cp /usr/share/applications/org.coolercontrol.CoolerControl.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
+ "${CMD_YAY_INSTALL[@]}" coolercontrol
+ cp /usr/share/applications/org.coolercontrol.CoolerControl.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
# FileZilla for FTP file transfers.
- sudo ${CMD_FLATPAK_INSTALL[*]} org.filezillaproject.Filezilla
- cp /var/lib/flatpak/exports/share/applications/org.filezillaproject.Filezilla.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
+ sudo "${CMD_FLATPAK_INSTALL[@]}" org.filezillaproject.Filezilla
+ cp /var/lib/flatpak/exports/share/applications/org.filezillaproject.Filezilla.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
# Flatseal for managing Flatpaks.
- sudo ${CMD_FLATPAK_INSTALL[*]} com.github.tchx84.Flatseal
- cp /var/lib/flatpak/app/com.github.tchx84.Flatseal/current/active/export/share/applications/com.github.tchx84.Flatseal.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
+ sudo "${CMD_FLATPAK_INSTALL[@]}" com.github.tchx84.Flatseal
+ cp /var/lib/flatpak/app/com.github.tchx84.Flatseal/current/active/export/share/applications/com.github.tchx84.Flatseal.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
# Google Chrome web browser.
- sudo ${CMD_FLATPAK_INSTALL[*]} com.google.Chrome
- cp /var/lib/flatpak/app/com.google.Chrome/current/active/export/share/applications/com.google.Chrome.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
+ sudo "${CMD_FLATPAK_INSTALL[@]}" com.google.Chrome
+ cp /var/lib/flatpak/app/com.google.Chrome/current/active/export/share/applications/com.google.Chrome.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
# KeePassXC for an encrypted password manager.
- sudo ${CMD_FLATPAK_INSTALL[*]} org.keepassxc.KeePassXC
- cp /var/lib/flatpak/app/org.keepassxc.KeePassXC/current/active/export/share/applications/org.keepassxc.KeePassXC.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
+ sudo "${CMD_FLATPAK_INSTALL[@]}" org.keepassxc.KeePassXC
+ cp /var/lib/flatpak/app/org.keepassxc.KeePassXC/current/active/export/share/applications/org.keepassxc.KeePassXC.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
# LibreOffice for an office suite.
- sudo ${CMD_FLATPAK_INSTALL[*]} org.libreoffice.LibreOffice
- cp /var/lib/flatpak/app/org.libreoffice.LibreOffice/current/active/export/share/applications/org.libreoffice.LibreOffice.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 8
+ sudo "${CMD_FLATPAK_INSTALL[@]}" org.libreoffice.LibreOffice
+ cp /var/lib/flatpak/app/org.libreoffice.LibreOffice/current/active/export/share/applications/org.libreoffice.LibreOffice.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 8
# PeaZip compression utility.
- sudo ${CMD_FLATPAK_INSTALL[*]} io.github.peazip.PeaZip
- cp /var/lib/flatpak/app/io.github.peazip.PeaZip/current/active/export/share/applications/io.github.peazip.PeaZip.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 9
+ sudo "${CMD_FLATPAK_INSTALL[@]}" io.github.peazip.PeaZip
+ cp /var/lib/flatpak/app/io.github.peazip.PeaZip/current/active/export/share/applications/io.github.peazip.PeaZip.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 9
# qBittorrent for torrents.
- sudo ${CMD_FLATPAK_INSTALL[*]} org.qbittorrent.qBittorrent
- cp /var/lib/flatpak/app/org.qbittorrent.qBittorrent/current/active/export/share/applications/org.qbittorrent.qBittorrent.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 10
+ sudo "${CMD_FLATPAK_INSTALL[@]}" org.qbittorrent.qBittorrent
+ cp /var/lib/flatpak/app/org.qbittorrent.qBittorrent/current/active/export/share/applications/org.qbittorrent.qBittorrent.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 10
# VLC media player.
- sudo ${CMD_FLATPAK_INSTALL[*]} org.videolan.VLC
- cp /var/lib/flatpak/app/org.videolan.VLC/current/active/export/share/applications/org.videolan.VLC.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ sudo "${CMD_FLATPAK_INSTALL[@]}" org.videolan.VLC
+ cp /var/lib/flatpak/app/org.videolan.VLC/current/active/export/share/applications/org.videolan.VLC.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
}
productivity_ask() {
@@ -621,102 +619,100 @@ productivity_ask() {
org.videolan.VLC:flatpak "VLC (media player)" off)
for prodpkg in ${prodpkgs}
do kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for ${prodpkg} to be installed..." 2 | cut -d" " -f1)
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
- echo ${prodpkg} | grep -P ":flatpak$"
- if [ $? -eq 0 ]; then
- sudo ${CMD_FLATPAK_INSTALL[*]} $(echo "${prodpkg}" | cut -d: -f1)
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ if echo "${prodpkg}" | grep -P ":flatpak$"; then
+ sudo "${CMD_FLATPAK_INSTALL[@]}" "$(echo "${prodpkg}" | cut -d: -f1)"
fi
- echo ${prodpkg} | grep -P ":pkg$"
- if [ $? -eq 0 ]; then
- ${CMD_YAY_INSTALL[*]} $(echo "${prodpkg}" | cut -d: -f1)
+ if echo "${prodpkg}" | grep -P ":pkg$"; then
+ "${CMD_YAY_INSTALL[@]}" "$(echo "${prodpkg}" | cut -d: -f1)"
fi
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
done
}
gaming_auto() {
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for recommended gaming applications to be installed..." 17 | cut -d" " -f1)
# AntiMicroX for configuring controller input.
- sudo ${CMD_FLATPAK_INSTALL[*]} io.github.antimicrox.antimicrox
- cp /var/lib/flatpak/app/io.github.antimicrox.antimicrox/current/active/export/share/applications/io.github.antimicrox.antimicrox.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ sudo "${CMD_FLATPAK_INSTALL[@]}" io.github.antimicrox.antimicrox
+ cp /var/lib/flatpak/app/io.github.antimicrox.antimicrox/current/active/export/share/applications/io.github.antimicrox.antimicrox.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
# Bottles for running any Windows game or application.
- sudo ${CMD_FLATPAK_INSTALL[*]} com.usebottles.bottles
- cp /var/lib/flatpak/app/com.usebottles.bottles/current/active/export/share/applications/com.usebottles.bottles.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
+ sudo "${CMD_FLATPAK_INSTALL[@]}" com.usebottles.bottles
+ cp /var/lib/flatpak/app/com.usebottles.bottles/current/active/export/share/applications/com.usebottles.bottles.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
# Chiaki for PS4 and PS5 game streaming.
- sudo ${CMD_FLATPAK_INSTALL[*]} io.github.streetpea.Chiaki4deck
- cp /var/lib/flatpak/app/io.github.streetpea.Chiaki4deck/current/active/export/share/applications/io.github.streetpea.Chiaki4deck.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
+ sudo "${CMD_FLATPAK_INSTALL[@]}" io.github.streetpea.Chiaki4deck
+ cp /var/lib/flatpak/app/io.github.streetpea.Chiaki4deck/current/active/export/share/applications/io.github.streetpea.Chiaki4deck.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
# Discord for social gaming.
- sudo ${CMD_FLATPAK_INSTALL[*]} com.discordapp.Discord
- cp /var/lib/flatpak/app/com.discordapp.Discord/current/active/export/share/applications/com.discordapp.Discord.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
+ sudo "${CMD_FLATPAK_INSTALL[@]}" com.discordapp.Discord
+ cp /var/lib/flatpak/app/com.discordapp.Discord/current/active/export/share/applications/com.discordapp.Discord.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
# Heroic Games Launcher.
- sudo ${CMD_FLATPAK_INSTALL[*]} com.heroicgameslauncher.hgl
- cp /var/lib/flatpak/app/com.heroicgameslauncher.hgl/current/active/export/share/applications/com.heroicgameslauncher.hgl.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
+ sudo "${CMD_FLATPAK_INSTALL[@]}" com.heroicgameslauncher.hgl
+ cp /var/lib/flatpak/app/com.heroicgameslauncher.hgl/current/active/export/share/applications/com.heroicgameslauncher.hgl.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
# Ludusavi.
- ${CMD_YAY_INSTALL[*]} ludusavi
- cp /usr/share/applications/com.github.mtkennerly.ludusavi.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
+ "${CMD_YAY_INSTALL[@]}" ludusavi
+ cp /usr/share/applications/com.github.mtkennerly.ludusavi.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
# Lutris.
- sudo ${CMD_FLATPAK_INSTALL[*]} net.lutris.Lutris
- cp /var/lib/flatpak/app/net.lutris.Lutris/current/active/export/share/applications/net.lutris.Lutris.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
+ sudo "${CMD_FLATPAK_INSTALL[@]}" net.lutris.Lutris
+ cp /var/lib/flatpak/app/net.lutris.Lutris/current/active/export/share/applications/net.lutris.Lutris.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
# MangoHud.
- ${CMD_YAY_INSTALL[*]} mangohud-git lib32-mangohud-git
+ "${CMD_YAY_INSTALL[@]}" mangohud-git lib32-mangohud-git
# Flatpak's non-interactive mode does not work for MangoHud.
# Instead, install a specific version of MangoHud.
# https://github.com/winesapOS/winesapOS/issues/336
- sudo ${CMD_FLATPAK_INSTALL[*]} runtime/org.freedesktop.Platform.VulkanLayer.MangoHud/x86_64/23.08
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 8
+ sudo "${CMD_FLATPAK_INSTALL[@]}" runtime/org.freedesktop.Platform.VulkanLayer.MangoHud/x86_64/23.08
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 8
# Moonlight and Sunshine.
- sudo ${CMD_FLATPAK_INSTALL[*]} com.moonlight_stream.Moonlight dev.lizardbyte.app.Sunshine
- cp /var/lib/flatpak/app/com.moonlight_stream.Moonlight/current/active/export/share/applications/com.moonlight_stream.Moonlight.desktop /home/${USER}/Desktop/
- cp /var/lib/flatpak/app/dev.lizardbyte.app.Sunshine/current/active/export/share/applications/dev.lizardbyte.app.Sunshine.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 9
+ sudo "${CMD_FLATPAK_INSTALL[@]}" com.moonlight_stream.Moonlight dev.lizardbyte.app.Sunshine
+ cp /var/lib/flatpak/app/com.moonlight_stream.Moonlight/current/active/export/share/applications/com.moonlight_stream.Moonlight.desktop /home/"${USER}"/Desktop/
+ cp /var/lib/flatpak/app/dev.lizardbyte.app.Sunshine/current/active/export/share/applications/dev.lizardbyte.app.Sunshine.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 9
# Nexus Mods app.
- ${CMD_YAY_INSTALL[*]} nexusmods-app-bin
- cp /usr/share/applications/com.nexusmods.app.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 10
+ "${CMD_YAY_INSTALL[@]}" nexusmods-app-bin
+ cp /usr/share/applications/com.nexusmods.app.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 10
# NonSteamLaunchers.
- wget "https://raw.githubusercontent.com/moraroy/NonSteamLaunchers-On-Steam-Deck/refs/heads/main/NonSteamLaunchers.desktop" -O /home/${USER}/Desktop/NonSteamLaunchers.desktop
+ wget "https://raw.githubusercontent.com/moraroy/NonSteamLaunchers-On-Steam-Deck/refs/heads/main/NonSteamLaunchers.desktop" -O /home/"${USER}"/Desktop/NonSteamLaunchers.desktop
# NVIDIA GeForce Now.
## A dependency for NVIDIA GeForce Now and Xbox Cloud Gaming is Google Chrome.
- sudo ${CMD_FLATPAK_INSTALL[*]} com.google.Chrome
- cp /var/lib/flatpak/app/com.google.Chrome/current/active/export/share/applications/com.google.Chrome.desktop /home/${USER}/Desktop/
- ln -s /home/${USER}/.winesapos/winesapos-ngfn.desktop /home/${USER}/Desktop/winesapos-ngfn.desktop
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 11
+ sudo "${CMD_FLATPAK_INSTALL[@]}" com.google.Chrome
+ cp /var/lib/flatpak/app/com.google.Chrome/current/active/export/share/applications/com.google.Chrome.desktop /home/"${USER}"/Desktop/
+ ln -s /home/"${USER}"/.winesapos/winesapos-ngfn.desktop /home/"${USER}"/Desktop/winesapos-ngfn.desktop
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 11
# Oversteer for managing racing wheels.
- sudo ${CMD_FLATPAK_INSTALL[*]} io.github.berarma.Oversteer
- cp /var/lib/flatpak/app/io.github.berarma.Oversteer/current/active/export/share/applications/io.github.berarma.Oversteer.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 12
+ sudo "${CMD_FLATPAK_INSTALL[@]}" io.github.berarma.Oversteer
+ cp /var/lib/flatpak/app/io.github.berarma.Oversteer/current/active/export/share/applications/io.github.berarma.Oversteer.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 12
# Prism Launcher for playing Minecraft.
- sudo ${CMD_FLATPAK_INSTALL[*]} org.prismlauncher.PrismLauncher
- cp /var/lib/flatpak/app/org.prismlauncher.PrismLauncher/current/active/export/share/applications/org.prismlauncher.PrismLauncher.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 13
+ sudo "${CMD_FLATPAK_INSTALL[@]}" org.prismlauncher.PrismLauncher
+ cp /var/lib/flatpak/app/org.prismlauncher.PrismLauncher/current/active/export/share/applications/org.prismlauncher.PrismLauncher.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 13
# Protontricks for managing dependencies in Proton.
- sudo ${CMD_FLATPAK_INSTALL[*]} com.github.Matoking.protontricks
+ sudo "${CMD_FLATPAK_INSTALL[@]}" com.github.Matoking.protontricks
## Add a wrapper script so that the Flatpak can be used normally via the CLI.
echo '#!/bin/bash
flatpak run com.github.Matoking.protontricks $@
' | sudo tee /usr/local/bin/protontricks
sudo chmod +x /usr/local/bin/protontricks
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 14
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 14
# ProtonUp-Qt for managing GE-Proton versions.
- sudo ${CMD_FLATPAK_INSTALL[*]} net.davidotek.pupgui2
- cp /var/lib/flatpak/app/net.davidotek.pupgui2/current/active/export/share/applications/net.davidotek.pupgui2.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 15
+ sudo "${CMD_FLATPAK_INSTALL[@]}" net.davidotek.pupgui2
+ cp /var/lib/flatpak/app/net.davidotek.pupgui2/current/active/export/share/applications/net.davidotek.pupgui2.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 15
# OBS Studio for screen recording and live streaming.
- sudo ${CMD_FLATPAK_INSTALL[*]} com.obsproject.Studio
- cp /var/lib/flatpak/app/com.obsproject.Studio/current/active/export/share/applications/com.obsproject.Studio.desktop /home/${USER}/Desktop/
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 16
+ sudo "${CMD_FLATPAK_INSTALL[@]}" com.obsproject.Studio
+ cp /var/lib/flatpak/app/com.obsproject.Studio/current/active/export/share/applications/com.obsproject.Studio.desktop /home/"${USER}"/Desktop/
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 16
# umu-launcher.
- ${CMD_YAY_INSTALL[*]} umu-launcher
+ "${CMD_YAY_INSTALL[@]}" umu-launcher
# Xbox Cloud Gaming.
- ln -s /home/${USER}/.winesapos/winesapos-xcloud.desktop /home/${USER}/Desktop/winesapos-xcloud.desktop
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ ln -s /home/"${USER}"/.winesapos/winesapos-xcloud.desktop /home/"${USER}"/Desktop/winesapos-xcloud.desktop
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
}
gaming_ask() {
@@ -754,88 +750,78 @@ gaming_ask() {
zerotier-gui-git:pkg "ZeroTier One VPN (GUI)" off)
for gamepkg in ${gamepkgs}
do kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for ${gamepkg} to be installed..." 2 | cut -d" " -f1)
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
- echo ${gamepkg} | grep -P ":flatpak$"
- if [ $? -eq 0 ]; then
- sudo ${CMD_FLATPAK_INSTALL[*]} $(echo "${gamepkg}" | cut -d: -f1)
- fi
- echo ${gamepkg} | grep -P ":pkg$"
- if [ $? -eq 0 ]; then
- ${CMD_YAY_INSTALL[*]} $(echo "${gamepkg}" | cut -d: -f1)
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+
+ if echo "${gamepkg}" | grep -P ":flatpak$"; then
+ sudo "${CMD_FLATPAK_INSTALL[@]}" "$(echo "${gamepkg}" | cut -d: -f1)"
fi
- echo ${gamepkg} | grep -P "^deckyloader:other$"
- if [ $? -eq 0 ]; then
+ if echo "${gamepkg}" | grep -P ":pkg$"; then
+ "${CMD_YAY_INSTALL[@]}" "$(echo "${gamepkg}" | cut -d: -f1)"
+ fi
+
+ if echo "${gamepkg}" | grep -P "^deckyloader:other$"; then
# First install the 'zenity' dependency.
- sudo ${CMD_PACMAN_INSTALL[*]} zenity
- wget "https://github.com/SteamDeckHomebrew/decky-installer/releases/latest/download/decky_installer.desktop" -O /home/${USER}/Desktop/decky_installer.desktop
- crudini --ini-options=nospace --set /home/${USER}/Desktop/decky_installer.desktop "Desktop Entry" Icon steam
+ sudo "${CMD_PACMAN_INSTALL[@]}" zenity
+ wget "https://github.com/SteamDeckHomebrew/decky-installer/releases/latest/download/decky_installer.desktop" -O /home/"${USER}"/Desktop/decky_installer.desktop
+ crudini --ini-options=nospace --set /home/"${USER}"/Desktop/decky_installer.desktop "Desktop Entry" Icon steam
fi
- echo ${gamepkg} | grep -P "^emudeck:other$"
- if [ $? -eq 0 ]; then
+ if echo "${gamepkg}" | grep -P "^emudeck:other$"; then
EMUDECK_GITHUB_URL="https://api.github.com/repos/EmuDeck/emudeck-electron/releases/latest"
EMUDECK_URL="$(curl -s ${EMUDECK_GITHUB_URL} | grep -E 'browser_download_url.*AppImage' | cut -d '"' -f 4)"
- wget "${EMUDECK_URL}" -O /home/${USER}/Desktop/EmuDeck.AppImage
- chmod +x /home/${USER}/Desktop/EmuDeck.AppImage
+ wget "${EMUDECK_URL}" -O /home/"${USER}"/Desktop/EmuDeck.AppImage
+ chmod +x /home/"${USER}"/Desktop/EmuDeck.AppImage
fi
- echo ${gamepkg} | grep -P "^gamescope:other$"
- if [ $? -eq 0 ]; then
- sudo ${CMD_PACMAN_INSTALL[*]} gamescope
- ${CMD_YAY_INSTALL[*]} gamescope-session-git gamescope-session-steam-git
+ if echo "${gamepkg}" | grep -P "^gamescope:other$"; then
+ sudo "${CMD_PACMAN_INSTALL[@]}" gamescope
+ "${CMD_YAY_INSTALL[@]}" gamescope-session-git gamescope-session-steam-git
fi
- echo ${gamepkg} | grep -P "^mangohud-git:other$"
- if [ $? -eq 0 ]; then
- ${CMD_YAY_INSTALL[*]} mangohud-git lib32-mangohud-git
- sudo ${CMD_FLATPAK_INSTALL[*]} runtime/org.freedesktop.Platform.VulkanLayer.MangoHud/x86_64/23.08
+ if echo "${gamepkg}" | grep -P "^mangohud-git:other$"; then
+ "${CMD_YAY_INSTALL[@]}" mangohud-git lib32-mangohud-git
+ sudo "${CMD_FLATPAK_INSTALL[@]}" runtime/org.freedesktop.Platform.VulkanLayer.MangoHud/x86_64/23.08
fi
- echo ${gamepkg} | grep -P "^nonsteamlaunchers:other$"
- if [ $? -eq 0 ]; then
- wget "https://raw.githubusercontent.com/moraroy/NonSteamLaunchers-On-Steam-Deck/refs/heads/main/NonSteamLaunchers.desktop" -O /home/${USER}/Desktop/NonSteamLaunchers.desktop
+ if echo "${gamepkg}" | grep -P "^nonsteamlaunchers:other$"; then
+ wget "https://raw.githubusercontent.com/moraroy/NonSteamLaunchers-On-Steam-Deck/refs/heads/main/NonSteamLaunchers.desktop" -O /home/"${USER}"/Desktop/NonSteamLaunchers.desktop
fi
- echo ${gamepkg} | grep -P "^ngfn:other$"
- if [ $? -eq 0 ]; then
- sudo ${CMD_FLATPAK_INSTALL[*]} com.google.Chrome
- cp /var/lib/flatpak/app/com.google.Chrome/current/active/export/share/applications/com.google.Chrome.desktop /home/${USER}/Desktop/
- ln -s /home/${USER}/.winesapos/winesapos-ngfn.desktop /home/${USER}/Desktop/winesapos-ngfn.desktop
+ if echo "${gamepkg}" | grep -P "^ngfn:other$"; then
+ sudo "${CMD_FLATPAK_INSTALL[@]}" com.google.Chrome
+ cp /var/lib/flatpak/app/com.google.Chrome/current/active/export/share/applications/com.google.Chrome.desktop /home/"${USER}"/Desktop/
+ ln -s /home/"${USER}"/.winesapos/winesapos-ngfn.desktop /home/"${USER}"/Desktop/winesapos-ngfn.desktop
fi
- echo ${gamepkg} | grep -P "^opengamepadui:other$"
- if [ $? -eq 0 ]; then
- ${CMD_YAY_INSTALL[*]} opengamepadui-bin opengamepadui-session-git
+ if echo "${gamepkg}" | grep -P "^opengamepadui:other$"; then
+ "${CMD_YAY_INSTALL[@]}" opengamepadui-bin opengamepadui-session-git
fi
- echo ${gamepkg} | grep -P "^steam:other$"
- if [ $? -eq 0 ]; then
- sudo ${CMD_PACMAN_INSTALL[*]} steam steam-native-runtime
+ if echo "${gamepkg}" | grep -P "^steam:other$"; then
+ sudo "${CMD_PACMAN_INSTALL[@]}" steam steam-native-runtime
steam_bootstrap
fi
- echo ${gamepkg} | grep -P "^xcloud:other$"
- if [ $? -eq 0 ]; then
- sudo ${CMD_FLATPAK_INSTALL[*]} com.google.Chrome
- cp /var/lib/flatpak/app/com.google.Chrome/current/active/export/share/applications/com.google.Chrome.desktop /home/${USER}/Desktop/
- ln -s /home/${USER}/.winesapos/winesapos-xcloud.desktop /home/${USER}/Desktop/winesapos-xcloud.desktop
+ if echo "${gamepkg}" | grep -P "^xcloud:other$"; then
+ sudo "${CMD_FLATPAK_INSTALL[@]}" com.google.Chrome
+ cp /var/lib/flatpak/app/com.google.Chrome/current/active/export/share/applications/com.google.Chrome.desktop /home/"${USER}"/Desktop/
+ ln -s /home/"${USER}"/.winesapos/winesapos-xcloud.desktop /home/"${USER}"/Desktop/winesapos-xcloud.desktop
fi
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
done
}
waydroid_auto() {
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for Waydroid to be installed..." 2 | cut -d" " -f1)
- ${CMD_YAY_INSTALL[*]} waydroid
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
- ${CMD_YAY_INSTALL[*]} waydroid-image-gapps
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${CMD_YAY_INSTALL[@]}" waydroid
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ "${CMD_YAY_INSTALL[@]}" waydroid-image-gapps
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
}
waydroid_ask() {
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to install Waydroid for Android app support?"
- if [ $? -eq 0 ]; then
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to install Waydroid for Android app support?"; then
waydroid_auto
fi
}
@@ -846,18 +832,17 @@ ge_proton_auto() {
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for the GloriousEggroll variant of Proton to be installed..." 2 | cut -d" " -f1)
export answer_install_ge="true"
# GE-Proton.
- mkdir -p /home/${USER}/.local/share/Steam/compatibilitytools.d/
+ mkdir -p /home/"${USER}"/.local/share/Steam/compatibilitytools.d/
PROTON_GE_VERSION="GE-Proton9-16"
- curl https://github.com/GloriousEggroll/proton-ge-custom/releases/download/${PROTON_GE_VERSION}/${PROTON_GE_VERSION}.tar.gz --location --output /home/${USER}/.local/share/Steam/compatibilitytools.d/${PROTON_GE_VERSION}.tar.gz
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
- tar -x -v -f /home/${USER}/.local/share/Steam/compatibilitytools.d/${PROTON_GE_VERSION}.tar.gz --directory /home/${USER}/.local/share/Steam/compatibilitytools.d/
- rm -f /home/${USER}/.local/share/Steam/compatibilitytools.d/${PROTON_GE_VERSION}.tar.gz
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ curl https://github.com/GloriousEggroll/proton-ge-custom/releases/download/${PROTON_GE_VERSION}/${PROTON_GE_VERSION}.tar.gz --location --output /home/"${USER}"/.local/share/Steam/compatibilitytools.d/${PROTON_GE_VERSION}.tar.gz
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ tar -x -v -f /home/"${USER}"/.local/share/Steam/compatibilitytools.d/${PROTON_GE_VERSION}.tar.gz --directory /home/"${USER}"/.local/share/Steam/compatibilitytools.d/
+ rm -f /home/"${USER}"/.local/share/Steam/compatibilitytools.d/${PROTON_GE_VERSION}.tar.gz
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
}
ge_proton_ask() {
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to install the GloriousEggroll variant of Proton?"
- if [ $? -eq 0 ]; then
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to install the GloriousEggroll variant of Proton?"; then
ge_proton_auto
fi
}
@@ -866,27 +851,27 @@ xbox_controller_auto() {
# This package contains proprietary firmware that we cannot ship
# which is why it is installed as part of the first-time setup.
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for Xbox controller drivers to be installed..." 2 | cut -d" " -f1)
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
- ${CMD_YAY_INSTALL[*]} xone-dkms-git
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ "${CMD_YAY_INSTALL[@]}" xone-dkms-git
sudo touch /etc/modules-load.d/winesapos-controllers.conf
echo -e "xone-wired\nxone-dongle\nxone-gip\nxone-gip-gamepad\nxone-gip-headset\nxone-gip-chatpad\nxone-gip-guitar" | sudo tee -a /etc/modules-load.d/winesapos-controllers.conf
for i in xone-wired xone-dongle xone-gip xone-gip-gamepad xone-gip-headset xone-gip-chatpad xone-gip-guitar;
do sudo modprobe --verbose ${i}
done
sudo git clone https://github.com/medusalix/xpad-noone /usr/src/xpad-noone-1.0
+ # shellcheck disable=SC2010
for kernel in $(ls -1 /usr/lib/modules/ | grep -P "^[0-9]+"); do
- sudo dkms install -m xpad-noone -v 1.0 -k ${kernel}
+ sudo dkms install -m xpad-noone -v 1.0 -k "${kernel}"
done
echo -e "\nxpad-noone\n" | sudo tee -a /etc/modules-load.d/winesapos-controllers.conf
echo -e "\nblacklist xpad\n" | sudo tee -a /etc/modprobe.d/winesapos.conf
sudo rmmod xpad
sudo modprobe xpad-noone
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
}
xbox_controller_ask() {
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to install Xbox controller support?"
- if [ $? -eq 0 ]; then
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to install Xbox controller support?"; then
xbox_controller_auto
fi
}
@@ -894,18 +879,17 @@ xbox_controller_ask() {
zerotier_auto() {
if [[ "${WINESAPOS_IMAGE_TYPE}" == "minimal" ]]; then
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for ZeroTier to be installed..." 2 | cut -d" " -f1)
- sudo ${CMD_PACMAN_INSTALL[*]} zerotier-one
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
- ${CMD_YAY_INSTALL[*]} zerotier-gui-git
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ sudo "${CMD_PACMAN_INSTALL[@]}" zerotier-one
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ "${CMD_YAY_INSTALL[@]}" zerotier-gui-git
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
fi
# ZeroTier GUI will fail to launch with a false-positive error if the service is not running.
sudo systemctl enable --now zerotier-one
}
zerotier_ask() {
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to enable the ZeroTier VPN service?"
- if [ $? -eq 0 ]; then
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to enable the ZeroTier VPN service?"; then
zerotier_auto
fi
}
@@ -920,8 +904,7 @@ user_password_auto() {
}
user_password_ask() {
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to change your password?"
- if [ $? -eq 0 ]; then
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to change your password?"; then
user_password_auto
fi
}
@@ -934,29 +917,25 @@ root_password_auto() {
}
root_password_ask() {
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to change the root password?"
- if [ $? -eq 0 ]; then
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to change the root password?"; then
root_password_auto
fi
}
luks_password_auto() {
if [[ "${WINESAPOS_IMAGE_TYPE}" == "secure" ]]; then
- # This should always be "/dev/mapper/cryptroot" on the secure image.
- root_partition=$(mount | grep 'on \/ ' | awk '{print $1}')
# Example output: "mmcblk0p5", "nvme0n1p5", "sda5"
root_partition_shortname=$(lsblk -o name,label | grep winesapos-luks | awk '{print $1}' | grep -o -P '[a-z]+.*')
set +x
luks_password=$(kdialog --title "winesapOS First-Time Setup" --password "Enter the new LUKS storage encryption password:")
- echo -e "password\n${luks_password}\n${luks_password}\n" | sudo cryptsetup luksChangeKey /dev/${root_partition_shortname}
+ echo -e "password\n${luks_password}\n${luks_password}\n" | sudo cryptsetup luksChangeKey /dev/"${root_partition_shortname}"
set -x
fi
}
luks_password_ask() {
if [[ "${WINESAPOS_IMAGE_TYPE}" == "secure" ]]; then
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to change the LUKS storage encryption password?"
- if [ $? -eq 0 ]; then
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to change the LUKS storage encryption password?"; then
luks_password_auto
fi
fi
@@ -975,8 +954,7 @@ autologin_auto() {
}
autologin_ask() {
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to enable autologin?"
- if [ $? -eq 0 ]; then
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to enable autologin?"; then
autologin_auto
fi
}
@@ -987,8 +965,7 @@ grub_hide_auto() {
}
grub_hide_ask() {
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to hide the GRUB boot menu?"
- if [ $? -eq 0 ]; then
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to hide the GRUB boot menu?"; then
grub_hide_auto
fi
}
@@ -996,20 +973,18 @@ grub_hide_ask() {
firmware_upgrade_auto() {
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for hardware firmware to be upgraded..." 2 | cut -d" " -f1)
sudo fwupdmgr refresh --force
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
sudo fwupdmgr update --assume-yes --no-reboot-check
- ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
}
firmware_upgrade_ask() {
- kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to upgrade hardware firmware from LVFS with fwupdmgr?"
- if [ $? -eq 0 ]; then
+ if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to upgrade hardware firmware from LVFS with fwupdmgr?"; then
firmware_upgrade_auto
fi
}
-kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to use the recommended defaults for the first-time setup?"
-if [ $? -eq 0 ]; then
+if kdialog --title "winesapOS First-Time Setup" --yesno "Do you want to use the recommended defaults for the first-time setup?"; then
broadcom_wifi_auto
loop_test_internet_connection
winesapos_version_check
@@ -1071,19 +1046,19 @@ else
fi
# Fix permissions.
-sudo chown 1000:1000 /home/${USER}/Desktop/*.desktop
-chmod +x /home/${USER}/Desktop/*.desktop
+sudo chown 1000:1000 /home/"${USER}"/Desktop/*.desktop
+chmod +x /home/"${USER}"/Desktop/*.desktop
# Remove the Flatpak directory for the user to avoid errors.
# This directory will automatically get re-generated when a 'flatpak' command is ran.
# https://github.com/winesapOS/winesapOS/issues/516
-rm -r -f /home/${USER}/.local/share/flatpak
+rm -r -f /home/"${USER}"/.local/share/flatpak
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for the new drivers to be enabled on boot..." 2 | cut -d" " -f1)
-${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+"${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
# Regenerate the initramfs to load all of the new drivers.
sudo mkinitcpio -P
-${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+"${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
# Regenerate the GRUB configuration to load the new Btrfs snapshots.
# This allows users to easily revert back to a fresh installation of winesapOS.
@@ -1095,28 +1070,28 @@ rm -f ~/.config/autostart/winesapos-setup.desktop
echo "Running first-time setup tests..."
kdialog_dbus=$(kdialog --title "winesapOS First-Time Setup" --progressbar "Please wait for the first-time setup tests to finish..." 2 | cut -d" " -f1)
-echo -n "\tChecking that Btrfs quotas are enabled..."
+printf "\tChecking that Btrfs quotas are enabled..."
# There should be two entries for 50 GiB. One for root and one for home.
if [[ "$(sudo btrfs qgroup show -pcre / | grep -c 50.00GiB)" == "2" ]]; then
echo PASS
else
echo FAIL
fi
-${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+"${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
if [[ "${answer_install_ge}" == "true" ]]; then
echo "Testing that GE Proton has been installed..."
- echo -n "\tChecking that GE Proton is installed..."
- ls -1 /home/${USER}/.local/share/Steam/compatibilitytools.d/ | grep -v -P ".tar.gz$" | grep -q -P "^GE-Proton.*"
- if [ $? -eq 0 ]; then
+ printf "\tChecking that GE Proton is installed..."
+ # shellcheck disable=SC2010
+ if ls -1 /home/"${USER}"/.local/share/Steam/compatibilitytools.d/ | grep -v -P ".tar.gz$" | grep -q -P "^GE-Proton.*"; then
echo PASS
else
echo FAIL
fi
- echo -n "\tChecking that the GE Proton tarball has been removed..."
- ls -1 /home/${USER}/.local/share/Steam/compatibilitytools.d/ | grep -q -P ".tar.gz$"
- if [ $? -eq 1 ]; then
+ printf "\tChecking that the GE Proton tarball has been removed..."
+ # shellcheck disable=SC2010
+ if ! ls -1 /home/"${USER}"/.local/share/Steam/compatibilitytools.d/ | grep -q -P ".tar.gz$"; then
echo PASS
else
echo FAIL
@@ -1124,18 +1099,16 @@ if [[ "${answer_install_ge}" == "true" ]]; then
echo "Testing that GE Proton has been installed complete."
fi
-sudo dmidecode -s system-product-name | grep -P "^(Galileo|Jupiter)"
-if [ $? -eq 0 ]; then
- echo -n "\tChecking that GRUB enables S3 deep sleep support..."
- sudo grep -q "mem_sleep_default=deep" /boot/grub/grub.cfg
- if [ $? -eq 0 ]; then
+if sudo dmidecode -s system-product-name | grep -P "^(Galileo|Jupiter)"; then
+ printf "\tChecking that GRUB enables S3 deep sleep support..."
+ if sudo grep -q "mem_sleep_default=deep" /boot/grub/grub.cfg; then
echo PASS
else
winesapos_test_failure
fi
fi
echo "Running first-time setup tests complete."
-${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+"${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
if [[ "${WINESAPOS_IMAGE_TYPE}" == "secure" ]]; then
echo "Disallow passwordless 'sudo' now that the setup is done..."
diff --git a/scripts/winesapos-tests.sh b/scripts/winesapos-tests.sh
index 0afb838..d5c5b8d 100755
--- a/scripts/winesapos-tests.sh
+++ b/scripts/winesapos-tests.sh
@@ -16,6 +16,7 @@ if [[ "${current_shell}" != "bash" ]]; then
fi
# Load default environment variables.
+# shellcheck disable=SC1091
. ./env/winesapos-env-defaults.sh
WINESAPOS_DEVICE="${WINESAPOS_DEVICE:-vda}"
@@ -28,46 +29,42 @@ fi
failed_tests=0
winesapos_test_failure() {
+ # shellcheck disable=SC2003 disable=SC2086
failed_tests=$(expr ${failed_tests} + 1)
echo FAIL
}
if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
DEVICE_WITH_PARTITION="${DEVICE}"
- echo ${DEVICE} | grep -q -P "^/dev/(nvme|loop)"
- if [ $? -eq 0 ]; then
+ if echo "${DEVICE}" | grep -q -P "^/dev/(nvme|loop)"; then
# "nvme" and "loop" devices separate the device name and partition number by using a "p".
# Example output: /dev/loop0p
DEVICE_WITH_PARTITION="${DEVICE}p"
fi
echo "Testing partitions..."
- DEVICE_WITH_PARTITION_SHORT=$(echo ${DEVICE_WITH_PARTITION} | cut -d/ -f3)
- parted_print="$(parted ${DEVICE} print)"
+ parted_print="$(parted "${DEVICE}" print)"
- echo -n "\t\tChecking that ${DEVICE_WITH_PARTITION}1 is not formatted..."
- echo "${parted_print}" | grep -P "^ 1 " | grep -q -P "kB\s+primary"
- if [ $? -eq 0 ]; then
+ printf "\t\tChecking that %s1 is not formatted..." "${DEVICE_WITH_PARTITION}"
+ if echo "${parted_print}" | grep -P "^ 1 " | grep -q -P "kB\s+primary"; then
echo PASS
else
winesapos_test_failure
fi
if [[ "${WINESAPOS_ENABLE_PORTABLE_STORAGE}" == "true" ]]; then
- echo -n "\t\tChecking that ${DEVICE_WITH_PARTITION}2 is formatted as exFAT..."
+ printf "\t\tChecking that %s2 is formatted as exFAT..." "${DEVICE_WITH_PARTITION}"
# 'parted' does not support finding if a partition is exFAT formatted.
# 'lsblk -f' does but that does not work inside of a container.
# https://github.com/winesapOS/winesapOS/issues/507
- echo "${parted_print}" | grep -P "^ 2 " | grep -q -P "GB\s+primary"
- if [ $? -eq 0 ]; then
+ if echo "${parted_print}" | grep -P "^ 2 " | grep -q -P "GB\s+primary"; then
echo PASS
else
winesapos_test_failure
fi
- echo -n "\t\tChecking that ${DEVICE_WITH_PARTITION}2 has the 'msftdata' partition flag..."
- parted ${DEVICE} print | grep -q msftdata
- if [ $? -eq 0 ]; then
+ printf "\t\tChecking that %s2 has the 'msftdata' partition flag..." "${DEVICE_WITH_PARTITION}"
+ if parted "${DEVICE}" print | grep -q msftdata; then
echo PASS
else
winesapos_test_failure
@@ -75,17 +72,15 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
fi
if [[ "${WINESAPOS_ENABLE_PORTABLE_STORAGE}" == "true" ]]; then
- echo -n "\t\tChecking that ${DEVICE_WITH_PARTITION}3 is formatted as FAT32..."
- echo "${parted_print}" | grep -P "^ 3 " | grep -q fat
- if [ $? -eq 0 ]; then
+ printf "\t\tChecking that %s3 is formatted as FAT32..." "${DEVICE_WITH_PARTITION}"
+ if echo "${parted_print}" | grep -P "^ 3 " | grep -q fat; then
echo PASS
else
winesapos_test_failure
fi
else
- echo -n "\t\tChecking that ${DEVICE_WITH_PARTITION}2 is formatted as FAT32..."
- echo "${parted_print}" | grep -P "^ 2 " | grep -q fat
- if [ $? -eq 0 ]; then
+ printf "\t\tChecking that %s2 is formatted as FAT32..." "${DEVICE_WITH_PARTITION}"
+ if echo "${parted_print}" | grep -P "^ 2 " | grep -q fat; then
echo PASS
else
winesapos_test_failure
@@ -93,17 +88,15 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
fi
if [[ "${WINESAPOS_ENABLE_PORTABLE_STORAGE}" == "true" ]]; then
- echo -n "\t\tChecking that ${DEVICE_WITH_PARTITION}4 is formatted as ext4..."
- echo "${parted_print}" | grep -P "^ 4 " | grep -q ext4
- if [ $? -eq 0 ]; then
+ printf "\t\tChecking that %s4 is formatted as ext4..." "${DEVICE_WITH_PARTITION}"
+ if echo "${parted_print}" | grep -P "^ 4 " | grep -q ext4; then
echo PASS
else
winesapos_test_failure
fi
else
- echo -n "\t\tChecking that ${DEVICE_WITH_PARTITION}3 is formatted as ext4..."
- echo "${parted_print}" | grep -P "^ 3 " | grep -q ext4
- if [ $? -eq 0 ]; then
+ printf "\t\tChecking that %s3 is formatted as ext4..." "${DEVICE_WITH_PARTITION}"
+ if echo "${parted_print}" | grep -P "^ 3 " | grep -q ext4; then
echo PASS
else
winesapos_test_failure
@@ -111,34 +104,30 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
fi
if [[ "${WINESAPOS_ENABLE_PORTABLE_STORAGE}" == "true" ]]; then
- echo -n "\t\tChecking that ${DEVICE_WITH_PARTITION}5 is formatted as Btrfs..."
+ printf "\t\tChecking that %s5 is formatted as Btrfs..." "${DEVICE_WITH_PARTITION}"
if [[ "${WINESAPOS_ENCRYPT}" == "true" ]]; then
- parted /dev/mapper/cryptroot print | grep -q -P "^ 1 .*btrfs"
- if [ $? -eq 0 ]; then
+ if parted /dev/mapper/cryptroot print | grep -q -P "^ 1 .*btrfs"; then
echo PASS
else
winesapos_test_failure
fi
else
- echo "${parted_print}" | grep -P "^ 5 " | grep -q btrfs
- if [ $? -eq 0 ]; then
+ if echo "${parted_print}" | grep -P "^ 5 " | grep -q btrfs; then
echo PASS
else
winesapos_test_failure
fi
fi
else
- echo -n "\t\tChecking that ${DEVICE_WITH_PARTITION}4 is formatted as Btrfs..."
+ printf "\t\tChecking that %s4 is formatted as Btrfs..." "${DEVICE_WITH_PARTITION}"
if [[ "${WINESAPOS_ENCRYPT}" == "true" ]]; then
- parted /dev/mapper/cryptroot print | grep -q -P "^ 1 .*btrfs"
- if [ $? -eq 0 ]; then
+ if parted /dev/mapper/cryptroot print | grep -q -P "^ 1 .*btrfs"; then
echo PASS
else
winesapos_test_failure
fi
else
- echo "${parted_print}" | grep -P "^ 4 " | grep -q btrfs
- if [ $? -eq 0 ]; then
+ if echo "${parted_print}" | grep -P "^ 4 " | grep -q btrfs; then
echo PASS
else
winesapos_test_failure
@@ -146,22 +135,21 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
fi
fi
- echo -n "Checking that optimal IO schedulers are enabled..."
- grep -q kyber ${WINESAPOS_INSTALL_DIR}/etc/udev/rules.d/60-winesapos-io-schedulers.rules
- if [ $? -eq 0 ]; then
+ printf "Checking that optimal IO schedulers are enabled..."
+ if grep -q kyber "${WINESAPOS_INSTALL_DIR}"/etc/udev/rules.d/60-winesapos-io-schedulers.rules; then
echo PASS
else
winesapos_test_failure
fi
- echo -n "Testing partitions complete.\n\n"
+ printf "Testing partitions complete.\n\n"
echo "Testing /etc/fstab mounts..."
echo "Debug output of fstab contents below..."
- cat ${WINESAPOS_INSTALL_DIR}/etc/fstab
+ cat "${WINESAPOS_INSTALL_DIR}"/etc/fstab
- echo "\t\tChecking that each mount exists in /etc/fstab...\n"
+ printf "\t\tChecking that each mount exists in /etc/fstab...\n"
for i in \
"^(\/dev\/mapper\/cryptroot|LABEL\=).*\s+/\s+btrfs\s+rw,noatime,nodiratime,compress-force=zstd:1,discard" \
"^(\/dev\/mapper\/cryptroot|LABEL\=).*\s+/home\s+btrfs\s+rw,noatime,nodiratime,compress-force=zstd:1" \
@@ -169,9 +157,8 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
"^(none|tmpfs)\s+/tmp\s+tmpfs\s+rw.*\s+0\s+0" \
"^(none|tmpfs)\s+/var/log\s+tmpfs\s+rw.*\s+0\s+0" \
"^(none|tmpfs)\s+/var/tmp\s+tmpfs\s+rw.*\s+0\s+0"
- do echo -n "\t\t${i}..."
- grep -q -P "${i}" ${WINESAPOS_INSTALL_DIR}/etc/fstab
- if [ $? -eq 0 ]; then
+ do printf "\t\t%s..." "${i}"
+ if grep -q -P "${i}" "${WINESAPOS_INSTALL_DIR}"/etc/fstab; then
echo PASS
else
winesapos_test_failure
@@ -180,48 +167,44 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
if [[ "${WINESAPOS_BOOTLOADER}" == "grub" ]]; then
fstab_efi="^LABEL\=.*\s+/boot/efi\s+vfat\s+rw"
- echo -n "\t\t${fstab_efi}..."
- grep -q -P "${fstab_efi}" ${WINESAPOS_INSTALL_DIR}/etc/fstab
- if [ $? -eq 0 ]; then
+ printf "\t\t%s..." "${fstab_efi}"
+ if grep -q -P "${fstab_efi}" "${WINESAPOS_INSTALL_DIR}"/etc/fstab; then
echo PASS
else
winesapos_test_failure
fi
elif [[ "${WINESAPOS_BOOTLOADER}" == "systemd-boot" ]]; then
fstab_efi="^LABEL\=.*\s+/boot\s+vfat\s+rw"
- echo -n "\t\t${fstab_efi}..."
- grep -q -P "${fstab_efi}" ${WINESAPOS_INSTALL_DIR}/etc/fstab
- if [ $? -eq 0 ]; then
+ printf "\t\t%s..." "${fstab_efi}"
+ if grep -q -P "${fstab_efi}" "${WINESAPOS_INSTALL_DIR}"/etc/fstab; then
echo PASS
else
winesapos_test_failure
fi
fi
- echo -n "Testing /etc/fstab mounts complete.\n\n"
+ printf "Testing /etc/fstab mounts complete.\n\n"
echo "Testing Btrfs subvolumes..."
- echo -n "\t\tChecking that the Btrfs subvolumes exist...\n"
+ printf "\t\tChecking that the Btrfs subvolumes exist...\n"
for i in \
".snapshots" \
"home" \
"home/\.snapshots" \
"swap"
- do echo -n "\t\t${i}..."
- btrfs subvolume list ${WINESAPOS_INSTALL_DIR} | grep -q -P " ${i}$"
- if [ $? -eq 0 ]; then
+ do printf "\t\t%s..." "${i}"
+ if btrfs subvolume list "${WINESAPOS_INSTALL_DIR}" | grep -q -P " ${i}$"; then
echo PASS
else
winesapos_test_failure
fi
done
- echo -n "Testing Btrfs subvolumes complete.\n\n"
+ printf "Testing Btrfs subvolumes complete.\n\n"
fi
-echo -n -e "\t\tChecking that the open file limits has been increased via systemd..."
-grep -P -q "^DefaultLimitNOFILE=524288" ${WINESAPOS_INSTALL_DIR}/etc/systemd/system.conf.d/20-file-limits.conf
-if [ $? -eq 0 ]; then
+printf "\t\tChecking that the open file limits has been increased via systemd..."
+if grep -P -q "^DefaultLimitNOFILE=524288" "${WINESAPOS_INSTALL_DIR}"/etc/systemd/system.conf.d/20-file-limits.conf; then
echo PASS
else
winesapos_test_failure
@@ -229,61 +212,55 @@ fi
echo "Testing user creation..."
-echo -n "\t\tChecking that the 'winesap' user exists..."
-grep -P -q "^${WINESAPOS_USER_NAME}:" ${WINESAPOS_INSTALL_DIR}/etc/passwd
-if [ $? -eq 0 ]; then
+printf "\t\tChecking that the 'winesap' user exists..."
+if grep -P -q "^${WINESAPOS_USER_NAME}:" "${WINESAPOS_INSTALL_DIR}"/etc/passwd; then
echo PASS
else
winesapos_test_failure
fi
-echo -n "\t\tChecking that the home directory for the 'winesap' user exists..."
-if [ -d ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/ ]; then
+printf "\t\tChecking that the home directory for the 'winesap' user exists..."
+if [ -d "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/ ]; then
echo PASS
else
winesapos_test_failure
fi
-echo -n "Testing user creation complete.\n\n"
+printf "Testing user creation complete.\n\n"
echo "Testing package repositories..."
-echo -n "\tChecking that the winesapOS repository was added..."
+printf "\tChecking that the winesapOS repository was added..."
if [[ "${WINESAPOS_ENABLE_TESTING_REPO}" == "false" ]]; then
- grep -q -P "^\[winesapos\]" ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
- if [ $? -eq 0 ]; then
+ if grep -q -P "^\[winesapos\]" "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf; then
echo PASS
else
winesapos_test_failure
fi
else
- grep -q -P "^\[winesapos-testing\]" ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
- if [ $? -eq 0 ]; then
+ if grep -q -P "^\[winesapos-testing\]" "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf; then
echo PASS
else
winesapos_test_failure
fi
fi
-echo -n "\tChecking that the winesapOS GPG key was added..."
-chroot ${WINESAPOS_INSTALL_DIR} pacman-key --list-keys | grep -q 1805E886BECCCEA99EDF55F081CA29E4A4B01239
-if [ $? -eq 0 ]; then
+printf "\tChecking that the winesapOS GPG key was added..."
+if chroot "${WINESAPOS_INSTALL_DIR}" pacman-key --list-keys | grep -q 1805E886BECCCEA99EDF55F081CA29E4A4B01239; then
echo PASS
else
winesapos_test_failure
fi
-echo -n "\tChecking that the Chaotic AUR repository was added..."
-grep -q -P "^\[chaotic-aur\]" ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
-if [ $? -eq 0 ]; then
+printf "\tChecking that the Chaotic AUR repository was added..."
+if grep -q -P "^\[chaotic-aur\]" "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf; then
echo PASS
else
winesapos_test_failure
fi
-echo -n "\tChecking that the Chaotic AUR GPG key was added..."
-chroot ${WINESAPOS_INSTALL_DIR} pacman-key --list-keys | grep -q 3056513887B78AEB
-if [ $? -eq 0 ]; then
+printf "\tChecking that the Chaotic AUR GPG key was added..."
+if chroot "${WINESAPOS_INSTALL_DIR}" pacman-key --list-keys | grep -q 3056513887B78AEB; then
echo PASS
else
winesapos_test_failure
@@ -294,14 +271,13 @@ echo "Testing package repositories complete."
echo "Testing package installations..."
function pacman_search() {
- chroot ${WINESAPOS_INSTALL_DIR} pacman -Qsq ${1} &> /dev/null
+ chroot "${WINESAPOS_INSTALL_DIR}" pacman -Qsq "${1}" &> /dev/null
}
function pacman_search_loop() {
- for i in ${@}
- do echo -n "\t${i}..."
- pacman_search "${i}"
- if [ $? -eq 0 ]; then
+ for i in "${@}"
+ do printf "\t%s..." "${i}"
+ if pacman_search "${i}"; then
echo PASS
else
winesapos_test_failure
@@ -309,7 +285,7 @@ function pacman_search_loop() {
done
}
-echo "\tChecking that the base system packages are installed..."
+printf "\tChecking that the base system packages are installed..."
pacman_search_loop \
accountsservice \
arch-install-scripts \
@@ -327,7 +303,7 @@ pacman_search_loop \
tzupdate
if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
- echo "\tChecking that the Linux kernel packages are installed..."
+ printf "\tChecking that the Linux kernel packages are installed..."
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "manjaro" ]]; then
pacman_search_loop linux-fsync-nobara-bin linux66 linux66-headers linux-firmware mkinitcpio-firmware amd-ucode intel-ucode apple-bcm-firmware
elif [[ "${WINESAPOS_DISTRO}" == "arch" ]]; then
@@ -336,7 +312,7 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
fi
if [[ "${WINESAPOS_INSTALL_GAMING_TOOLS}" == "true" ]]; then
- echo "\tChecking that gaming tools are installed..."
+ printf "\tChecking that gaming tools are installed..."
pacman_search_loop \
gamemode \
lib32-gamemode \
@@ -360,9 +336,11 @@ if [[ "${WINESAPOS_INSTALL_GAMING_TOOLS}" == "true" ]]; then
zerotier-one \
zerotier-gui-git
+ # Disable this ShellCheck because we may need to loop through more files in the future.
+ # shellcheck disable=SC2043
for i in \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/EmuDeck.AppImage
- do echo -n "\t\tChecking if the file ${i} exists..."
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/EmuDeck.AppImage; do
+ printf "\t\tChecking if the file $%s exists..." "${i}"
if [ -f "${i}" ]; then
echo PASS
else
@@ -371,7 +349,7 @@ if [[ "${WINESAPOS_INSTALL_GAMING_TOOLS}" == "true" ]]; then
done
fi
-echo "\tChecking that the desktop environment packages are installed..."
+printf "\tChecking that the desktop environment packages are installed..."
pacman_search_loop \
mesa \
lib32-mesa \
@@ -417,7 +395,7 @@ elif [[ "${WINESAPOS_DE}" == "gnome" ]]; then
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "manjaro" ]]; then
pacman_search_loop \
manjaro-gnome-settings \
- manjaro-settings-manager
+ manjaro-settings-manager
fi
elif [[ "${WINESAPOS_DE}" == "plasma" ]]; then
@@ -442,13 +420,12 @@ elif [[ "${WINESAPOS_DE}" == "plasma" ]]; then
sddm-breath-theme
fi
- echo -n "\tChecking that Plasma (Wayland) session is set as the default..."
+ printf "\tChecking that Plasma (Wayland) session is set as the default..."
export wayland_session_file="plasma.desktop"
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "manjaro" ]]; then
export wayland_session_file="plasmawayland.desktop"
fi
- ls "${WINESAPOS_INSTALL_DIR}/usr/share/wayland-sessions/0${wayland_session_file}" &> /dev/null
- if [ $? -eq 0 ]; then
+ if ls "${WINESAPOS_INSTALL_DIR}/usr/share/wayland-sessions/0${wayland_session_file}" &> /dev/null; then
echo PASS
else
winesapos_test_failure
@@ -463,141 +440,130 @@ elif [[ "${WINESAPOS_DE}" == "sway" ]]; then
pacman_search sway
fi
-echo -n "\tChecking that SDDM will hide Nix build users..."
-if [[ "$(chroot ${WINESAPOS_INSTALL_DIR} crudini --get /etc/sddm.conf.d/uid.conf Users MaximumUid)" == "2999" ]]; then
+printf "\tChecking that SDDM will hide Nix build users..."
+if [[ "$(chroot "${WINESAPOS_INSTALL_DIR}" crudini --get /etc/sddm.conf.d/uid.conf Users MaximumUid)" == "2999" ]]; then
echo PASS
else
winesapos_test_failure
fi
-echo "\tChecking that Bluetooth packages are installed..."
+printf "\tChecking that Bluetooth packages are installed..."
pacman_search_loop bluez bluez-utils blueman bluez-qt
-echo "\tChecking that Bluetooth packages are installed complete."
+printf "\tChecking that Bluetooth packages are installed complete."
-echo -n "\tChecking that the 'bluetooth' service is enabled..."
-chroot ${WINESAPOS_INSTALL_DIR} systemctl --quiet is-enabled bluetooth.service
-if [ $? -eq 0 ]; then
+printf "\tChecking that the 'bluetooth' service is enabled..."
+if chroot "${WINESAPOS_INSTALL_DIR}" systemctl --quiet is-enabled bluetooth.service; then
echo PASS
else
winesapos_test_failure
fi
-echo -n "Testing package installations complete.\n\n"
+printf "Testing package installations complete.\n\n"
echo "Testing drivers installation..."
-echo -e "\tChecking that the 'apple-bce' driver is loaded on boot..."
-grep -P "^MODULES" ${WINESAPOS_INSTALL_DIR}/etc/mkinitcpio.conf | grep -q apple-bce
-if [ $? -eq 0 ]; then
+printf "\tChecking that the 'apple-bce' driver is loaded on boot..."
+if grep -P "^MODULES" "${WINESAPOS_INSTALL_DIR}"/etc/mkinitcpio.conf | grep -q apple-bce; then
echo PASS
else
winesapos_test_failure
fi
-echo -e "\tChecking that the 'apple-touchbar' driver will load automatically..."
-grep -q "install apple-touchbar" ${WINESAPOS_INSTALL_DIR}/etc/modprobe.d/winesapos-mac.conf
-if [ $? -eq 0 ]; then
+printf "\tChecking that the 'apple-touchbar' driver will load automatically..."
+if grep -q "install apple-touchbar" "${WINESAPOS_INSTALL_DIR}"/etc/modprobe.d/winesapos-mac.conf; then
echo PASS
else
winesapos_test_failure
fi
-echo -n -e "\tChecking that USB modules will load automatically..."
-grep -P "^MODULES" ${WINESAPOS_INSTALL_DIR}/etc/mkinitcpio.conf | grep -q "usbhid xhci_hcd"
-if [ $? -eq 0 ]; then
+printf "\tChecking that USB modules will load automatically..."
+if grep -P "^MODULES" "${WINESAPOS_INSTALL_DIR}"/etc/mkinitcpio.conf | grep -q "usbhid xhci_hcd"; then
echo PASS
else
winesapos_test_failure
fi
-echo -n -e "\tChecking that the Intel VMD module will load automatically..."
-grep -P "^MODULES" ${WINESAPOS_INSTALL_DIR}/etc/mkinitcpio.conf | grep -q "nvme vmd"
-if [ $? -eq 0 ]; then
+printf "\tChecking that the Intel VMD module will load automatically..."
+if grep -P "^MODULES" "${WINESAPOS_INSTALL_DIR}"/etc/mkinitcpio.conf | grep -q "nvme vmd"; then
echo PASS
else
winesapos_test_failure
fi
-echo -e "\tChecking that the 'radeon' driver will not load for specific older GPUs..."
-grep -q "options radeon si_support=0" ${WINESAPOS_INSTALL_DIR}/etc/modprobe.d/winesapos-amd.conf
-if [ $? -eq 0 ]; then
+printf "\tChecking that the 'radeon' driver will not load for specific older GPUs..."
+if grep -q "options radeon si_support=0" "${WINESAPOS_INSTALL_DIR}"/etc/modprobe.d/winesapos-amd.conf; then
echo PASS
else
winesapos_test_failure
fi
-echo -e "\tChecking that the AMDGPU workaround is configured..."
-grep -q "options amdgpu noretry=0" ${WINESAPOS_INSTALL_DIR}/etc/modprobe.d/winesapos-amd.conf
-if [ $? -eq 0 ]; then
+printf "\tChecking that the AMDGPU workaround is configured..."
+if grep -q "options amdgpu noretry=0" "${WINESAPOS_INSTALL_DIR}"/etc/modprobe.d/winesapos-amd.conf; then
echo PASS
else
winesapos_test_failure
fi
-echo -e "\tChecking that 'linux-fsync-nobara-bin' is installed..."
-pacman_search linux-fsync-nobara-bin
-if [ $? -eq 0 ]; then
+printf "\tChecking that 'linux-fsync-nobara-bin' is installed..."
+if pacman_search linux-fsync-nobara-bin; then
echo PASS
else
winesapos_test_failure
fi
-echo -e "\tChecking that 'usbmuxd' is installed..."
-pacman_search usbmuxd
-if [ $? -eq 0 ]; then
+printf "\tChecking that 'usbmuxd' is installed..."
+if pacman_search usbmuxd; then
echo PASS
else
winesapos_test_failure
fi
-echo -n -e "\tChecking that newer udev rules for 'usbmuxd' are installed..."
-grep -q "make sure iBridge (T1)" ${WINESAPOS_INSTALL_DIR}/usr/lib/udev/rules.d/39-usbmuxd.rules
-if [ $? -eq 0 ]; then
+printf "\tChecking that newer udev rules for 'usbmuxd' are installed..."
+if grep -q "make sure iBridge (T1)" "${WINESAPOS_INSTALL_DIR}"/usr/lib/udev/rules.d/39-usbmuxd.rules; then
echo PASS
else
winesapos_test_failure
fi
-echo -n -e "\tChecking that udev rule for the Lenovo Legion Go is installed..."
-grep -q "echo 17ef 6182" ${WINESAPOS_INSTALL_DIR}/usr/lib/udev/rules.d/50-lenovo-legion-controller.rules
-if [ $? -eq 0 ]; then
+printf "\tChecking that udev rule for the Lenovo Legion Go is installed..."
+if grep -q "echo 17ef 6182" "${WINESAPOS_INSTALL_DIR}"/usr/lib/udev/rules.d/50-lenovo-legion-controller.rules; then
echo PASS
else
winesapos_test_failure
fi
-echo -e "Testing drivers installation complete.\n\n"
+printf "Testing drivers installation complete.\n\n"
echo "Testing that all files have been copied over..."
for i in \
- ${WINESAPOS_INSTALL_DIR}/etc/systemd/user/winesapos-mute.service \
- ${WINESAPOS_INSTALL_DIR}/etc/systemd/system/winesapos-resize-root-file-system.service \
- ${WINESAPOS_INSTALL_DIR}/etc/systemd/system/winesapos-sddm-health-check.service \
- ${WINESAPOS_INSTALL_DIR}/etc/snapper/configs/root \
- ${WINESAPOS_INSTALL_DIR}/etc/snapper/configs/home \
- ${WINESAPOS_INSTALL_DIR}/usr/lib/os-release-winesapos \
- ${WINESAPOS_INSTALL_DIR}/usr/local/bin/winesapos-mute.sh \
- ${WINESAPOS_INSTALL_DIR}/usr/local/bin/winesapos-resize-root-file-system.sh \
- ${WINESAPOS_INSTALL_DIR}/usr/local/bin/winesapos-sddm-health-check.sh \
- ${WINESAPOS_INSTALL_DIR}/usr/share/libalpm/hooks/winesapos-etc-grub.d-10_linux.hook \
- ${WINESAPOS_INSTALL_DIR}/usr/share/libalpm/hooks/winesapos-usr-share-grub-grub-mkconfig_lib.hook \
- ${WINESAPOS_INSTALL_DIR}/var/winesapos/winesapos-install.log
- do echo -n "\t${i}..."
- if [ -f ${i} ]; then
+ "${WINESAPOS_INSTALL_DIR}"/etc/systemd/user/winesapos-mute.service \
+ "${WINESAPOS_INSTALL_DIR}"/etc/systemd/system/winesapos-resize-root-file-system.service \
+ "${WINESAPOS_INSTALL_DIR}"/etc/systemd/system/winesapos-sddm-health-check.service \
+ "${WINESAPOS_INSTALL_DIR}"/etc/snapper/configs/root \
+ "${WINESAPOS_INSTALL_DIR}"/etc/snapper/configs/home \
+ "${WINESAPOS_INSTALL_DIR}"/usr/lib/os-release-winesapos \
+ "${WINESAPOS_INSTALL_DIR}"/usr/local/bin/winesapos-mute.sh \
+ "${WINESAPOS_INSTALL_DIR}"/usr/local/bin/winesapos-resize-root-file-system.sh \
+ "${WINESAPOS_INSTALL_DIR}"/usr/local/bin/winesapos-sddm-health-check.sh \
+ "${WINESAPOS_INSTALL_DIR}"/usr/share/libalpm/hooks/winesapos-etc-grub.d-10_linux.hook \
+ "${WINESAPOS_INSTALL_DIR}"/usr/share/libalpm/hooks/winesapos-usr-share-grub-grub-mkconfig_lib.hook \
+ "${WINESAPOS_INSTALL_DIR}"/var/winesapos/winesapos-install.log
+ do printf "\t%s..." "${i}"
+ if [ -f "${i}" ]; then
echo PASS
else
winesapos_test_failure
fi
done
-echo -n "\t${WINESAPOS_INSTALL_DIR}/etc/os-release-winesapos..."
-if [[ -L ${WINESAPOS_INSTALL_DIR}/etc/os-release-winesapos ]]; then
+printf "\t%s/etc/os-release-winesapos..." "${WINESAPOS_INSTALL_DIR}"
+if [[ -L "${WINESAPOS_INSTALL_DIR}"/etc/os-release-winesapos ]]; then
echo PASS
else
winesapos_test_failure
fi
-echo -n "Testing that all files have been copied over complete.\n\n"
+printf "Testing that all files have been copied over complete.\n\n"
echo "Testing that services are enabled..."
@@ -612,9 +578,8 @@ for i in \
snapd \
snapper-timeline.timer \
systemd-timesyncd
- do echo -n "\t${i}..."
- chroot ${WINESAPOS_INSTALL_DIR} systemctl --quiet is-enabled ${i}
- if [ $? -eq 0 ]; then
+ do printf "\t%s..." "${i}"
+ if chroot "${WINESAPOS_INSTALL_DIR}" systemctl --quiet is-enabled "${i}"; then
echo PASS
else
winesapos_test_failure
@@ -622,129 +587,117 @@ for i in \
done
if [[ "${WINESAPOS_APPARMOR}" == "true" ]]; then
- echo -n "\tapparmor..."
- chroot ${WINESAPOS_INSTALL_DIR} systemctl --quiet is-enabled apparmor
- if [ $? -eq 0 ]; then
+ printf "\tapparmor..."
+ if chroot "${WINESAPOS_INSTALL_DIR}" systemctl --quiet is-enabled apparmor; then
echo PASS
else
winesapos_test_failure
fi
fi
-echo -n "Testing that services are enabled complete.\n\n"
+printf "Testing that services are enabled complete.\n\n"
if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
echo "Testing the bootloader..."
- echo -n "\tChecking that there are no fallback initramfs images..."
- ls -1 ${WINESAPOS_INSTALL_DIR}/boot | grep -q "-fallback.img"
- if [ $? -ne 0 ]; then
+ printf "\tChecking that there are no fallback initramfs images..."
+ # shellcheck disable=SC2010
+ if ! ls -1 "${WINESAPOS_INSTALL_DIR}"/boot | grep -q "-fallback.img"; then
echo PASS
else
winesapos_test_failure
fi
if [[ "${WINESAPOS_BOOTLOADER}" == "grub" ]]; then
- echo -n " \tChecking that the generic '/boot/efi/EFI/BOOT/BOOTX64.EFI' file exists..."
- if [ -f ${WINESAPOS_INSTALL_DIR}/boot/efi/EFI/BOOT/BOOTX64.EFI ]; then
+ printf " \tChecking that the generic '/boot/efi/EFI/BOOT/BOOTX64.EFI' file exists..."
+ if [ -f "${WINESAPOS_INSTALL_DIR}"/boot/efi/EFI/BOOT/BOOTX64.EFI ]; then
echo PASS
else
winesapos_test_failure
fi
- echo "\tChecking that GRUB packages are installed..."
+ printf "\tChecking that GRUB packages are installed..."
pacman_search_loop \
grub \
grub-btrfs
- echo -n "\tChecking that GRUB 2 has been installed..."
- dd if=${DEVICE} bs=512 count=1 2> /dev/null | strings | grep -q GRUB
- if [ $? -eq 0 ]; then
+ printf "\tChecking that GRUB 2 has been installed..."
+ if dd if="${DEVICE}" bs=512 count=1 2> /dev/null | strings | grep -q GRUB; then
echo PASS
else
winesapos_test_failure
fi
- echo -n "\tChecking that the '/boot/grub/grub.cfg' file exists..."
- if [ -f ${WINESAPOS_INSTALL_DIR}/boot/grub/grub.cfg ]; then
+ printf "\tChecking that the '/boot/grub/grub.cfg' file exists..."
+ if [ -f "${WINESAPOS_INSTALL_DIR}"/boot/grub/grub.cfg ]; then
echo PASS
else
winesapos_test_failure
fi
- echo -n "\tChecking that the GRUB terminal is set to 'console'..."
- grep -q "terminal_input console" ${WINESAPOS_INSTALL_DIR}/boot/grub/grub.cfg
- if [ $? -eq 0 ]; then
+ printf "\tChecking that the GRUB terminal is set to 'console'..."
+ if grep -q "terminal_input console" "${WINESAPOS_INSTALL_DIR}"/boot/grub/grub.cfg; then
echo PASS
else
winesapos_test_failure
fi
- echo -n "\tChecking that the GRUB timeout has been set to 10 seconds..."
- grep -q "set timeout=10" ${WINESAPOS_INSTALL_DIR}/boot/grub/grub.cfg
- if [ $? -eq 0 ]; then
+ printf "\tChecking that the GRUB timeout has been set to 10 seconds..."
+ if grep -q "set timeout=10" "${WINESAPOS_INSTALL_DIR}"/boot/grub/grub.cfg; then
echo PASS
else
winesapos_test_failure
fi
- echo -n "\tChecking that the GRUB timeout style been set to 'menu'..."
- grep -q "set timeout_style=menu" ${WINESAPOS_INSTALL_DIR}/boot/grub/grub.cfg
- if [ $? -eq 0 ]; then
+ printf "\tChecking that the GRUB timeout style been set to 'menu'..."
+ if grep -q "set timeout_style=menu" "${WINESAPOS_INSTALL_DIR}"/boot/grub/grub.cfg; then
echo PASS
else
winesapos_test_failure
fi
- echo "\tChecking that GRUB has command line arguments for faster input device polling..."
+ printf "\tChecking that GRUB has command line arguments for faster input device polling..."
for i in usbhid.jspoll=1 usbhid.kbpoll=1 usbhid.mousepoll=1
- do echo -n "\t${i}..."
- grep -q "${i}" ${WINESAPOS_INSTALL_DIR}/boot/grub/grub.cfg
- if [ $? -eq 0 ]; then
+ do printf "\t%s..." "${i}"
+ if grep -q "${i}" "${WINESAPOS_INSTALL_DIR}"/boot/grub/grub.cfg; then
echo PASS
else
winesapos_test_failure
fi
done
- echo "\tChecking that GRUB has command line arguments for faster input device polling complete."
+ printf "\tChecking that GRUB has command line arguments for faster input device polling complete."
- echo -n "\tChecking that GRUB has the command line argument to enable NVMe support..."
- grep -q "nvme_load=yes" ${WINESAPOS_INSTALL_DIR}/boot/grub/grub.cfg
- if [ $? -eq 0 ]; then
+ printf "\tChecking that GRUB has the command line argument to enable NVMe support..."
+ if grep -q "nvme_load=yes" "${WINESAPOS_INSTALL_DIR}"/boot/grub/grub.cfg; then
echo PASS
else
winesapos_test_failure
fi
- echo -n "\tChecking that GRUB will search for the winesapOS root label..."
- grep -q "search --no-floppy --label winesapos-root --set root" ${WINESAPOS_INSTALL_DIR}/boot/grub/grub.cfg
- if [ $? -eq 0 ]; then
+ printf "\tChecking that GRUB will search for the winesapOS root label..."
+ if grep -q "search --no-floppy --label winesapos-root --set root" "${WINESAPOS_INSTALL_DIR}"/boot/grub/grub.cfg; then
echo PASS
else
winesapos_test_failure
fi
- echo -n "\tChecking that GRUB will boot the winesapOS root label..."
- grep -q "root=LABEL=winesapos-root" ${WINESAPOS_INSTALL_DIR}/boot/grub/grub.cfg
- if [ $? -eq 0 ]; then
+ printf "\tChecking that GRUB will boot the winesapOS root label..."
+ if grep -q "root=LABEL=winesapos-root" "${WINESAPOS_INSTALL_DIR}"/boot/grub/grub.cfg; then
echo PASS
else
winesapos_test_failure
fi
- echo -n "\tChecking that GRUB has the command line argument to enable Intel Xe support on the first generation of hardwarae..."
- grep -q "i915.force_probe=!9a49 xe.force_probe=9149" ${WINESAPOS_INSTALL_DIR}/boot/grub/grub.cfg
- if [ $? -eq 0 ]; then
+ printf "\tChecking that GRUB has the command line argument to enable Intel Xe support on the first generation of hardwarae..."
+ if grep -q "i915.force_probe=!9a49 xe.force_probe=9149" "${WINESAPOS_INSTALL_DIR}"/boot/grub/grub.cfg; then
echo PASS
else
winesapos_test_failure
fi
- echo -n "\tChecking that GRUB will use partition UUIDs instead of Linux UUIDs..."
- grep -q -P "^GRUB_DISABLE_LINUX_UUID=true" ${WINESAPOS_INSTALL_DIR}/etc/default/grub
- if [ $? -eq 0 ]; then
- grep -q -P "^GRUB_DISABLE_LINUX_PARTUUID=true" ${WINESAPOS_INSTALL_DIR}/etc/default/grub
- if [ $? -eq 0 ]; then
+ printf "\tChecking that GRUB will use partition UUIDs instead of Linux UUIDs..."
+ if grep -q -P "^GRUB_DISABLE_LINUX_UUID=true" "${WINESAPOS_INSTALL_DIR}"/etc/default/grub; then
+ if grep -q -P "^GRUB_DISABLE_LINUX_PARTUUID=true" "${WINESAPOS_INSTALL_DIR}"/etc/default/grub; then
echo PASS
else
winesapos_test_failure
@@ -753,61 +706,55 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
winesapos_test_failure
fi
- echo -n "\tChecking that GRUB will automatically boot into the correct kernel..."
+ printf "\tChecking that GRUB will automatically boot into the correct kernel..."
export GRUB_DEFAULT="winesapOS Linux, with Linux linux-fsync-nobara-bin"
if [[ "${WINESAPOS_DISTRO}" == "manjaro" ]]; then
export GRUB_DEFAULT="winesapOS Linux \(Kernel: bin\)"
fi
- grep -q -P "^GRUB_DEFAULT=\"${GRUB_DEFAULT}\"" ${WINESAPOS_INSTALL_DIR}/etc/default/grub
- if [ $? -eq 0 ]; then
+ if grep -q -P "^GRUB_DEFAULT=\"${GRUB_DEFAULT}\"" "${WINESAPOS_INSTALL_DIR}"/etc/default/grub; then
echo PASS
else
winesapos_test_failure
fi
- echo -n "\tChecking that the Vimix theme for GRUB exists..."
- if [ -f ${WINESAPOS_INSTALL_DIR}/boot/grub/themes/Vimix/theme.txt ]; then
+ printf "\tChecking that the Vimix theme for GRUB exists..."
+ if [ -f "${WINESAPOS_INSTALL_DIR}"/boot/grub/themes/Vimix/theme.txt ]; then
echo PASS
else
winesapos_test_failure
fi
- echo -n "\tChecking that the Vimix theme for GRUB is enabled..."
- grep -q -P "^GRUB_THEME=/boot/grub/themes/Vimix/theme.txt" ${WINESAPOS_INSTALL_DIR}/etc/default/grub
- if [ $? -eq 0 ]; then
+ printf "\tChecking that the Vimix theme for GRUB is enabled..."
+ if grep -q -P "^GRUB_THEME=/boot/grub/themes/Vimix/theme.txt" "${WINESAPOS_INSTALL_DIR}"/etc/default/grub; then
echo PASS
else
winesapos_test_failure
fi
- echo -n "\tChecking that GRUB is set to use resolutions supported by our theme..."
- grep -q -P "^GRUB_GFXMODE=1280x720,auto" ${WINESAPOS_INSTALL_DIR}/etc/default/grub
- if [ $? -eq 0 ]; then
+ printf "\tChecking that GRUB is set to use resolutions supported by our theme..."
+ if grep -q -P "^GRUB_GFXMODE=1280x720,auto" "${WINESAPOS_INSTALL_DIR}"/etc/default/grub; then
echo PASS
else
winesapos_test_failure
fi
- echo -n "\tChecking that GRUB is set to use the text GFX payload for better boot compatibility..."
- grep -q -P "^GRUB_GFXPAYLOAD_LINUX=text" ${WINESAPOS_INSTALL_DIR}/etc/default/grub
- if [ $? -eq 0 ]; then
+ printf "\tChecking that GRUB is set to use the text GFX payload for better boot compatibility..."
+ if grep -q -P "^GRUB_GFXPAYLOAD_LINUX=text" "${WINESAPOS_INSTALL_DIR}"/etc/default/grub; then
echo PASS
else
winesapos_test_failure
fi
- echo -n "\tChecking that GRUB is set to use winesapOS naming..."
- grep -q -P "^GRUB_DISTRIBUTOR=winesapOS" ${WINESAPOS_INSTALL_DIR}/etc/default/grub
- if [ $? -eq 0 ]; then
+ printf "\tChecking that GRUB is set to use winesapOS naming..."
+ if grep -q -P "^GRUB_DISTRIBUTOR=winesapOS" "${WINESAPOS_INSTALL_DIR}"/etc/default/grub; then
echo PASS
else
winesapos_test_failure
fi
if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
- echo -n "\tChecking that GRUB Btrfs snapshots are set to use winesapOS naming..."
- grep -q -P "^GRUB_BTRFS_SUBMENUNAME=\"winesapOS snapshots\"" ${WINESAPOS_INSTALL_DIR}/etc/default/grub-btrfs/config
- if [ $? -eq 0 ]; then
+ printf "\tChecking that GRUB Btrfs snapshots are set to use winesapOS naming..."
+ if grep -q -P "^GRUB_BTRFS_SUBMENUNAME=\"winesapOS snapshots\"" "${WINESAPOS_INSTALL_DIR}"/etc/default/grub-btrfs/config; then
echo PASS
else
winesapos_test_failure
@@ -816,17 +763,16 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
WINESAPOS_CPU_MITIGATIONS="${WINESAPOS_CPU_MITIGATIONS:-false}"
if [[ "${WINESAPOS_CPU_MITIGATIONS}" == "false" ]]; then
- echo -n "Testing that CPU mitigations are disabled in the Linux kernel..."
- grep -q "mitigations=off" ${WINESAPOS_INSTALL_DIR}/etc/default/grub
- if [ $? -eq 0 ]; then
+ printf "Testing that CPU mitigations are disabled in the Linux kernel..."
+ if grep -q "mitigations=off" "${WINESAPOS_INSTALL_DIR}"/etc/default/grub; then
echo PASS
else
winesapos_test_failure
fi
fi
elif [[ "${WINESAPOS_BOOTLOADER}" == "systemd-boot" ]]; then
- echo -n " \tChecking that the generic '/boot/EFI/BOOT/BOOTX64.EFI' file exists..."
- if [ -f ${WINESAPOS_INSTALL_DIR}/boot/EFI/BOOT/BOOTX64.EFI ]; then
+ printf " \tChecking that the generic '/boot/EFI/BOOT/BOOTX64.EFI' file exists..."
+ if [ -f "${WINESAPOS_INSTALL_DIR}"/boot/EFI/BOOT/BOOTX64.EFI ]; then
echo PASS
else
winesapos_test_failure
@@ -836,28 +782,28 @@ if [[ "${WINESAPOS_BUILD_CHROOT_ONLY}" == "false" ]]; then
fi
echo "Testing that 'yay' is installed..."
-echo -n "\tChecking for the 'yay' binary..."
-if [ -f ${WINESAPOS_INSTALL_DIR}/usr/bin/yay ]; then
+printf "\tChecking for the 'yay' binary..."
+if [ -f "${WINESAPOS_INSTALL_DIR}"/usr/bin/yay ]; then
echo PASS
else
winesapos_test_failure
fi
-echo "\tChecking that the 'yay' package is installed..."
+printf "\tChecking that the 'yay' package is installed..."
pacman_search_loop yay
-echo "\tChecking that the 'yay' package is installed complete."
+printf "\tChecking that the 'yay' package is installed complete."
echo "Testing that 'yay' is complete..."
echo "Testing desktop shortcuts..."
for i in \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/appimagepool.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/balenaEtcher.AppImage \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/bauh.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/blueman-manager.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/firefox-esr.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/terminator.desktop
- do echo -n "\t\tChecking if the file ${i} exists..."
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/appimagepool.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/balenaEtcher.AppImage \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/bauh.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/blueman-manager.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/firefox-esr.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/terminator.desktop
+ do printf "\t\tChecking if the file %s exists..." "${i}"
if [ -f "${i}" ]; then
echo PASS
else
@@ -868,16 +814,16 @@ done
if [[ "${WINESAPOS_INSTALL_GAMING_TOOLS}" == "true" ]]; then
for i in \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/decky_installer.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/io.github.benjamimgois.goverlay.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/com.github.mtkennerly.ludusavi.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/com.nexusmods.app.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/NonSteamLaunchers.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/polychromatic.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/steam.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/steamtinkerlaunch.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/zerotier-gui.desktop
- do echo -n "\t\tChecking if the file ${i} exists..."
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/decky_installer.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/io.github.benjamimgois.goverlay.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/com.github.mtkennerly.ludusavi.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/com.nexusmods.app.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/NonSteamLaunchers.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/polychromatic.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/steam.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/steamtinkerlaunch.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/zerotier-gui.desktop
+ do printf "\t\tChecking if the file %s exists..." "${i}"
if [ -f "${i}" ]; then
echo PASS
else
@@ -889,13 +835,13 @@ fi
if [[ "${WINESAPOS_INSTALL_PRODUCTIVITY_TOOLS}" == "true" ]]; then
for i in \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/clamtk.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/org.coolercontrol.CoolerControl.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/gparted.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/qdirstat.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/org.kde.spectacle.desktop \
- ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/veracrypt.desktop
- do echo -n "\t\tChecking if the file ${i} exists..."
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/clamtk.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/org.coolercontrol.CoolerControl.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/gparted.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/qdirstat.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/org.kde.spectacle.desktop \
+ "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/Desktop/veracrypt.desktop
+ do printf "\t\tChecking if the file %s exists..." "${i}"
if [ -f "${i}" ]; then
echo PASS
else
@@ -906,7 +852,7 @@ fi
if [[ "${WINESAPOS_FIREWALL}" == "true" ]]; then
i="${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/firewall-config.desktop"
- echo -n "\t\tChecking if the file ${i} exists..."
+ printf "\t\tChecking if the file %s exists..." "${i}"
if [ -f "${i}" ]; then
echo PASS
else
@@ -922,8 +868,8 @@ elif [[ "${WINESAPOS_DE}" == "plasma" ]]; then
x=("${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/org.kde.dolphin.desktop" "${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/Desktop/org.kde.gwenview.desktop")
fi
-for y in $x;
- do echo -n "\t\tChecking if the file ${y} exists..."
+for y in "${x[@]}";
+ do printf "\t\tChecking if the file %s exists..." "${y}"
if [ -f "${y}" ]; then
echo PASS
else
@@ -932,20 +878,20 @@ for y in $x;
done
echo "Testing desktop shortcuts complete."
-echo -n "Testing that Oh My Zsh is installed..."
-if [ -f ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.zshrc ]; then
+printf "Testing that Oh My Zsh is installed..."
+if [ -f "${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.zshrc" ]; then
echo PASS
else
winesapos_test_failure
fi
echo "Testing that Oh My Zsh is installed complete."
-echo -n "Testing that the mkinitcpio hooks are loaded in the correct order..."
+printf "Testing that the mkinitcpio hooks are loaded in the correct order..."
if [[ "${WINESAPOS_ENCRYPT}" == "true" ]]; then
- grep -q "HOOKS=(base microcode udev block keyboard keymap modconf encrypt filesystems fsck)" ${WINESAPOS_INSTALL_DIR}/etc/mkinitcpio.conf
+ grep -q "HOOKS=(base microcode udev block keyboard keymap modconf encrypt filesystems fsck)" "${WINESAPOS_INSTALL_DIR}"/etc/mkinitcpio.conf
hooks_result="$?"
else
- grep -q "HOOKS=(base microcode udev block keyboard modconf filesystems fsck)" ${WINESAPOS_INSTALL_DIR}/etc/mkinitcpio.conf
+ grep -q "HOOKS=(base microcode udev block keyboard modconf filesystems fsck)" "${WINESAPOS_INSTALL_DIR}"/etc/mkinitcpio.conf
hooks_result="$?"
fi
if [ "${hooks_result}" -eq 0 ]; then
@@ -957,16 +903,15 @@ echo "Testing that the mkinitcpio hooks are loaded in the correct order complete
# Temporarily disable tests t
#echo "Testing that the Ventoy hook for mkinitcpio exists..."
-#grep -P "^HOOKS=" ${WINESAPOS_INSTALL_DIR}/etc/mkinitcpio.conf | grep -q ventoy
+#grep -P "^HOOKS=" "${WINESAPOS_INSTALL_DIR}"/etc/mkinitcpio.conf | grep -q ventoy
#if [ $? -eq 0 ]; then
# echo PASS
# else
# winesapos_test_failure
#fi
-echo -n "Testing that ParallelDownloads is enabled in Pacman..."
-grep -q -P "^ParallelDownloads" ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
-if [ $? -eq 0 ]; then
+printf "Testing that ParallelDownloads is enabled in Pacman..."
+if grep -q -P "^ParallelDownloads" "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf; then
echo PASS
else
winesapos_test_failure
@@ -975,8 +920,8 @@ echo "Testing that ParallelDownloads is enabled in Pacman complete."
# Temporarily disable test that fails only in GitHub Actions.
# https://github.com/winesapOS/winesapOS/issues/970
-#echo -n "Testing that Pacman is configured to use 'curl'..."
-#grep -q 'XferCommand = /usr/bin/curl --connect-timeout 60 --retry 10 --retry-delay 5 -L -C - -f -o %o %u' ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
+#printf "Testing that Pacman is configured to use 'curl'..."
+#grep -q 'XferCommand = /usr/bin/curl --connect-timeout 60 --retry 10 --retry-delay 5 -L -C - -f -o %o %u' "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf
#if [ $? -eq 0 ]; then
# echo PASS
#else
@@ -984,14 +929,14 @@ echo "Testing that ParallelDownloads is enabled in Pacman complete."
#fi
echo "Testing that the machine-id was reset..."
-echo -n "\t\tChecking that the /etc/machine-id file is empty..."
-if [[ "$(cat ${WINESAPOS_INSTALL_DIR}/etc/machine-id)" == "" ]]; then
+printf "\t\tChecking that the /etc/machine-id file is empty..."
+if [[ "$(cat "${WINESAPOS_INSTALL_DIR}"/etc/machine-id)" == "" ]]; then
echo PASS
else
winesapos_test_failure
fi
-echo -n "\t\tChecking that /var/lib/dbus/machine-id is a symlink..."
-if [[ -L ${WINESAPOS_INSTALL_DIR}/var/lib/dbus/machine-id ]]; then
+printf "\t\tChecking that /var/lib/dbus/machine-id is a symlink..."
+if [[ -L "${WINESAPOS_INSTALL_DIR}"/var/lib/dbus/machine-id ]]; then
echo PASS
else
winesapos_test_failure
@@ -1001,11 +946,11 @@ echo "Testing that the machine-id was reset complete."
if [[ "${WINESAPOS_INSTALL_PRODUCTIVITY_TOOLS}" == "true" ]]; then
echo "Testing that the offline ClamAV databases were downloaded..."
for i in bytecode daily main; do
- echo -n "\t${i}..."
- if [[ -f ${WINESAPOS_INSTALL_DIR}/var/lib/clamav/${i}.cvd ]]; then
+ printf "\t%s..." "${i}"
+ if [[ -f "${WINESAPOS_INSTALL_DIR}"/var/lib/clamav/${i}.cvd ]]; then
echo PASS
else
- if [[ -f ${WINESAPOS_INSTALL_DIR}/var/lib/clamav/${i}.cld ]]; then
+ if [[ -f "${WINESAPOS_INSTALL_DIR}"/var/lib/clamav/${i}.cld ]]; then
echo PASS
else
winesapos_test_failure
@@ -1016,8 +961,8 @@ if [[ "${WINESAPOS_INSTALL_PRODUCTIVITY_TOOLS}" == "true" ]]; then
fi
if [[ "${WINESAPOS_FIREWALL}" == "true" ]]; then
- echo -n "Testing that the firewall has been installed..."
- if [[ -f ${WINESAPOS_INSTALL_DIR}/usr/bin/firewalld ]]; then
+ printf "Testing that the firewall has been installed..."
+ if [[ -f "${WINESAPOS_INSTALL_DIR}"/usr/bin/firewalld ]]; then
echo PASS
else
winesapos_test_failure
@@ -1026,17 +971,15 @@ fi
WINESAPOS_DISABLE_KERNEL_UPDATES="${WINESAPOS_DISABLE_KERNEL_UPDATES:-true}"
if [[ "${WINESAPOS_DISABLE_KERNEL_UPDATES}" == "true" ]]; then
- echo -n "Testing that Pacman is configured to disable Linux kernel updates..."
+ printf "Testing that Pacman is configured to disable Linux kernel updates..."
if [[ "${WINESAPOS_DISTRO}" == "manjaro" ]]; then
- grep -q "IgnorePkg = linux66 linux66-headers linux-fsync-nobara-bin filesystem" ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
- if [ $? -eq 0 ]; then
+ if grep -q "IgnorePkg = linux66 linux66-headers linux-fsync-nobara-bin filesystem" "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf; then
echo PASS
else
winesapos_test_failure
fi
elif [[ "${WINESAPOS_DISTRO}" == "arch" ]]; then
- grep -q "IgnorePkg = linux-lts linux-lts-headers linux-fsync-nobara-bin filesystem" ${WINESAPOS_INSTALL_DIR}/etc/pacman.conf
- if [ $? -eq 0 ]; then
+ if grep -q "IgnorePkg = linux-lts linux-lts-headers linux-fsync-nobara-bin filesystem" "${WINESAPOS_INSTALL_DIR}"/etc/pacman.conf; then
echo PASS
else
winesapos_test_failure
@@ -1044,31 +987,28 @@ if [[ "${WINESAPOS_DISABLE_KERNEL_UPDATES}" == "true" ]]; then
fi
fi
-echo -n '\tChecking that the locale has been set...'
-chroot ${WINESAPOS_INSTALL_DIR} locale --all-locales | grep -i "en_US.utf8"
-if [ $? -eq 0 ]; then
+printf '\tChecking that the locale has been set...'
+if chroot "${WINESAPOS_INSTALL_DIR}" locale --all-locales | grep -i "en_US.utf8"; then
echo PASS
else
winesapos_test_failure
fi
-echo -n "\tChecking that the hostname is set..."
-grep -q -P "^winesapos$" ${WINESAPOS_INSTALL_DIR}/etc/hostname
-if [ $? -eq 0 ]; then
+printf "\tChecking that the hostname is set..."
+if grep -q -P "^winesapos$" "${WINESAPOS_INSTALL_DIR}"/etc/hostname; then
echo PASS
else
winesapos_test_failure
fi
-echo -n "\tChecking that the hosts file is configured..."
-grep -q -P "^127.0.1.1 winesapos$" ${WINESAPOS_INSTALL_DIR}/etc/hosts
-if [ $? -eq 0 ]; then
+printf "\tChecking that the hosts file is configured..."
+if grep -q -P "^127.0.1.1 winesapos$" "${WINESAPOS_INSTALL_DIR}"/etc/hosts; then
echo PASS
else
winesapos_test_failure
fi
-echo "\tChecking that all the packages from the AUR have been installed by yay..."
+printf "\tChecking that all the packages from the AUR have been installed by yay..."
pacman_search_loop \
appimagelauncher \
appimagepool-appimage \
@@ -1110,10 +1050,10 @@ if [[ "${WINESAPOS_APPARMOR}" == "true" ]]; then
apparmor \
krathalans-apparmor-profiles-git
fi
-echo "\tChecking that all the packages from the AUR have been installed by yay done."
+printf "\tChecking that all the packages from the AUR have been installed by yay done."
echo 'Testing that the PipeWire audio library is installed...'
-echo "\tChecking that PipeWire packages are installed..."
+printf "\tChecking that PipeWire packages are installed..."
pacman_search_loop \
pavucontrol \
libpipewire \
@@ -1125,22 +1065,21 @@ pacman_search_loop \
pipewire-v4l2 \
lib32-pipewire-v4l2 \
wireplumber
-echo "\tChecking that PipeWire packages are installed complete."
+printf "\tChecking that PipeWire packages are installed complete."
-echo "\tChecking that PipeWire services are enabled..."
+printf "\tChecking that PipeWire services are enabled..."
for i in \
winesapos-mute.service \
pipewire.service \
pipewire-pulse.service
- do echo -n "\t${i}..."
- ls "${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.config/systemd/user/default.target.wants/${i}" &> /dev/null
- if [ $? -eq 0 ]; then
+ do printf "\t%s..." "${i}"
+ if ls "${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.config/systemd/user/default.target.wants/${i}" &> /dev/null; then
echo PASS
else
winesapos_test_failure
fi
done
-echo "\tChecking that PipeWire services are enabled complete."
+printf "\tChecking that PipeWire services are enabled complete."
echo 'Testing that the PipeWire audio library is installed complete.'
echo 'Testing that support for all file systems is installed...'
@@ -1177,60 +1116,52 @@ pacman_search_loop \
zfs-dkms \
zfs-utils
-echo -n "\tChecking for the existence of '/etc/modules-load.d/winesapos-file-systems.conf'..."
-ls ${WINESAPOS_INSTALL_DIR}/etc/modules-load.d/winesapos-file-systems.conf &> /dev/null
-if [ $? -eq 0 ]; then
+printf "\tChecking for the existence of '/etc/modules-load.d/winesapos-file-systems.conf'..."
+if ls "${WINESAPOS_INSTALL_DIR}"/etc/modules-load.d/winesapos-file-systems.conf &> /dev/null; then
echo PASS
else
winesapos_test_failure
fi
-echo -n "\tChecking the Snapper root configuration is configured to not take timeline snapshots..."
-grep -q -P "^TIMELINE_CREATE=\"no\"" ${WINESAPOS_INSTALL_DIR}/etc/snapper/configs/root
-if [ $? -eq 0 ]; then
+printf "\tChecking the Snapper root configuration is configured to not take timeline snapshots..."
+if grep -q -P "^TIMELINE_CREATE=\"no\"" "${WINESAPOS_INSTALL_DIR}"/etc/snapper/configs/root; then
echo PASS
else
winesapos_test_failure
fi
-echo -n "\tChecking the Snapper home configuration is configured to use the correct subvolume..."
-grep -q -P "^SUBVOLUME=\"/home\"" ${WINESAPOS_INSTALL_DIR}/etc/snapper/configs/home
-if [ $? -eq 0 ]; then
+printf "\tChecking the Snapper home configuration is configured to use the correct subvolume..."
+if grep -q -P "^SUBVOLUME=\"/home\"" "${WINESAPOS_INSTALL_DIR}"/etc/snapper/configs/home; then
echo PASS
else
winesapos_test_failure
fi
echo 'Testing that support for all file systems is installed complete.'
-echo -n "\tChecking that the correct operating system was installed..."
-grep -q "ID=${WINESAPOS_DISTRO}" ${WINESAPOS_INSTALL_DIR}/usr/lib/os-release
-if [ $? -eq 0 ]; then
+printf "\tChecking that the correct operating system was installed..."
+if grep -q "ID=${WINESAPOS_DISTRO}" "${WINESAPOS_INSTALL_DIR}"/usr/lib/os-release; then
echo PASS
else
winesapos_test_failure
fi
-echo -n "\tChecking that the OS variant has been set correctly..."
-grep -q -P "^VARIANT_ID=(minimal|performance|secure)" ${WINESAPOS_INSTALL_DIR}/usr/lib/os-release-winesapos
-if [ $? -eq 0 ]; then
+printf "\tChecking that the OS variant has been set correctly..."
+if grep -q -P "^VARIANT_ID=(minimal|performance|secure)" "${WINESAPOS_INSTALL_DIR}"/usr/lib/os-release-winesapos; then
echo PASS
else
winesapos_test_failure
fi
-echo -n "\tChecking that the sudoers file for 'winesap' is correctly configured..."
+printf "\tChecking that the sudoers file for 'winesap' is correctly configured..."
if [[ "${WINESAPOS_SUDO_NO_PASSWORD}" == "true" ]]; then
- grep -q "${WINESAPOS_USER_NAME} ALL=(root) NOPASSWD:ALL" ${WINESAPOS_INSTALL_DIR}/etc/sudoers.d/${WINESAPOS_USER_NAME}
- if [ $? -eq 0 ]; then
+ if grep -q "${WINESAPOS_USER_NAME} ALL=(root) NOPASSWD:ALL" "${WINESAPOS_INSTALL_DIR}/etc/sudoers.d/${WINESAPOS_USER_NAME}"; then
echo PASS
else
winesapos_test_failure
fi
elif [[ "${WINESAPOS_SUDO_NO_PASSWORD}" == "false" ]]; then
- grep -q "${WINESAPOS_USER_NAME} ALL=(root) ALL" ${WINESAPOS_INSTALL_DIR}/etc/sudoers.d/${WINESAPOS_USER_NAME}
- if [ $? -eq 0 ]; then
- grep -q "${WINESAPOS_USER_NAME} ALL=(root) NOPASSWD: /usr/bin/dmidecode" ${WINESAPOS_INSTALL_DIR}/etc/sudoers.d/${WINESAPOS_USER_NAME}
- if [ $? -eq 0 ]; then
+ if grep -q "${WINESAPOS_USER_NAME} ALL=(root) ALL" "${WINESAPOS_INSTALL_DIR}/etc/sudoers.d/${WINESAPOS_USER_NAME}"; then
+ if grep -q "${WINESAPOS_USER_NAME} ALL=(root) NOPASSWD: /usr/bin/dmidecode" "${WINESAPOS_INSTALL_DIR}/etc/sudoers.d/${WINESAPOS_USER_NAME}"; then
echo PASS
else
winesapos_test_failure
@@ -1240,9 +1171,8 @@ elif [[ "${WINESAPOS_SUDO_NO_PASSWORD}" == "false" ]]; then
fi
fi
-echo -n "\tChecking that the sudo timeout has been increased..."
-grep -q "Defaults:${WINESAPOS_USER_NAME} passwd_tries=20,timestamp_timeout=-1" ${WINESAPOS_INSTALL_DIR}/etc/sudoers.d/${WINESAPOS_USER_NAME}
-if [ $? -eq 0 ]; then
+printf "\tChecking that the sudo timeout has been increased..."
+if grep -q "Defaults:${WINESAPOS_USER_NAME} passwd_tries=20,timestamp_timeout=-1" "${WINESAPOS_INSTALL_DIR}/etc/sudoers.d/${WINESAPOS_USER_NAME}"; then
echo PASS
else
winesapos_test_failure
@@ -1250,23 +1180,22 @@ fi
echo "Testing that winesapOS desktop applications exist..."
for i in \
- /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-dual-boot.desktop \
- /home/${WINESAPOS_USER_NAME}/Desktop/winesapos-dual-boot.desktop \
+ /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-dual-boot.desktop \
+ /home/"${WINESAPOS_USER_NAME}"/Desktop/winesapos-dual-boot.desktop \
/usr/local/bin//winesapos-dual-boot.sh \
- /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-ngfn.desktop \
- /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-setup.sh \
- /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-setup.desktop \
- /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-xcloud.desktop \
- /home/${WINESAPOS_USER_NAME}/.config/autostart/winesapos-setup.desktop \
- /home/${WINESAPOS_USER_NAME}/Desktop/winesapos-setup.desktop \
- /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade-remote-stable.sh \
- /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade.desktop \
- /home/${WINESAPOS_USER_NAME}/Desktop/winesapos-upgrade.desktop \
- /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos_logo_icon.png \
- /usr/share/sddm/faces/${WINESAPOS_USER_NAME}.face.icon;
- do echo -n "\t${i}..."
- ls "${WINESAPOS_INSTALL_DIR}${i}" &> /dev/null
- if [ $? -eq 0 ]; then
+ /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-ngfn.desktop \
+ /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-setup.sh \
+ /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-setup.desktop \
+ /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-xcloud.desktop \
+ /home/"${WINESAPOS_USER_NAME}"/.config/autostart/winesapos-setup.desktop \
+ /home/"${WINESAPOS_USER_NAME}"/Desktop/winesapos-setup.desktop \
+ /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade-remote-stable.sh \
+ /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade.desktop \
+ /home/"${WINESAPOS_USER_NAME}"/Desktop/winesapos-upgrade.desktop \
+ /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos_logo_icon.png \
+ /usr/share/sddm/faces/"${WINESAPOS_USER_NAME}".face.icon;
+ do printf "\t%s..." "${i}"
+ if ls "${WINESAPOS_INSTALL_DIR}${i}" &> /dev/null; then
echo PASS
else
winesapos_test_failure
@@ -1276,19 +1205,17 @@ echo "Testing that winesapOS desktop applications exist complete."
if [[ "${WINESAPOS_ENABLE_KLIPPER}" == "false" ]]; then
echo "Testing that Klipper has been disabled..."
- echo "\tChecking that Klipper settings are configured..."
+ printf "\tChecking that Klipper settings are configured..."
for i in "KeepClipboardContents = false" "MaxClipItems = 1" "PreventEmptyClipboard = false";
- do echo -n -e "\t${i}..."
- grep -q -P "^${i}" ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.config/klipperrc
- if [ $? -eq 0 ]; then
+ do printf "\t%s..." "${i}"
+ if grep -q -P "^${i}" "${WINESAPOS_INSTALL_DIR}"/home/"${WINESAPOS_USER_NAME}"/.config/klipperrc; then
echo PASS
else
winesapos_test_failure
fi
done
- echo -n "\tChecking that the Klipper directory is mounted as a RAM file system..."
- grep -q "ramfs /home/${WINESAPOS_USER_NAME}/.local/share/klipper ramfs rw,nosuid,nodev 0 0" ${WINESAPOS_INSTALL_DIR}/etc/fstab
- if [ $? -eq 0 ]; then
+ printf "\tChecking that the Klipper directory is mounted as a RAM file system..."
+ if grep -q "ramfs /home/${WINESAPOS_USER_NAME}/.local/share/klipper ramfs rw,nosuid,nodev 0 0" "${WINESAPOS_INSTALL_DIR}"/etc/fstab; then
echo PASS
else
winesapos_test_failure
@@ -1297,25 +1224,22 @@ if [[ "${WINESAPOS_ENABLE_KLIPPER}" == "false" ]]; then
fi
echo "Checking that the default text editor has been set..."
-grep -q "EDITOR=nano" ${WINESAPOS_INSTALL_DIR}/etc/environment
-if [ $? -eq 0 ]; then
+if grep -q "EDITOR=nano" "${WINESAPOS_INSTALL_DIR}"/etc/environment; then
echo PASS
else
winesapos_test_failure
fi
echo "Checking that the default text editor has been set complete."
-echo -n "Checking that NetworkManager is using IWD as the backend..."
-grep -q "wifi.backend=iwd" ${WINESAPOS_INSTALL_DIR}/etc/NetworkManager/conf.d/wifi_backend.conf
-if [ $? -eq 0 ]; then
+printf "Checking that NetworkManager is using IWD as the backend..."
+if grep -q "wifi.backend=iwd" "${WINESAPOS_INSTALL_DIR}"/etc/NetworkManager/conf.d/wifi_backend.conf; then
echo PASS
else
winesapos_test_failure
fi
-echo -n "Checking that IPv4 network traffic is prioritized over IPv6..."
-grep -q "precedence ::ffff:0:0/96 100" ${WINESAPOS_INSTALL_DIR}/etc/gai.conf
-if [ $? -eq 0 ]; then
+printf "Checking that IPv4 network traffic is prioritized over IPv6..."
+if grep -q "precedence ::ffff:0:0/96 100" "${WINESAPOS_INSTALL_DIR}"/etc/gai.conf; then
echo PASS
else
winesapos_test_failure
@@ -1323,9 +1247,8 @@ fi
echo "Checking that the ${WINESAPOS_USER_NAME} user name has been set in desktop shortcuts for the setup and upgrade..."
for i in winesapos-setup.desktop winesapos-upgrade.desktop;
- do echo -n -e "\t${i}..."
- grep -q "/home/${WINESAPOS_USER_NAME}" ${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.winesapos/${i}
- if [ $? -eq 0 ]; then
+ do printf "\t%s..." "${i}"
+ if grep -q "/home/${WINESAPOS_USER_NAME}" "${WINESAPOS_INSTALL_DIR}/home/${WINESAPOS_USER_NAME}/.winesapos/${i}"; then
echo PASS
else
winesapos_test_failure
@@ -1334,8 +1257,8 @@ done
echo "Checking that the ${WINESAPOS_USER_NAME} user name has been set in desktop shortcuts for the setup and upgrade done."
echo "Checking that the proprietary Broadcom Wi-Fi drivers are available for offline use..."
-ls -1 ${WINESAPOS_INSTALL_DIR}/var/lib/winesapos/ | grep -q broadcom-wl-dkms
-if [ $? -eq 0 ]; then
+# shellcheck disable=SC2010
+if ls -1 "${WINESAPOS_INSTALL_DIR}"/var/lib/winesapos/ | grep -q broadcom-wl-dkms; then
echo PASS
else
winesapos_test_failure
@@ -1343,16 +1266,16 @@ fi
echo "Checking that the proprietary Broadcom Wi-Fi drivers are available for offline use complete."
echo "Checking that a symlink was created for the 'deck' usesr for compatibility purposes..."
-ls -lah ${WINESAPOS_INSTALL_DIR}/home/deck | grep -P "^lrwx"
-if [ $? -eq 0 ]; then
+# shellcheck disable=SC2010
+if ls -lah "${WINESAPOS_INSTALL_DIR}"/home/deck | grep -P "^lrwx"; then
echo PASS
else
winesapos_test_failure
fi
echo "Checking that a symlink was created for the 'deck' usesr for compatibility purposes complete."
-echo -n "Checking that /snap is a symlink..."
-if [[ -L ${WINESAPOS_INSTALL_DIR}/snap ]]; then
+printf "Checking that /snap is a symlink..."
+if [[ -L "${WINESAPOS_INSTALL_DIR}"/snap ]]; then
echo PASS
else
winesapos_test_failure
@@ -1360,8 +1283,8 @@ fi
echo "Tests end time: $(date)"
-if (( ${failed_tests} == 0 )); then
+if (( failed_tests == 0 )); then
exit 0
else
- exit ${failed_tests}
+ exit "${failed_tests}"
fi
diff --git a/scripts/winesapos-upgrade.sh b/scripts/winesapos-upgrade.sh
index 7c72bde..b61cd91 100755
--- a/scripts/winesapos-upgrade.sh
+++ b/scripts/winesapos-upgrade.sh
@@ -3,15 +3,14 @@
# Enable shell debugging.
set -x
START_TIME=$(date --iso-8601=seconds)
-exec > >(tee /tmp/upgrade_${START_TIME}.log) 2>&1
+exec > >(tee "/tmp/upgrade_${START_TIME}.log") 2>&1
echo "Start time: ${START_TIME}"
WINESAPOS_UPGRADE_FILES="${WINESAPOS_UPGRADE_FILES:-true}"
WINESAPOS_UPGRADE_VERSION_CHECK="${WINESAPOS_UPGRADE_VERSION_CHECK:-true}"
# Check for a custom user name. Default to 'winesap'.
-ls /tmp/winesapos_user_name.txt &> /dev/null
-if [ $? -eq 0 ]; then
+if ls /tmp/winesapos_user_name.txt &> /dev/null; then
WINESAPOS_USER_NAME=$(cat /tmp/winesapos_user_name.txt)
else
WINESAPOS_USER_NAME="winesap"
@@ -21,19 +20,16 @@ fi
ln -s /etc/winesapos /var/winesapos
install_pacman_static() {
- export CMD_PACMAN=/usr/bin/pacman-static
- ls ${CMD_PACMAN} &> /dev/null
- if [ $? -ne 0 ]; then
+ CMD_PACMAN=/usr/bin/pacman-static
+ export CMD_PACMAN
+ if ! ls "${CMD_PACMAN}" &> /dev/null; then
# This package is provided by the Chaotic AUR repository.
- /usr/bin/pacman --noconfirm -S pacman-static
- if [ $? -ne 0 ]; then
+ if ! /usr/bin/pacman --noconfirm -S pacman-static; then
export CMD_PACMAN=/usr/local/bin/pacman-static
- ls ${CMD_PACMAN} &> /dev/null
- if [ $? -ne 0 ]; then
- wget https://pkgbuild.com/~morganamilo/pacman-static/x86_64/bin/pacman-static -LO ${CMD_PACMAN}
- chmod +x ${CMD_PACMAN}
- ls ${CMD_PACMAN} &> /dev/null
- if [ $? -ne 0 ]; then
+ if ! ls "${CMD_PACMAN}" &> /dev/null; then
+ wget https://pkgbuild.com/~morganamilo/pacman-static/x86_64/bin/pacman-static -LO "${CMD_PACMAN}"
+ chmod +x "${CMD_PACMAN}"
+ if ! ls "${CMD_PACMAN}" &> /dev/null; then
# If all else fails, use the non-static 'pacman' binary.
export CMD_PACMAN=/usr/bin/pacman
fi
@@ -45,34 +41,39 @@ install_pacman_static() {
install_pacman_static
WINESAPOS_DISTRO_DETECTED=$(grep -P '^ID=' /etc/os-release | cut -d= -f2)
-CMD_PACMAN_INSTALL=(${CMD_PACMAN} --noconfirm -S --needed)
-CMD_PACMAN_REMOVE=(${CMD_PACMAN} -R -n -s --noconfirm)
-CMD_YAY_INSTALL=(sudo -u ${WINESAPOS_USER_NAME} yay --pacman ${CMD_PACMAN} --noconfirm -S --needed --removemake)
+CMD_PACMAN_INSTALL=("${CMD_PACMAN}" --noconfirm -S --needed)
+CMD_PACMAN_REMOVE=("${CMD_PACMAN}" -R -n -s --noconfirm)
+CMD_YAY_INSTALL=(sudo -u "${WINESAPOS_USER_NAME}" yay --pacman "${CMD_PACMAN}" --noconfirm -S --needed --removemake)
CMD_FLATPAK_INSTALL=(flatpak install -y --noninteractive)
WINESAPOS_VERSION_NEW="$(curl https://raw.githubusercontent.com/winesapOS/winesapOS/stable/files/os-release-winesapos | grep VERSION_ID | cut -d = -f 2)"
-export WINESAPOS_VERSION_ORIGINAL=""
+WINESAPOS_VERSION_ORIGINAL=""
+export WINESAPOS_VERSION_ORIGINAL
# winesapOS >= 4.1.0
if [ -f /usr/lib/os-release-winesapos ]; then
- export WINESAPOS_VERSION_ORIGINAL="$(grep VERSION_ID /usr/lib/os-release-winesapos | cut -d = -f 2)"
+ WINESAPOS_VERSION_ORIGINAL="$(grep VERSION_ID /usr/lib/os-release-winesapos | cut -d = -f 2)"
+ export WINESAPOS_VERSION_ORIGINAL
# winesapOS < 4.1.0
else
- export WINESAPOS_VERSION_ORIGINAL="$(sudo cat /etc/winesapos/VERSION)"
+ WINESAPOS_VERSION_ORIGINAL="$(sudo cat /etc/winesapos/VERSION)"
+ export WINESAPOS_VERSION_ORIGINAL
fi
-export WINESAPOS_IMAGE_TYPE=""
+WINESAPOS_IMAGE_TYPE=""
+export WINESAPOS_IMAGE_TYPE
# winesapOS >= 4.1.0
if [ -f /usr/lib/os-release-winesapos ]; then
- export WINESAPOS_IMAGE_TYPE="$(grep VARIANT_ID /usr/lib/os-release-winesapos | cut -d = -f 2)"
+ WINESAPOS_IMAGE_TYPE="$(grep VARIANT_ID /usr/lib/os-release-winesapos | cut -d = -f 2)"
+ export WINESAPOS_IMAGE_TYPE
# winesapOS < 4.1.0
else
- export WINESAPOS_IMAGE_TYPE="$(sudo cat /etc/winesapos/IMAGE_TYPE)"
+ WINESAPOS_IMAGE_TYPE="$(sudo cat /etc/winesapos/IMAGE_TYPE)"
+ export WINESAPOS_IMAGE_TYPE
fi
echo "Setting up tools required for the progress bar..."
-${CMD_PACMAN} -Q | grep -q qt6-tools
-if [ $? -ne 0 ]; then
- ${CMD_PACMAN_INSTALL[*]} qt6-tools
+if ! "${CMD_PACMAN}" -Q | grep -q qt6-tools; then
+ "${CMD_PACMAN_INSTALL[@]}" qt6-tools
fi
# KDE Plasma 5 uses "qdbus" and 6 uses "qdbus6".
@@ -85,32 +86,33 @@ else
echo "No 'qdbus' command found. Progress bars will not work."
fi
-${CMD_PACMAN} -Q | grep -q kdialog
-if [ $? -ne 0 ]; then
- ${CMD_PACMAN_INSTALL[*]} kdialog
+if ! "${CMD_PACMAN}" -Q | grep -q kdialog; then
+ "${CMD_PACMAN_INSTALL[@]}" kdialog
fi
echo "Setting up tools required for the progress bar complete."
test_internet_connection() {
# Check with https://ping.archlinux.org/ to see if we have an Internet connection.
- return $(curl -s https://ping.archlinux.org/ | grep "This domain is used for connectivity checking" | wc -l)
+ return "$(curl -s https://ping.archlinux.org/ | grep -c "This domain is used for connectivity checking")"
}
while true;
- do kdialog_dbus=$(sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --progressbar "Checking Internet connection..." 2 | cut -d" " -f1)
- sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog showCancelButton false
+ do kdialog_dbus=$(sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --progressbar "Checking Internet connection..." 2 | cut -d" " -f1)
+ sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog showCancelButton false
test_internet_connection
+ # shellcheck disable=SC2181
if [ $? -eq 1 ]; then
- sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
# Break out of the "while" loop if we have an Internet connection.
break 2
fi
- sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
- sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" \
+ sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
+ sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" \
--yesno "A working Internet connection for upgrades is not detected. \
\nPlease connect to the Internet and try again, or select Cancel to quit Upgrade." \
--yes-label "Retry" \
--no-label "Cancel"
+ # shellcheck disable=SC2181
if [ $? -eq 1 ]; then
# Exit the script if the user selects "Cancel".
exit 1
@@ -120,44 +122,43 @@ done
if [[ "${WINESAPOS_UPGRADE_VERSION_CHECK}" == "true" ]]; then
# 'sort -V' does not work with semantic numbers.
# As a workaround, adding an underline to versions without a suffix allows the semantic sort to work.
+ # shellcheck disable=SC2086
if [[ $(echo -e "${WINESAPOS_VERSION_NEW}\n${WINESAPOS_VERSION_ORIGINAL}" | sed '/-/!{s/$/_/}' | sort -V) == "$(echo -e ${WINESAPOS_VERSION_NEW}"\n"${WINESAPOS_VERSION_ORIGINAL} | sed '/-/!{s/$/_/}')" ]]; then
- sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --msgbox "No upgrade for winesapOS available."
+ sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --msgbox "No upgrade for winesapOS available."
exit 0
fi
fi
if [[ "${WINESAPOS_UPGRADE_FILES}" == "true" ]]; then
echo "Upgrading the winesapOS upgrade script..."
- mv /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade-remote-stable.sh "/home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade-remote-stable.sh_${START_TIME}"
- wget https://raw.githubusercontent.com/winesapOS/winesapOS/stable/scripts/winesapos-upgrade-remote-stable.sh -LO /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade-remote-stable.sh
+ mv /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade-remote-stable.sh "/home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade-remote-stable.sh_${START_TIME}"
# If the download fails for any reason, revert back to the original upgrade script.
- if [ $? -ne 0 ]; then
- rm -f /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade-remote-stable.sh
- cp "/home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade-remote-stable.sh_${START_TIME}" /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade-remote-stable.sh
+ if ! wget https://raw.githubusercontent.com/winesapOS/winesapOS/stable/scripts/winesapos-upgrade-remote-stable.sh -LO /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade-remote-stable.sh; then
+ rm -f /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade-remote-stable.sh
+ cp "/home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade-remote-stable.sh_${START_TIME}" /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade-remote-stable.sh
fi
- chmod +x /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade-remote-stable.sh
+ chmod +x /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade-remote-stable.sh
- mv /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade.desktop "/home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade.desktop_${START_TIME}"
- wget https://raw.githubusercontent.com/winesapOS/winesapOS/stable/files/winesapos-upgrade.desktop -LO /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade.desktop
+ mv /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade.desktop "/home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade.desktop_${START_TIME}"
# If the download fails for any reason, revert back to the original upgrade script.
- if [ $? -ne 0 ]; then
- rm -f /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade.desktop
- cp "/home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade.desktop_${START_TIME}" /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade.desktop
+ if ! wget https://raw.githubusercontent.com/winesapOS/winesapOS/stable/files/winesapos-upgrade.desktop -LO /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade.desktop; then
+ rm -f /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade.desktop
+ cp "/home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade.desktop_${START_TIME}" /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade.desktop
fi
- chmod +x /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade.desktop
+ chmod +x /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade.desktop
- chown -R 1000:1000 /home/${WINESAPOS_USER_NAME}/.winesapos/
+ chown -R 1000:1000 /home/"${WINESAPOS_USER_NAME}"/.winesapos/
echo "Upgrading the winesapOS upgrade script complete."
- if [[ "$(sha512sum /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade-remote-stable.sh | cut -d' ' -f1)" != "$(sha512sum /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade-remote-stable.sh_${START_TIME} | cut -d' ' -f1)" ]]; then
+ if [[ "$(sha512sum /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade-remote-stable.sh | cut -d' ' -f1)" != "$(sha512sum "/home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade-remote-stable.sh_${START_TIME}" | cut -d' ' -f1)" ]]; then
echo "The winesapOS upgrade script has been updated. Please re-run the 'winesapOS Upgrade' desktop shortcut."
- sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --msgbox "The winesapOS upgrade script has been updated. Please re-run the 'winesapOS Upgrade' desktop shortcut."
+ sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --msgbox "The winesapOS upgrade script has been updated. Please re-run the 'winesapOS Upgrade' desktop shortcut."
exit 100
fi
- if [[ "$(sha512sum /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade.desktop | cut -d' ' -f1)" != "$(sha512sum /home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade.desktop_${START_TIME} | cut -d' ' -f1)" ]]; then
+ if [[ "$(sha512sum /home/"${WINESAPOS_USER_NAME}"/.winesapos/winesapos-upgrade.desktop | cut -d' ' -f1)" != "$(sha512sum "/home/${WINESAPOS_USER_NAME}/.winesapos/winesapos-upgrade.desktop_${START_TIME}" | cut -d' ' -f1)" ]]; then
echo "The winesapOS upgrade desktop shortcut has been updated. Please re-run the 'winesapOS Upgrade' desktop shortcut."
- sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --msgbox "The winesapOS upgrade desktop shortcut has been updated. Please re-run the 'winesapOS Upgrade' desktop shortcut."
+ sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --msgbox "The winesapOS upgrade desktop shortcut has been updated. Please re-run the 'winesapOS Upgrade' desktop shortcut."
exit 100
fi
else
@@ -166,15 +167,15 @@ fi
current_shell=$(cat /proc/$$/comm)
if [[ "${current_shell}" != "bash" ]]; then
- sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --msgbox "winesapOS scripts require Bash but ${current_shell} detected. Exiting..."
+ sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --msgbox "winesapOS scripts require Bash but ${current_shell} detected. Exiting..."
exit 1
fi
if [[ "${WINESAPOS_IMAGE_TYPE}" == "secure" ]]; then
echo "Allow passwordless 'sudo' for AUR packages installed via 'yay' to be done automatically..."
- mv /etc/sudoers.d/${WINESAPOS_USER_NAME} /root/etc-sudoersd-${WINESAPOS_USER_NAME}
- echo "${WINESAPOS_USER_NAME} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${WINESAPOS_USER_NAME}
- chmod 0440 /etc/sudoers.d/${WINESAPOS_USER_NAME}
+ mv /etc/sudoers.d/"${WINESAPOS_USER_NAME}" /root/etc-sudoersd-"${WINESAPOS_USER_NAME}"
+ echo "${WINESAPOS_USER_NAME} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/"${WINESAPOS_USER_NAME}"
+ chmod 0440 /etc/sudoers.d/"${WINESAPOS_USER_NAME}"
echo "Allow passwordless 'sudo' for AUR packages installed via 'yay' to be done automatically complete."
fi
@@ -187,111 +188,115 @@ systemctl mask packagekit
echo "OLD PACKAGES:"
pacman -Q
-kdialog_dbus=$(sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --progressbar "Please wait for Pacman keyrings to update..." 4 | cut -d" " -f1)
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog showCancelButton false
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+kdialog_dbus=$(sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --progressbar "Please wait for Pacman keyrings to update..." 4 | cut -d" " -f1)
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog showCancelButton false
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
# SteamOS 3.4 changed the name of the stable repositories.
# https://github.com/winesapOS/winesapOS/issues/537
echo "Switching to new SteamOS release repositories..."
-sed -i s'/\[holo\]/\[holo-rel\]/'g /etc/pacman.conf
-sed -i s'/\[jupiter\]/\[jupiter-rel\]/'g /etc/pacman.conf
+sed -i 's/\[holo\]/\[holo-rel\]/g' /etc/pacman.conf
+sed -i 's/\[jupiter\]/\[jupiter-rel\]/g' /etc/pacman.conf
echo "Switching to new SteamOS release repositories complete."
# Update the repository cache.
sudo -E ${CMD_PACMAN} -S -y -y
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
# It is possible for users to have such an old database of GPG keys that the '*-keyring' packages fail to install due to GPG verification failures.
crudini --set /etc/pacman.conf core SigLevel Never
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "manjaro" ]]; then
rm -r -f /etc/pacman.d/gnupg
pacman-key --init
- sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
+ sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
${CMD_PACMAN} --noconfirm -S archlinux-keyring manjaro-keyring
else
rm -r -f /etc/pacman.d/gnupg
pacman-key --init
- sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
+ sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
${CMD_PACMAN} --noconfirm -S archlinux-keyring
fi
crudini --del /etc/pacman.conf core SigLevel
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
# Workaround an upstream bug in DKMS.
## https://github.com/winesapOS/winesapOS/issues/427
ln -s /usr/bin/sha512sum /usr/bin/sha512
echo "Running 3.0.0-rc.0 to 3.0.0 upgrades..."
-kdialog_dbus=$(sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --progressbar "Running 3.0.0-rc.0 to 3.0.0 upgrades..." 2 | cut -d" " -f1)
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog showCancelButton false
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+kdialog_dbus=$(sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --progressbar "Running 3.0.0-rc.0 to 3.0.0 upgrades..." 2 | cut -d" " -f1)
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog showCancelButton false
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
echo "Upgrading exFAT partition to work on Windows..."
# Example output: "vda2" or "nvme0n1p2"
exfat_partition_device_name_short=$(lsblk -o name,label | grep wos-drive | awk '{print $1}' | grep -o -P '[a-z]+.*')
exfat_partition_device_name_full="/dev/${exfat_partition_device_name_short}"
# Example output: 2
-exfat_partition_number=$(echo ${exfat_partition_device_name_short} | grep -o -P "[0-9]+$")
+exfat_partition_number=$(echo "${exfat_partition_device_name_short}" | grep -o -P "[0-9]+$")
-echo ${exfat_partition_device_name_short} | grep -q nvme
-if [ $? -eq 0 ]; then
+if echo "${exfat_partition_device_name_short}" | grep -q nvme; then
# Example output: /dev/nvme0n1
root_device=$(echo "${exfat_partition_device_name_full}" | grep -P -o "/dev/nvme[0-9]+n[0-9]+")
else
# Example output: /dev/vda
- root_device=$(echo "${exfat_partition_device_name_full}" | sed s'/[0-9]//'g)
+ # shellcheck disable=SC2001
+ root_device=$(echo "${exfat_partition_device_name_full}" | sed 's/[0-9]//g')
fi
-parted ${root_device} set ${exfat_partition_number} msftdata on
+parted "${root_device}" set "${exfat_partition_number}" msftdata on
echo "Upgrading exFAT partition to work on Windows complete."
echo "Running 3.0.0-rc.0 to 3.0.0 upgrades complete."
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
echo "Running 3.0.0 to 3.0.1 upgrades..."
-kdialog_dbus=$(sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --progressbar "Running 3.0.0 to 3.0.1 upgrades..." 2 | cut -d" " -f1)
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog showCancelButton false
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+kdialog_dbus=$(sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --progressbar "Running 3.0.0 to 3.0.1 upgrades..." 2 | cut -d" " -f1)
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog showCancelButton false
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
echo "Upgrading 'makepkg' and 'yay' to use all available processor cores for compilation..."
-grep -q -P "^MAKEFLAGS" /etc/makepkg.conf
-if [ $? -ne 0 ]; then
+if ! grep -q -P "^MAKEFLAGS" /etc/makepkg.conf; then
+ # shellcheck disable=SC2016
echo 'MAKEFLAGS="-j $(nproc)"' >> /etc/makepkg.conf
fi
echo "Upgrading 'makepkg' and 'yay' to use all available processor cores for compilation complete."
echo "Running 3.0.0 to 3.0.1 upgrades complete."
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
echo "Running 3.0.1 to 3.1.0 upgrades..."
-kdialog_dbus=$(sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --progressbar "Running 3.0.1 to 3.1.0 upgrades..." 12 | cut -d" " -f1)
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog showCancelButton false
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+kdialog_dbus=$(sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --progressbar "Running 3.0.1 to 3.1.0 upgrades..." 12 | cut -d" " -f1)
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog showCancelButton false
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
# Disable XferCommand for Pacman 6.1.
# https://github.com/winesapOS/winesapOS/issues/802
# https://github.com/winesapOS/winesapOS/issues/900
crudini --del /etc/pacman.conf options XferCommand
-${CMD_PACMAN} -Q pacman | grep -q "pacman 6.1"
-if [ $? -ne 0 ]; then
- sed -i s'/\[options\]/\[options\]\nXferCommand = \/usr\/bin\/curl --connect-timeout 60 --retry 10 --retry-delay 5 -L -C - -f -o %o %u/'g /etc/pacman.conf
+if ! ${CMD_PACMAN} -Q pacman | grep -q "pacman 6.1"; then
+ sed -i 's/\[options\]/\[options\]\nXferCommand = \/usr\/bin\/curl --connect-timeout 60 --retry 10 --retry-delay 5 -L -C - -f -o %o %u/g' /etc/pacman.conf
fi
echo "Adding the winesapOS repository..."
crudini --del /etc/pacman.conf winesapos
crudini --del /etc/pacman.conf winesapos-testing
if [[ "${WINESAPOS_UPGRADE_TESTING_REPO}" == "true" ]]; then
- sed -i s'/\[core]/[winesapos-testing]\nServer = https:\/\/winesapos.lukeshort.cloud\/repo\/$repo\/$arch\nSigLevel = Never\n\n[core]/'g /etc/pacman.conf
+ # shellcheck disable=SC2016
+ sed -i 's/\[core]/[winesapos-testing]\nServer = https:\/\/winesapos.lukeshort.cloud\/repo\/$repo\/$arch\nSigLevel = Never\n\n[core]/g' /etc/pacman.conf
else
- sed -i s'/\[core]/[winesapos]\nServer = https:\/\/winesapos.lukeshort.cloud\/repo\/$repo\/$arch\n\n[core]/'g /etc/pacman.conf
+ # shellcheck disable=SC2016
+ sed -i 's/\[core]/[winesapos]\nServer = https:\/\/winesapos.lukeshort.cloud\/repo\/$repo\/$arch\n\n[core]/g' /etc/pacman.conf
fi
echo "Adding the winesapOS repository complete."
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
echo "Enabling newer upstream Arch Linux package repositories..."
if [[ "${WINESAPOS_DISTRO_DETECTED}" != "manjaro" ]]; then
+ # shellcheck disable=SC2016
crudini --set /etc/pacman.conf core Server 'https://mirror.rackspace.com/archlinux/$repo/os/$arch'
crudini --del /etc/pacman.conf core Include
+ # shellcheck disable=SC2016
crudini --set /etc/pacman.conf extra Server 'https://mirror.rackspace.com/archlinux/$repo/os/$arch'
crudini --del /etc/pacman.conf extra Include
+ # shellcheck disable=SC2016
crudini --set /etc/pacman.conf multilib Server 'https://mirror.rackspace.com/archlinux/$repo/os/$arch'
crudini --del /etc/pacman.conf multilib Include
fi
@@ -304,14 +309,15 @@ crudini --del /etc/pacman.conf holo
crudini --del /etc/pacman.conf jupiter-rel
crudini --del /etc/pacman.conf holo-rel
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "steamos" ]]; then
+ # shellcheck disable=SC2016
crudini --set /etc/pacman.conf jupiter-rel Server 'https://steamdeck-packages.steamos.cloud/archlinux-mirror/$repo/os/$arch'
crudini --set /etc/pacman.conf jupiter-rel SigLevel Never
+ # shellcheck disable=SC2016
crudini --set /etc/pacman.conf holo-rel Server 'https://steamdeck-packages.steamos.cloud/archlinux-mirror/$repo/os/$arch'
crudini --set /etc/pacman.conf holo-rel SigLevel Never
fi
-pacman-key --list-keys | grep -q 1805E886BECCCEA99EDF55F081CA29E4A4B01239
-if [ $? -ne 0 ]; then
+if ! pacman-key --list-keys | grep -q 1805E886BECCCEA99EDF55F081CA29E4A4B01239; then
echo "Adding the public GPG key for the winesapOS repository..."
pacman-key --recv-keys 1805E886BECCCEA99EDF55F081CA29E4A4B01239
pacman-key --init
@@ -320,7 +326,7 @@ if [ $? -ne 0 ]; then
echo "Adding the public GPG key for the winesapOS repository complete."
fi
sudo -E ${CMD_PACMAN} -S -y -y
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
# Install the latest Chaotic AUR keyring and mirror list.
wget 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' -LO /chaotic-keyring.pkg.tar.zst
@@ -330,11 +336,9 @@ ${CMD_PACMAN} --noconfirm -U /chaotic-mirrorlist.pkg.tar.zst
rm -f /chaotic-*.pkg.tar.zst
# Configure the Pacman configuration after the keys and mirrors have been installed for the Chaotic AUR.
-grep -q "\[chaotic-aur\]" /etc/pacman.conf
-if [ $? -ne 0 ]; then
+if ! grep -q "\[chaotic-aur\]" /etc/pacman.conf; then
echo "Adding the Chaotic AUR repository..."
- pacman-key --list-keys | grep -q 3056513887B78AEB
- if [ $? -ne 0 ]; then
+ if pacman-key --list-keys | grep -q 3056513887B78AEB; then
echo "Adding the public GPG key for the Chaotic AUR repository..."
pacman-key --recv-keys 3056513887B78AEB
pacman-key --init
@@ -349,11 +353,13 @@ fi
crudini --del /etc/pacman.conf arch-mact2
crudini --del /etc/pacman.conf Redecorating-t2
+# shellcheck disable=SC2016
crudini --set /etc/pacman.conf arch-mact2 Server https://mirror.funami.tech/arch-mact2/os/x86_64
crudini --set /etc/pacman.conf arch-mact2 SigLevel Never
+# shellcheck disable=SC2016
crudini --set /etc/pacman.conf Redecorating-t2 Server https://github.com/Redecorating/archlinux-t2-packages/releases/download/packages
crudini --set /etc/pacman.conf Redecorating-t2 SigLevel Never
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
sudo -E ${CMD_PACMAN} -S -y -y
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "manjaro" ]]; then
@@ -364,69 +370,65 @@ fi
install_pacman_static
echo "Enabling newer upstream Arch Linux package repositories complete."
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
# Upgrade glibc. This allows some programs to work during the upgrade process.
-${CMD_PACMAN_INSTALL[*]} glibc lib32-glibc
+"${CMD_PACMAN_INSTALL[@]}" glibc lib32-glibc
-${CMD_PACMAN} -Q | grep -q libpamac-full
-if [ $? -eq 0 ]; then
+if ${CMD_PACMAN} -Q | grep -q libpamac-full; then
echo "Replacing Pacmac with bauh..."
# Do not remove dependencies to keep 'flatpak' and 'snapd' installed.
# The first '--nodeps' tells Pacman to not remove dependencies.
# The second '--nodeps' tells is to ignore the packages being required as a dependency for other applications.
# 'discover' needs 'archlinux-appstream-data' so we will re-install it after this.
${CMD_PACMAN} -R -n --nodeps --nodeps --noconfirm archlinux-appstream-data-pamac libpamac-full pamac-all
- ${CMD_PACMAN_INSTALL[*]} archlinux-appstream-data
- ${CMD_YAY_INSTALL[*]} bauh
- rm -f /home/${WINESAPOS_USER_NAME}/Desktop/org.manjaro.pamac.manager.desktop
- cp /usr/share/applications/bauh.desktop /home/${WINESAPOS_USER_NAME}/Desktop/
- chmod +x /home/${WINESAPOS_USER_NAME}/Desktop/bauh.desktop
- chown 1000:1000 /home/${WINESAPOS_USER_NAME}/Desktop/bauh.desktop
+ "${CMD_PACMAN_INSTALL[@]}" archlinux-appstream-data
+ "${CMD_YAY_INSTALL[@]}" bauh
+ rm -f /home/"${WINESAPOS_USER_NAME}"/Desktop/org.manjaro.pamac.manager.desktop
+ cp /usr/share/applications/bauh.desktop /home/"${WINESAPOS_USER_NAME}"/Desktop/
+ chmod +x /home/"${WINESAPOS_USER_NAME}"/Desktop/bauh.desktop
+ chown 1000:1000 /home/"${WINESAPOS_USER_NAME}"/Desktop/bauh.desktop
# Enable the 'snapd' service. This was not enabled in winesapOS <= 3.1.1.
systemctl enable --now snapd
echo "Replacing Pacmac with bauh complete."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
-grep -q tmpfs /etc/fstab
-if [ $? -ne 0 ]; then
+if ! grep -q tmpfs /etc/fstab; then
echo "Switching volatile mounts from 'ramfs' to 'tmpfs' for compatibility with FUSE (used by AppImage and Flatpak packages)..."
- sed -i s'/ramfs/tmpfs/'g /etc/fstab
+ sed -i 's/ramfs/tmpfs/g' /etc/fstab
echo "Switching volatile mounts from 'ramfs' to 'tmpfs' for compatibility with FUSE (used by AppImage and Flatpak packages) complete."
fi
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "steamos" ]]; then
# This is a new package in SteamOS 3.2 that will replace 'linux-firmware' which can lead to unbootable systems.
# https://github.com/winesapOS/winesapOS/issues/372
- grep -q linux-firmware-neptune-rtw-debug /etc/pacman.conf
- if [ $? -ne 0 ]; then
+ if ! grep -q linux-firmware-neptune-rtw-debug /etc/pacman.conf; then
echo "Ignoring the new conflicting linux-firmware-neptune-rtw-debug package..."
- sed -i s'/IgnorePkg = /IgnorePkg = linux-firmware-neptune-rtw-debug /'g /etc/pacman.conf
+ sed -i 's/IgnorePkg = /IgnorePkg = linux-firmware-neptune-rtw-debug /g' /etc/pacman.conf
echo "Ignoring the new conflicting linux-firmware-neptune-rtw-debug package complete."
fi
fi
# Install ProtonUp-Qt as a Flatpak to avoid package conflicts when upgrading to Arch Linux packages.
# https://github.com/winesapOS/winesapOS/issues/375#issuecomment-1146678638
-${CMD_PACMAN} -Q | grep -q protonup-qt
-if [ $? -eq 0 ]; then
+if ${CMD_PACMAN} -Q | grep -q protonup-qt; then
echo "Installing a newer version of ProtonUp-Qt..."
- ${CMD_PACMAN_REMOVE[*]} protonup-qt
- rm -f /home/${WINESAPOS_USER_NAME}/Desktop/net.davidotek.pupgui2.desktop
- ${CMD_FLATPAK_INSTALL[*]} net.davidotek.pupgui2
- cp /var/lib/flatpak/app/net.davidotek.pupgui2/current/active/export/share/applications/net.davidotek.pupgui2.desktop /home/${WINESAPOS_USER_NAME}/Desktop/
- chmod +x /home/${WINESAPOS_USER_NAME}/Desktop/net.davidotek.pupgui2.desktop
- chown 1000:1000 /home/${WINESAPOS_USER_NAME}/Desktop/net.davidotek.pupgui2.desktop
+ "${CMD_PACMAN_REMOVE[@]}" protonup-qt
+ rm -f /home/"${WINESAPOS_USER_NAME}"/Desktop/net.davidotek.pupgui2.desktop
+ "${CMD_FLATPAK_INSTALL[@]}" net.davidotek.pupgui2
+ cp /var/lib/flatpak/app/net.davidotek.pupgui2/current/active/export/share/applications/net.davidotek.pupgui2.desktop /home/"${WINESAPOS_USER_NAME}"/Desktop/
+ chmod +x /home/"${WINESAPOS_USER_NAME}"/Desktop/net.davidotek.pupgui2.desktop
+ chown 1000:1000 /home/"${WINESAPOS_USER_NAME}"/Desktop/net.davidotek.pupgui2.desktop
echo "Installing a newer version of ProtonUp-Qt complete."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
if [[ "${WINESAPOS_IMAGE_TYPE}" != "minimal" ]]; then
- ls -1 /etc/modules-load.d/ | grep -q winesapos-controllers.conf
- if [ $? -ne 0 ]; then
+ # shellcheck disable=SC2010
+ if ! ls -1 /etc/modules-load.d/ | grep -q winesapos-controllers.conf; then
echo "Installing Xbox controller support..."
- ${CMD_YAY_INSTALL[*]} xone-dkms-git
+ "${CMD_YAY_INSTALL[@]}" xone-dkms-git
touch /etc/modules-load.d/winesapos-controllers.conf
echo -e "xone-wired\nxone-dongle\nxone-gip\nxone-gip-gamepad\nxone-gip-headset\nxone-gip-chatpad\nxone-gip-guitar" | tee /etc/modules-load.d/winesapos-controllers.conf
for i in xone-wired xone-dongle xone-gip xone-gip-gamepad xone-gip-headset xone-gip-chatpad xone-gip-guitar;
@@ -435,81 +437,74 @@ if [[ "${WINESAPOS_IMAGE_TYPE}" != "minimal" ]]; then
echo "Installing Xbox controller support complete."
fi
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
if [[ "${WINESAPOS_IMAGE_TYPE}" != "minimal" ]]; then
- flatpak list | grep -P "^AntiMicroX" &> /dev/null
- if [ $? -ne 0 ]; then
+ if ! flatpak list | grep -P "^AntiMicroX" &> /dev/null; then
echo "Installing AntiMicroX for changing controller inputs..."
- ${CMD_FLATPAK_INSTALL[*]} io.github.antimicrox.antimicrox
- cp /var/lib/flatpak/app/io.github.antimicrox.antimicrox/current/active/export/share/applications/io.github.antimicrox.antimicrox.desktop /home/${WINESAPOS_USER_NAME}/Desktop/
- chmod +x /home/${WINESAPOS_USER_NAME}/Desktop/io.github.antimicrox.antimicrox.desktop
- chown 1000:1000 /home/${WINESAPOS_USER_NAME}/Desktop/io.github.antimicrox.antimicrox.desktop
+ "${CMD_FLATPAK_INSTALL[@]}" io.github.antimicrox.antimicrox
+ cp /var/lib/flatpak/app/io.github.antimicrox.antimicrox/current/active/export/share/applications/io.github.antimicrox.antimicrox.desktop /home/"${WINESAPOS_USER_NAME}"/Desktop/
+ chmod +x /home/"${WINESAPOS_USER_NAME}"/Desktop/io.github.antimicrox.antimicrox.desktop
+ chown 1000:1000 /home/"${WINESAPOS_USER_NAME}"/Desktop/io.github.antimicrox.antimicrox.desktop
echo "Installing AntiMicroX for changing controller inputs complete."
fi
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 8
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 8
-if [[ "${XDG_CURRENT_DESKTOP}" -eq "KDE" ]]; then
+if [[ "${XDG_CURRENT_DESKTOP}" = "KDE" ]]; then
if [ ! -f /usr/bin/kate ]; then
echo "Installing the simple text editor 'kate'...."
- ${CMD_PACMAN_INSTALL[*]} kate
+ "${CMD_PACMAN_INSTALL[@]}" kate
echo "Installing the simple text editor 'kate' complete."
fi
-elif [[ "${XDG_CURRENT_DESKTOP}" -eq "X-Cinnamon" ]]; then
+elif [[ "${XDG_CURRENT_DESKTOP}" = "X-Cinnamon" ]]; then
if [ ! -f /usr/bin/xed ]; then
echo "Installing the simple text editor 'xed'..."
- ${CMD_PACMAN_INSTALL[*]} xed
+ "${CMD_PACMAN_INSTALL[@]}" xed
echo "Installing the simple text editor 'xed' complete."
fi
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 9
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 9
-${CMD_PACMAN} -Q | grep -q linux-firmware-neptune
-if [ $? -eq 0 ]; then
+if ${CMD_PACMAN} -Q | grep -q linux-firmware-neptune; then
echo "Removing conflicting 'linux-firmware-neptune' packages..."
- ${CMD_PACMAN} -Q linux-firmware-neptune &> /dev/null
- if [ $? -eq 0 ]; then
- ${CMD_PACMAN_REMOVE[*]} linux-firmware-neptune
+ if ${CMD_PACMAN} -Q linux-firmware-neptune &> /dev/null; then
+ "${CMD_PACMAN_REMOVE[@]}" linux-firmware-neptune
fi
- ${CMD_PACMAN} -Q linux-firmware-neptune-rtw-debug &> /dev/null
- if [ $? -eq 0 ]; then
- ${CMD_PACMAN_REMOVE[*]} linux-firmware-neptune-rtw-debug
+ if ${CMD_PACMAN} -Q linux-firmware-neptune-rtw-debug &> /dev/null; then
+ "${CMD_PACMAN_REMOVE[@]}" linux-firmware-neptune-rtw-debug
fi
- ${CMD_PACMAN_INSTALL[*]} linux-firmware
+ "${CMD_PACMAN_INSTALL[@]}" linux-firmware
echo "Removing conflicting 'linux-firmware-neptune' packages complete."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 10
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 10
echo "Upgrading to 'clang' from Arch Linux..."
-${CMD_PACMAN} -Q | grep -q clang-libs
-if [ $? -eq 0 ]; then
+if ${CMD_PACMAN} -Q | grep -q clang-libs; then
# SteamOS 3 splits 'clang' (64-bit) into two packages: (1) 'clang' and (2) 'clang-libs'.
# It does not ship a 'lib32-clang' package.
${CMD_PACMAN} -R -d --nodeps --noconfirm clang clang-libs
fi
# Arch Linux has a 'clang' and 'lib32-clang' package.
-${CMD_PACMAN_INSTALL[*]} clang lib32-clang
+"${CMD_PACMAN_INSTALL[@]}" clang lib32-clang
echo "Upgrading to 'clang' from Arch Linux complete."
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 11
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 11
echo "Running 3.0.1 to 3.1.0 upgrades complete."
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
echo "Running 3.1.0 to 3.1.1 upgrades..."
-kdialog_dbus=$(sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --progressbar "Running 3.1.0 to 3.1.1 upgrades..." 2 | cut -d" " -f1)
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog showCancelButton false
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+kdialog_dbus=$(sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --progressbar "Running 3.1.0 to 3.1.1 upgrades..." 2 | cut -d" " -f1)
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog showCancelButton false
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
-${CMD_PACMAN} -Q | grep -q pipewire-media-session
-if [ $? -eq 0 ]; then
+if ${CMD_PACMAN} -Q | grep -q pipewire-media-session; then
${CMD_PACMAN} -R -d --nodeps --noconfirm pipewire-media-session
- ${CMD_PACMAN_INSTALL[*]} wireplumber
+ "${CMD_PACMAN_INSTALL[@]}" wireplumber
fi
-grep -q -P "^GRUB_THEME=/boot/grub/themes/Vimix/theme.txt" /etc/default/grub
-if [ $? -ne 0 ]; then
- ${CMD_PACMAN_INSTALL[*]} grub-theme-vimix
+if ! grep -q -P "^GRUB_THEME=/boot/grub/themes/Vimix/theme.txt" /etc/default/grub; then
+ "${CMD_PACMAN_INSTALL[@]}" grub-theme-vimix
## This theme needs to exist in the '/boot/' mount because if the root file system is encrypted, then the theme cannot be found.
mkdir -p /boot/grub/themes/
cp -R /usr/share/grub/themes/Vimix /boot/grub/themes/Vimix
@@ -524,80 +519,74 @@ if [ $? -ne 0 ]; then
sed -i -r "s/(\S*)\s*=\s*(.*)/\1=\2/g" /etc/default/grub
fi
echo "Running 3.1.0 to 3.1.1 upgrades complete."
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
echo "Running 3.1.1 to 3.2.0 upgrades..."
-kdialog_dbus=$(sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --progressbar "Running 3.1.1 to 3.2.0 upgrades..." 5 | cut -d" " -f1)
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog showCancelButton false
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+kdialog_dbus=$(sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --progressbar "Running 3.1.1 to 3.2.0 upgrades..." 5 | cut -d" " -f1)
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog showCancelButton false
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "steamos" ]]; then
- ${CMD_PACMAN} -Q | grep -q linux-steamos
- if [ $? -ne 0 ]; then
+ if ! ${CMD_PACMAN} -Q | grep -q linux-steamos; then
${CMD_PACMAN} -R -d --nodeps --noconfirm linux-neptune linux-neptune-headers
- ${CMD_PACMAN_INSTALL[*]} linux linux-headers
+ "${CMD_PACMAN_INSTALL[@]}" linux linux-headers
fi
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
if [[ "${WINESAPOS_IMAGE_TYPE}" != "minimal" ]]; then
- flatpak list | grep -P "^Flatseal" &> /dev/null
- if [ $? -ne 0 ]; then
- ${CMD_FLATPAK_INSTALL[*]} com.github.tchx84.Flatseal
- cp /var/lib/flatpak/app/com.github.tchx84.Flatseal/current/active/export/share/applications/com.github.tchx84.Flatseal.desktop /home/${WINESAPOS_USER_NAME}/Desktop/
- chmod +x /home/${WINESAPOS_USER_NAME}/Desktop/com.github.tchx84.Flatseal.desktop
- chown 1000:1000 /home/${WINESAPOS_USER_NAME}/Desktop/com.github.tchx84.Flatseal.desktop
+ if ! flatpak list | grep -P "^Flatseal" &> /dev/null; then
+ "${CMD_FLATPAK_INSTALL[@]}" com.github.tchx84.Flatseal
+ cp /var/lib/flatpak/app/com.github.tchx84.Flatseal/current/active/export/share/applications/com.github.tchx84.Flatseal.desktop /home/"${WINESAPOS_USER_NAME}"/Desktop/
+ chmod +x /home/"${WINESAPOS_USER_NAME}"/Desktop/com.github.tchx84.Flatseal.desktop
+ chown 1000:1000 /home/"${WINESAPOS_USER_NAME}"/Desktop/com.github.tchx84.Flatseal.desktop
fi
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
-${CMD_PACMAN} -Q | grep -q game-devices-udev
-if [ $? -eq 0 ]; then
- sudo -u ${WINESAPOS_USER_NAME} yay --pacman ${CMD_PACMAN} --noconfirm -S --removemake game-devices-udev
+if ${CMD_PACMAN} -Q | grep -q game-devices-udev; then
+ sudo -u "${WINESAPOS_USER_NAME}" yay --pacman ${CMD_PACMAN} --noconfirm -S --removemake game-devices-udev
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
if [[ "${WINESAPOS_DISTRO_DETECTED}" == "steamos" ]]; then
# If holo-rel/filesystem is replaced by core/filesystem during an upgrade it can break UEFI boot.
# https://github.com/winesapOS/winesapOS/issues/514
- grep -P ^IgnorePkg /etc/pacman.conf | grep -q filesystem
- if [ $? -ne 0 ]; then
+ if ! grep -P ^IgnorePkg /etc/pacman.conf | grep -q filesystem; then
echo "Ignoring the conflicting 'filesystem' package..."
- sed -i s'/IgnorePkg = /IgnorePkg = filesystem /'g /etc/pacman.conf
+ sed -i 's/IgnorePkg = /IgnorePkg = filesystem /g' /etc/pacman.conf
echo "Ignoring the conflicting 'filesystem' package complete."
fi
fi
echo "Running 3.1.1 to 3.2.0 upgrades complete."
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
echo "Running 3.2.0 to 3.2.1 upgrades..."
echo "Switching Steam back to the 'stable' update channel..."
-rm -f /home/${WINESAPOS_USER_NAME}/.local/share/Steam/package/beta
+rm -f /home/"${WINESAPOS_USER_NAME}"/.local/share/Steam/package/beta
echo "Switching Steam back to the 'stable' update channel complete."
echo "Running 3.2.0 to 3.2.1 upgrades complete."
echo "Running 3.2.1 to 3.3.0 upgrades..."
-kdialog_dbus=$(sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --progressbar "Running 3.2.1 to 3.3.0 upgrades..." 13 | cut -d" " -f1)
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog showCancelButton false
+kdialog_dbus=$(sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --progressbar "Running 3.2.1 to 3.3.0 upgrades..." 13 | cut -d" " -f1)
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog showCancelButton false
echo "Setting up default text editor..."
-grep -q "EDITOR=nano" /etc/environment
-if [ $? -eq 0 ]; then
+if grep -q "EDITOR=nano" /etc/environment; then
echo "Default text editor already set. Skipping..."
else
echo "Default text editor not already set. Proceeding..."
echo "EDITOR=nano" >> /etc/environment
fi
echo "Setting up default text editor complete."
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
echo "Switching to the new 'plasma5-themes-vapor-steamos' package..."
-${CMD_PACMAN} -Q steamdeck-kde-presets
-if [ $? -eq 0 ]; then
+if ${CMD_PACMAN} -Q steamdeck-kde-presets; then
echo "Old 'steamdeck-kde-presets' package detected. Proceeding..."
rm -f /usr/share/libalpm/hooks/steamdeck-kde-presets.hook
${CMD_PACMAN} -R -n --noconfirm steamdeck-kde-presets
- ${CMD_YAY_INSTALL[*]} plasma5-themes-vapor-steamos
+ "${CMD_YAY_INSTALL[@]}" plasma5-themes-vapor-steamos
# Force update "konsole" to get the /etc/xdg/konsolerc file it provides.
rm -f /etc/xdg/konsolerc
${CMD_PACMAN} -S --noconfirm konsole
@@ -605,25 +594,23 @@ else
echo "Old 'steamdeck-kde-presets' package not detected. Skipping..."
fi
echo "Switching to the new 'plasma5-themes-vapor-steamos' package complete."
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
echo "Switching to the new 'libpipewire' package..."
-${CMD_PACMAN} -Q pipewire
-if [ $? -eq 0 ]; then
+if ${CMD_PACMAN} -Q pipewire; then
echo "Old 'pipewire' package detected. Proceeding..."
${CMD_PACMAN} -R -n --nodeps --nodeps --noconfirm pipewire lib32-pipewire
- ${CMD_PACMAN_INSTALL[*]} libpipewire lib32-libpipewire
+ "${CMD_PACMAN_INSTALL[@]}" libpipewire lib32-libpipewire
else
echo "Old 'pipewire' package not detected. Skipping..."
fi
echo "Switching to the new 'libpipewire' package complete."
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
echo "Limiting the number of Snapper backups..."
-ls /etc/systemd/system/snapper-cleanup-hourly.timer
-if [ $? -ne 0 ]; then
- sed -i s'/TIMELINE_LIMIT_HOURLY=.*/TIMELINE_LIMIT_HOURLY="10"/'g /etc/snapper/configs/root
- sed -i s'/TIMELINE_LIMIT_HOURLY=.*/TIMELINE_LIMIT_HOURLY="10"/'g /etc/snapper/configs/home
+if ! ls /etc/systemd/system/snapper-cleanup-hourly.timer; then
+ sed -i 's/TIMELINE_LIMIT_HOURLY=.*/TIMELINE_LIMIT_HOURLY="10"/g' /etc/snapper/configs/root
+ sed -i 's/TIMELINE_LIMIT_HOURLY=.*/TIMELINE_LIMIT_HOURLY="10"/g' /etc/snapper/configs/home
cat <<EOF > /etc/systemd/system/snapper-cleanup-hourly.timer
[Unit]
Description=Hourly Cleanup of Snapper Snapshots
@@ -643,7 +630,7 @@ EOF
systemctl restart snapper-timeline.timer
fi
echo "Limiting the number of Snapper backups complete."
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
echo "Setting 'iwd' as the backend for NetworkManager..."
echo -e "[device]\nwifi.backend=iwd" > /etc/NetworkManager/conf.d/wifi_backend.conf
@@ -657,145 +644,129 @@ YAY_CURRENT_VER=$(yay --version | cut -d" " -f2 | cut -dv -f2 | cut -d. -f1,2 |
yay_ver_comparison=$(expr "${YAY_CURRENT_VER}" '<=' "11.1")
if [ "${yay_ver_comparison}" -eq 1 ]; then
# Check to see if 'yay' or 'yay-git' is installed already.
- ${CMD_PACMAN} -Q | grep -q -P "^yay"
- if [ $? -ne 0 ]; then
+ if ! ${CMD_PACMAN} -Q | grep -q -P "^yay"; then
echo "Replacing a manual installation of 'yay' with a package installation..."
mv /usr/bin/yay /usr/local/bin/yay
hash -r
- ${CMD_YAY_INSTALL[*]} yay
- if [ $? -eq 0 ]; then
+ if "${CMD_YAY_INSTALL[@]}" yay; then
rm -f /usr/local/bin/yay
- fi
+ fi
echo "Replacing a manual installation of 'yay' with a package installation complete."
fi
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
-${CMD_PACMAN} -Q | grep appimagepool-appimage
-if [ $? -ne 0 ]; then
+if ! ${CMD_PACMAN} -Q | grep appimagepool-appimage; then
echo "Adding the AppImagePool package manager..."
- ${CMD_YAY_INSTALL[*]} appimagelauncher appimagepool-appimage
- cp /usr/share/applications/appimagepool.desktop /home/${WINESAPOS_USER_NAME}/Desktop/
- chmod +x /home/${WINESAPOS_USER_NAME}/Desktop/appimagepool.desktop
- chown 1000:1000 /home/${WINESAPOS_USER_NAME}/Desktop/appimagepool.desktop
+ "${CMD_YAY_INSTALL[@]}" appimagelauncher appimagepool-appimage
+ cp /usr/share/applications/appimagepool.desktop /home/"${WINESAPOS_USER_NAME}"/Desktop/
+ chmod +x /home/"${WINESAPOS_USER_NAME}"/Desktop/appimagepool.desktop
+ chown 1000:1000 /home/"${WINESAPOS_USER_NAME}"/Desktop/appimagepool.desktop
echo "Adding the AppImagePool package manager complete."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
-${CMD_PACMAN} -Q | grep cifs-utils
-if [ $? -ne 0 ]; then
+if ! ${CMD_PACMAN} -Q | grep cifs-utils; then
echo "Adding support for the CIFS/SMB file system..."
- ${CMD_PACMAN_INSTALL[*]} cifs-utils
+ "${CMD_PACMAN_INSTALL[@]}" cifs-utils
echo "Adding support for the CIFS/SMB file system done."
fi
-${CMD_PACMAN} -Q | grep nfs-utils
-if [ $? -ne 0 ]; then
+if ! ${CMD_PACMAN} -Q | grep nfs-utils; then
echo "Adding support for the NFS file system..."
- ${CMD_PACMAN_INSTALL[*]} nfs-utils
+ "${CMD_PACMAN_INSTALL[@]}" nfs-utils
echo "Adding support for the NFS file system done."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
-${CMD_PACMAN} -Q | grep erofs-utils
-if [ $? -ne 0 ]; then
+if ! ${CMD_PACMAN} -Q | grep erofs-utils; then
echo "Adding support for the EROFS file system..."
- ${CMD_PACMAN_INSTALL[*]} erofs-utils
+ "${CMD_PACMAN_INSTALL[@]}" erofs-utils
echo "Adding support for the EROFS file system done."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 8
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 8
-${CMD_PACMAN} -Q | grep f2fs-tools
-if [ $? -ne 0 ]; then
+if ! ${CMD_PACMAN} -Q | grep f2fs-tools; then
echo "Adding support for the F2FS file system..."
- ${CMD_PACMAN_INSTALL[*]} f2fs-tools
+ "${CMD_PACMAN_INSTALL[@]}" f2fs-tools
echo "Adding support for the F2FS file system done."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 9
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 9
-${CMD_PACMAN} -Q | grep ssdfs-tools
-if [ $? -ne 0 ]; then
+if ! ${CMD_PACMAN} -Q | grep ssdfs-tools; then
echo "Adding support for the SSDFS file system..."
- ${CMD_YAY_INSTALL[*]} ssdfs-tools
+ "${CMD_YAY_INSTALL[@]}" ssdfs-tools
echo "Adding support for the SSDFS file system done."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 10
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 10
-${CMD_PACMAN} -Q | grep mtools
-if [ $? -ne 0 ]; then
+if ! ${CMD_PACMAN} -Q | grep mtools; then
echo "Adding improved support for FAT file systems..."
- ${CMD_PACMAN_INSTALL[*]} mtools
+ "${CMD_PACMAN_INSTALL[@]}" mtools
echo "Adding improved support for FAT file systems done."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 11
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 11
-${CMD_PACMAN} -Q | grep reiserfsprogs
-if [ $? -ne 0 ]; then
+if ! ${CMD_PACMAN} -Q | grep reiserfsprogs; then
echo "Adding support for the ReiserFS file system..."
# 'cmake' is required to build 'reiserfs-defrag' but is not installed with 'base-devel'.
- ${CMD_PACMAN_INSTALL[*]} reiserfsprogs cmake
- ${CMD_YAY_INSTALL[*]} reiserfs-defrag
+ "${CMD_PACMAN_INSTALL[@]}" reiserfsprogs cmake
+ "${CMD_YAY_INSTALL[@]}" reiserfs-defrag
echo "Adding support for the ReiserFS file system done."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 12
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 12
-${CMD_PACMAN} -Q mangohud-common
-if [ $? -eq 0 ]; then
+if ! ${CMD_PACMAN} -Q mangohud-common; then
echo "Updating MangoHud to the new package names..."
${CMD_PACMAN} -R -n --nodeps --nodeps --noconfirm mangohud-common mangohud lib32-mangohud
- ${CMD_PACMAN_INSTALL[*]} mangohud lib32-mangohud
+ "${CMD_PACMAN_INSTALL[@]}" mangohud lib32-mangohud
echo "Updating MangoHud to the new package names complete."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
echo "Running 3.2.1 to 3.3.0 upgrades complete."
echo "Running 3.3.0 to 3.4.0 upgrades..."
-kdialog_dbus=$(sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --progressbar "Running 3.3.0 to 3.4.0 upgrades..." 11 | cut -d" " -f1)
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog showCancelButton false
+kdialog_dbus=$(sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --progressbar "Running 3.3.0 to 3.4.0 upgrades..." 11 | cut -d" " -f1)
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog showCancelButton false
# Check to see if Electron from the AUR is installed.
# It is a dependency of balena-etcher but takes along
# time and a lot of disk space to compile.
-${CMD_PACMAN} -Q | grep -P "^electron[0-9]+"
-if [ $? -eq 0 ]; then
- ${CMD_PACMAN_REMOVE[*]} balena-etcher
- export ETCHER_VER="1.19.21"
- wget "https://github.com/balena-io/etcher/releases/download/v${ETCHER_VER}/balenaEtcher-${ETCHER_VER}-x64.AppImage" -O /home/${WINESAPOS_USER_NAME}/Desktop/balenaEtcher.AppImage
- chmod +x /home/${WINESAPOS_USER_NAME}/Desktop/balenaEtcher.AppImage
- rm -f /home/${WINESAPOS_USER_NAME}/Desktop/balena-etcher-electron.desktop
+if ${CMD_PACMAN} -Q | grep -P "^electron[0-9]+"; then
+ "${CMD_PACMAN_REMOVE[@]}" balena-etcher
+ ETCHER_VER="1.19.21"
+ export ETCHER_VER
+ wget "https://github.com/balena-io/etcher/releases/download/v${ETCHER_VER}/balenaEtcher-${ETCHER_VER}-x64.AppImage" -O /home/"${WINESAPOS_USER_NAME}"/Desktop/balenaEtcher.AppImage
+ chmod +x /home/"${WINESAPOS_USER_NAME}"/Desktop/balenaEtcher.AppImage
+ rm -f /home/"${WINESAPOS_USER_NAME}"/Desktop/balena-etcher-electron.desktop
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
-${CMD_PACMAN} -Q fprintd
-if [ $? -ne 0 ]; then
- ${CMD_PACMAN_INSTALL[*]} fprintd
+if ! ${CMD_PACMAN} -Q fprintd; then
+ "${CMD_PACMAN_INSTALL[@]}" fprintd
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
-ls /home/deck
-if [ $? -ne 0 ]; then
+if ! ls /home/deck; then
ln -s /home/winesap /home/deck
fi
-${CMD_PACMAN} -Q plasma-wayland-session
-if [ $? -ne 0 ]; then
+if ! ${CMD_PACMAN} -Q plasma-wayland-session; then
echo "Adding Wayland support..."
- ${CMD_PACMAN_INSTALL[*]} plasma-wayland-session
+ "${CMD_PACMAN_INSTALL[@]}" plasma-wayland-session
echo "Adding Wayland support complete."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
-${CMD_PACMAN} -Q python-crudini
-if [ $? -eq 0 ]; then
+if ${CMD_PACMAN} -Q python-crudini; then
echo "Replacing 'python-crudini' with the newer 'crudini'..."
- ${CMD_PACMAN_REMOVE[*]} python-crudini
- # Use the '${CMD_YAY_INSTALL[*]}' without the '--needed' argument to force re-install 'python-iniparse'.
- sudo -u ${WINESAPOS_USER_NAME} yay --pacman ${CMD_PACMAN} --noconfirm -S --removemake crudini python-iniparse
+ "${CMD_PACMAN_REMOVE[@]}" python-crudini
+ # Use the '"${CMD_YAY_INSTALL[@]}"' without the '--needed' argument to force re-install 'python-iniparse'.
+ sudo -u "${WINESAPOS_USER_NAME}" yay --pacman ${CMD_PACMAN} --noconfirm -S --removemake crudini python-iniparse
echo "Replacing 'python-crudini' with the newer 'crudini' complete."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
-ls /etc/systemd/system/winesapos-touch-bar-usbmuxd-fix.service
-if [ $? -eq 0 ]; then
+if ls /etc/systemd/system/winesapos-touch-bar-usbmuxd-fix.service; then
echo "Upgrading usbmuxd to work with iPhone devices again even with T2 Mac drivers..."
systemctl disable --now winesapos-touch-bar-usbmuxd-fix
rm -f /etc/systemd/system/winesapos-touch-bar-usbmuxd-fix.service
@@ -806,82 +777,73 @@ if [ $? -eq 0 ]; then
echo "Upgrading usbmuxd to work with iPhone devices again even with T2 Mac drivers complete."
fi
-systemctl --quiet is-enabled iwd
-if [ $? -eq 0 ]; then
+if systemctl --quiet is-enabled iwd; then
echo "Disabling iwd for better NetworkManager compatibility..."
# Do not disable '--now' because that would interrupt network connections.
systemctl disable iwd
echo "Disabling iwd for better NetworkManager compatibility done."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
if [[ "${WINESAPOS_IMAGE_TYPE}" != "minimal" ]]; then
- ${CMD_PACMAN} -Q gamescope-session-git
- if [ $? -ne 0 ]; then
+ if ! ${CMD_PACMAN} -Q gamescope-session-git; then
echo "Adding Gamescope Session support..."
- ${CMD_YAY_INSTALL[*]} gamescope-session-git gamescope-session-steam-git
+ "${CMD_YAY_INSTALL[@]}" gamescope-session-git gamescope-session-steam-git
echo "Adding Gamescope Session support complete."
fi
- ${CMD_PACMAN} -Q opengamepadui-bin
- if [ $? -ne 0 ]; then
+ if ! ${CMD_PACMAN} -Q opengamepadui-bin; then
echo "Adding Open Gamepad UI..."
- ${CMD_YAY_INSTALL[*]} opengamepadui-bin opengamepadui-session-git
+ "${CMD_YAY_INSTALL[@]}" opengamepadui-bin opengamepadui-session-git
echo "Adding Open Gamepad UI complete."
fi
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
-${CMD_PACMAN} -Q jfsutils
-if [ $? -ne 0 ]; then
- ${CMD_PACMAN_INSTALL[*]} jfsutils
+if ! ${CMD_PACMAN} -Q jfsutils; then
+ "${CMD_PACMAN_INSTALL[@]}" jfsutils
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
if [[ "${WINESAPOS_IMAGE_TYPE}" != "minimal" ]]; then
- ${CMD_PACMAN} -Q openrazer-daemon
- if [ $? -ne 0 ]; then
- ${CMD_PACMAN_INSTALL[*]} openrazer-daemon openrazer-driver-dkms python-pyqt5 python-openrazer razercfg
- sudo gpasswd -a ${WINESAPOS_USER_NAME} plugdev
+ if ! ${CMD_PACMAN} -Q openrazer-daemon; then
+ "${CMD_PACMAN_INSTALL[@]}" openrazer-daemon openrazer-driver-dkms python-pyqt5 python-openrazer razercfg
+ sudo gpasswd -a "${WINESAPOS_USER_NAME}" plugdev
systemctl enable --now razerd
- cp /usr/share/applications/razercfg.desktop /home/${WINESAPOS_USER_NAME}/Desktop/
- chmod +x /home/${WINESAPOS_USER_NAME}/Desktop/razercfg.desktop
+ cp /usr/share/applications/razercfg.desktop /home/"${WINESAPOS_USER_NAME}"/Desktop/
+ chmod +x /home/"${WINESAPOS_USER_NAME}"/Desktop/razercfg.desktop
fi
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 8
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 8
-${CMD_PACMAN} -Q vapor-steamos-theme-kde
-if [ $? -eq 0 ]; then
- ${CMD_PACMAN_REMOVE[*]} vapor-steamos-theme-kde
- ${CMD_YAY_INSTALL[*]} plasma5-themes-vapor-steamos
+if ${CMD_PACMAN} -Q vapor-steamos-theme-kde; then
+ "${CMD_PACMAN_REMOVE[@]}" vapor-steamos-theme-kde
+ "${CMD_YAY_INSTALL[@]}" plasma5-themes-vapor-steamos
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 9
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 9
if [[ "${WINESAPOS_IMAGE_TYPE}" != "minimal" ]]; then
- ${CMD_PACMAN} -Q oversteer
- if [ $? -ne 0 ]; then
- ${CMD_YAY_INSTALL[*]} oversteer
- cp /usr/share/applications/org.berarma.Oversteer.desktop /home/${WINESAPOS_USER_NAME}/Desktop/
- chmod +x /home/${WINESAPOS_USER_NAME}/Desktop/org.berarma.Oversteer.desktop
+ if ! ${CMD_PACMAN} -Q oversteer; then
+ "${CMD_YAY_INSTALL[@]}" oversteer
+ cp /usr/share/applications/org.berarma.Oversteer.desktop /home/"${WINESAPOS_USER_NAME}"/Desktop/
+ chmod +x /home/"${WINESAPOS_USER_NAME}"/Desktop/org.berarma.Oversteer.desktop
fi
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 10
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 10
# Use the new Java Development Kit packages.
# https://archlinux.org/news/incoming-changes-in-jdk-jre-21-packages-may-require-manual-intervention/
for java_edition in jdk jre
do for java_ver in "" 17 11 8
do for java_headless in "" -headless
- do pacman -Q ${java_edition}${java_ver}-openjdk${java_headless}
- if [ $? -eq 0 ]; then
+ do if pacman -Q ${java_edition}${java_ver}-openjdk${java_headless}; then
yes | ${CMD_PACMAN} -S ${java_edition}${java_ver}-openjdk${java_headless}
fi
done
done
done
-${CMD_PACMAN} -Q lightdm
-if [ $? -eq 0 ]; then
+if ${CMD_PACMAN} -Q lightdm; then
if [ ! -f /etc/systemd/system/lightdm.service.d/lightdm-restart-policy.conf ]; then
mkdir -p /etc/systemd/system/lightdm.service.d/
wget "https://raw.githubusercontent.com/winesapOS/winesapOS/stable/files/lightdm-restart-policy.conf" -O /etc/systemd/system/lightdm.service.d/lightdm-restart-policy.conf
@@ -891,73 +853,63 @@ if [ $? -eq 0 ]; then
systemctl enable lightdm-success-handler
fi
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
echo "Running 3.3.0 to 3.4.0 upgrades complete."
echo "Running 3.4.0 to 4.0.0 upgrades..."
-kdialog_dbus=$(sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --progressbar "Running 3.4.0 to 4.0.0 upgrades..." 8 | cut -d" " -f1)
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog showCancelButton false
-sed -i s'/options amdgpu sg_display=0//'g /etc/modprobe.d/winesapos-amd.conf
+kdialog_dbus=$(sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --progressbar "Running 3.4.0 to 4.0.0 upgrades..." 8 | cut -d" " -f1)
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog showCancelButton false
+sed -i 's/options amdgpu sg_display=0//g' /etc/modprobe.d/winesapos-amd.conf
-dmidecode -s system-product-name | grep -P ^Mac
-if [ $? -ne 0 ]; then
+if ! dmidecode -s system-product-name | grep -P ^Mac; then
echo "No Mac hardware detected."
echo "Re-enabling EFI variables..."
- sed -i s'/efi=noruntime //'g /etc/default/grub
+ sed -i 's/efi=noruntime //g' /etc/default/grub
fi
-${CMD_PACMAN} -Q firefox-esr-bin
-if [ $? -eq 0 ]; then
- ${CMD_PACMAN_REMOVE[*]} firefox-esr-bin
- ${CMD_PACMAN_INSTALL[*]} firefox-esr
+if ${CMD_PACMAN} -Q firefox-esr-bin; then
+ "${CMD_PACMAN_REMOVE[@]}" firefox-esr-bin
+ "${CMD_PACMAN_INSTALL[@]}" firefox-esr
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
-${CMD_PACMAN} -Q mangohud
-if [ $? -eq 0 ]; then
- ${CMD_PACMAN_REMOVE[*]} mangohud lib32-mangohud goverlay
- ${CMD_PACMAN_INSTALL[*]} mangohud-git lib32-mangohud-git goverlay-git
+if ${CMD_PACMAN} -Q mangohud; then
+ "${CMD_PACMAN_REMOVE[@]}" mangohud lib32-mangohud goverlay
+ "${CMD_PACMAN_INSTALL[@]}" mangohud-git lib32-mangohud-git goverlay-git
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
-${CMD_PACMAN} -Q bcachefs-tools
-if [ $? -ne 0 ]; then
- ${CMD_PACMAN} -Q bcachefs-tools-git
- if [ $? -eq 0 ]; then
- ${CMD_PACMAN_REMOVE[*]} linux-bcachefs-git linux-bcachefs-git-headers bcachefs-tools-git
+if ! ${CMD_PACMAN} -Q bcachefs-tools; then
+ if ${CMD_PACMAN} -Q bcachefs-tools-git; then
+ "${CMD_PACMAN_REMOVE[@]}" linux-bcachefs-git linux-bcachefs-git-headers bcachefs-tools-git
fi
- ${CMD_PACMAN_INSTALL[*]} bcachefs-tools
+ "${CMD_PACMAN_INSTALL[@]}" bcachefs-tools
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
if [[ "${WINESAPOS_IMAGE_TYPE}" != "minimal" ]]; then
- ${CMD_PACMAN} -Q distrobox
- if [ $? -ne 0 ]; then
- ${CMD_PACMAN_INSTALL[*]} distrobox podman
+ if ! ${CMD_PACMAN} -Q distrobox; then
+ "${CMD_PACMAN_INSTALL[@]}" distrobox podman
fi
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
-${CMD_PACMAN} -Q gfs2-utils
-if [ $? -ne 0 ]; then
- ${CMD_YAY_INSTALL[*]} gfs2-utils
+if ! ${CMD_PACMAN} -Q gfs2-utils; then
+ "${CMD_YAY_INSTALL[@]}" gfs2-utils
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
-${CMD_PACMAN} -Q glusterfs
-if [ $? -ne 0 ]; then
- ${CMD_PACMAN_INSTALL[*]} glusterfs
+if ! ${CMD_PACMAN} -Q glusterfs; then
+ "${CMD_PACMAN_INSTALL[@]}" glusterfs
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
-${CMD_PACMAN} -Q ceph-bin
-if [ $? -ne 0 ]; then
- ${CMD_YAY_INSTALL[*]} ceph-libs-bin ceph-bin
+if ! ${CMD_PACMAN} -Q ceph-bin; then
+ "${CMD_YAY_INSTALL[@]}" ceph-libs-bin ceph-bin
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
-grep -q -P "^precedence ::ffff:0:0/96 100$" /etc/gai.conf
-if [ $? -ne 0 ]; then
+if ! grep -q -P "^precedence ::ffff:0:0/96 100$" /etc/gai.conf; then
echo "label ::1/128 0
label ::/0 1
label 2002::/16 2
@@ -970,59 +922,51 @@ precedence ::/96 20
precedence ::ffff:0:0/96 100" > /etc/gai.conf
fi
-grep -P -q "^fs.file-max=524288" /etc/sysctl.d/00-winesapos.conf 2> /dev/null
-if [ $? -ne 0 ]; then
+if ! grep -P -q "^fs.file-max=524288" /etc/sysctl.d/00-winesapos.conf 2> /dev/null; then
echo "vm.max_map_count=16777216
fs.file-max=524288" >> /etc/sysctl.d/00-winesapos.conf
fi
-grep -P -q "^DefaultLimitNOFILE=524288" /etc/systemd/system.conf.d/20-file-limits.conf 2> /dev/null
-if [ $? -ne 0 ]; then
+if ! grep -P -q "^DefaultLimitNOFILE=524288" /etc/systemd/system.conf.d/20-file-limits.conf 2> /dev/null; then
mkdir -p /etc/systemd/system.conf.d/
echo "[Manager]
DefaultLimitNOFILE=524288" > /etc/systemd/system.conf.d/20-file-limits.conf
fi
if (${CMD_PACMAN} -Q mesa && ${CMD_PACMAN} -Q opencl-mesa-steamos); then
- ${CMD_PACMAN_REMOVE[*]} opencl-mesa-steamos lib32-opencl-mesa-steamos
- ${CMD_PACMAN_INSTALL[*]} opencl-rusticl-mesa lib32-opencl-rusticl-mesa
+ "${CMD_PACMAN_REMOVE[@]}" opencl-mesa-steamos lib32-opencl-mesa-steamos
+ "${CMD_PACMAN_INSTALL[@]}" opencl-rusticl-mesa lib32-opencl-rusticl-mesa
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
echo "Running 3.4.0 to 4.0.0 upgrades complete."
echo "Running 4.0.0 to 4.1.0 upgrades..."
-${CMD_PACMAN} -Q packagekit-qt6
-if [ $? -ne 0 ]; then
+if ! ${CMD_PACMAN} -Q packagekit-qt6; then
# These packages have been removed in KDE Plasma 6.
# https://github.com/winesapOS/winesapOS/issues/742
# We no longer want to install PackageKit, either.
# https://github.com/winesapOS/winesapOS/issues/827
- ${CMD_PACMAN_REMOVE[*]} packagekit-qt5 plasma-wayland-session
+ "${CMD_PACMAN_REMOVE[@]}" packagekit-qt5 plasma-wayland-session
# Enable Wayland support for the official NVIDIA drivers.
- ${CMD_PACMAN} -Q | grep -q -P "^nvidia"
- if [ $? -eq 0 ]; then
- grep "nvidia_drm.modeset=1" /etc/default/grub
- if [ $? -ne 0 ]; then
- sed -i s'/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="nvidia_drm.modeset=1 /'g /etc/default/grub
+ if ${CMD_PACMAN} -Q | grep -q -P "^nvidia"; then
+ if ! grep "nvidia_drm.modeset=1" /etc/default/grub; then
+ sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="nvidia_drm.modeset=1 /g' /etc/default/grub
fi
fi
fi
-grep "mem_sleep_default=deep" /etc/default/grub
-if [ $? -ne 0 ]; then
+if ! grep "mem_sleep_default=deep" /etc/default/grub; then
echo "Change the default sleep level to be S3 deep sleep..."
- sed -i s'/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="mem_sleep_default=deep /'g /etc/default/grub
+ sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="mem_sleep_default=deep /g' /etc/default/grub
fi
-${CMD_PACMAN} -Q modem-manager-gui
-if [ $? -ne 0 ]; then
- ${CMD_PACMAN_INSTALL[*]} modem-manager-gui usb_modeswitch
+if ! ${CMD_PACMAN} -Q modem-manager-gui; then
+ "${CMD_PACMAN_INSTALL[@]}" modem-manager-gui usb_modeswitch
fi
-grep -q kyber /etc/udev/rules.d/60-winesapos-io-schedulers.rules
-if [ $? -ne 0 ]; then
+if ! grep -q kyber /etc/udev/rules.d/60-winesapos-io-schedulers.rules; then
echo -n "Enabling that optimal IO schedulers..."
echo '# Serial drives and SD cards.
ACTION=="add|change", KERNEL=="sd[a-z]*|mmcblk[0-9]*", ATTR{queue/scheduler}="bfq"
@@ -1032,53 +976,46 @@ ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/scheduler}="kyber"' > /et
fi
# Delete our old session override to ensure that the Plasma Wayland session is used for KDE Plasma >= 6.
-grep -q "XSession=plasma" /var/lib/AccountsService/users/${WINESAPOS_USER_NAME}
-if [ $? -eq 0 ]; then
- rm -f /var/lib/AccountsService/users/${WINESAPOS_USER_NAME}
+if grep -q "XSession=plasma" /var/lib/AccountsService/users/"${WINESAPOS_USER_NAME}"; then
+ rm -f /var/lib/AccountsService/users/"${WINESAPOS_USER_NAME}"
fi
-${CMD_PACMAN} -Q linux-fsync-nobara-bin
-if [ $? -ne 0 ]; then
- ${CMD_YAY_INSTALL[*]} linux-fsync-nobara-bin
+if ! ${CMD_PACMAN} -Q linux-fsync-nobara-bin; then
+ "${CMD_YAY_INSTALL[@]}" linux-fsync-nobara-bin
fi
-${CMD_PACMAN} -Q steamdeck-dsp
-if [ $? -eq 0 ]; then
- ${CMD_PACMAN} -Q linux-firmware-valve
- if [ $? -ne 0 ]; then
- ${CMD_PACMAN_INSTALL[*]} linux-firmware-valve
+if ${CMD_PACMAN} -Q steamdeck-dsp; then
+ if ! ${CMD_PACMAN} -Q linux-firmware-valve; then
+ "${CMD_PACMAN_INSTALL[@]}" linux-firmware-valve
fi
fi
echo "Running 4.0.0 to 4.1.0 upgrades complete."
echo "Upgrading system packages..."
-kdialog_dbus=$(sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --progressbar "Please wait for all system packages to upgrade (this can take a long time)..." 11 | cut -d" " -f1)
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog showCancelButton false
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
+kdialog_dbus=$(sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --progressbar "Please wait for all system packages to upgrade (this can take a long time)..." 11 | cut -d" " -f1)
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog showCancelButton false
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 1
# Remove the problematic 'fatx' package first.
# https://github.com/winesapOS/winesapOS/issues/651
-${CMD_PACMAN} -Q fatx
-if [ $? -eq 0 ]; then
- ${CMD_PACMAN_REMOVE[*]} fatx
+if ${CMD_PACMAN} -Q fatx; then
+ "${CMD_PACMAN_REMOVE[@]}" fatx
fi
# Remove the problematic 'gwenview' package.
gwenview_found=0
-${CMD_PACMAN} -Q gwenview
-if [ $? -eq 0 ]; then
+if ${CMD_PACMAN} -Q gwenview; then
gwenview_found=1
- ${CMD_PACMAN_REMOVE[*]} gwenview
+ "${CMD_PACMAN_REMOVE[@]}" gwenview
fi
# Remove the problematic 'replay-sorcery' package.
# https://github.com/winesapOS/winesapOS/issues/903
replay_sorcery_found=0
-${CMD_PACMAN} -Q replay-sorcery
-if [ $? -eq 0 ]; then
+if ${CMD_PACMAN} -Q replay-sorcery; then
replay_sorcery_found=1
- ${CMD_PACMAN_REMOVE[*]} replay-sorcery
+ "${CMD_PACMAN_REMOVE[@]}" replay-sorcery
fi
# The 'base-devel' package needs to be explicitly updated since it was changed to a meta package.
@@ -1088,8 +1025,7 @@ sudo -E ${CMD_PACMAN} -S -y --noconfirm base-devel
# On old builds of Mac Linux Gaming Stick, this file is provided by 'filesystem' but is replaced by 'systemd' in newer versions.
# Detect if it is the old version and, if so, delete the conflicting file.
# https://github.com/winesapOS/winesapOS/issues/229#issuecomment-1595868315
-grep -q "LC_COLLATE=C" /usr/share/factory/etc/locale.conf
-if [ $? -eq 0 ]; then
+if grep -q "LC_COLLATE=C" /usr/share/factory/etc/locale.conf; then
rm -f /usr/share/factory/etc/locale.conf
fi
@@ -1100,48 +1036,46 @@ ${CMD_PACMAN} -S -u --noconfirm
# Check to see if the previous update failed by seeing if there are still packages to be downloaded for an upgrade.
# If there are, try to upgrade all of the system packages one more time.
-sudo -E ${CMD_PACMAN} -S -u -p | grep -P ^http | grep -q tar.zst
-if [ $? -eq 0 ]; then
+if sudo -E ${CMD_PACMAN} -S -u -p | grep -P ^http | grep -q tar.zst; then
${CMD_PACMAN} -S -u --noconfirm
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 2
-sudo -E -u ${WINESAPOS_USER_NAME} flatpak update -y --noninteractive
-sudo -E -u ${WINESAPOS_USER_NAME} flatpak uninstall --unused -y --noninteractive
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
+sudo -E -u "${WINESAPOS_USER_NAME}" flatpak update -y --noninteractive
+sudo -E -u "${WINESAPOS_USER_NAME}" flatpak uninstall --unused -y --noninteractive
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 3
flatpak update -y --noninteractive
flatpak uninstall --unused -y --noninteractive
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 4
# Remove the Flatpak directory for the user to avoid errors.
# This directory will automatically get re-generated when a 'flatpak' command is ran.
# https://github.com/winesapOS/winesapOS/issues/516
-rm -r -f /home/${WINESAPOS_USER_NAME}/.local/share/flatpak
+rm -r -f /home/"${WINESAPOS_USER_NAME}"/.local/share/flatpak
# Remove the old 'ceph-libs' package from the AUR that is no longer used.
# The newer version also fails to compile causing all AUR upgrades to fail.
-${CMD_PACMAN} -Q ceph-libs
-if [ $? -eq 0 ]; then
- ${CMD_PACMAN_REMOVE[*]} ceph-libs
+if ${CMD_PACMAN} -Q ceph-libs; then
+ "${CMD_PACMAN_REMOVE[@]}" ceph-libs
fi
-sudo -u ${WINESAPOS_USER_NAME} yay --pacman ${CMD_PACMAN} -S -y -y -u --noconfirm
+sudo -u "${WINESAPOS_USER_NAME}" yay --pacman ${CMD_PACMAN} -S -y -y -u --noconfirm
# Re-install FATX by re-compiling it from the AUR.
-${CMD_YAY_INSTALL[*]} aur/fatx
+"${CMD_YAY_INSTALL[@]}" aur/fatx
# Re-install gwenview.
if [[ "${gwenview_found}" == "1" ]]; then
- ${CMD_PACMAN_INSTALL[*]} gwenview
+ "${CMD_PACMAN_INSTALL[@]}" gwenview
fi
# Re-install replay-sorcery.
if [[ "${replay_sorcery_found}" == "1" ]]; then
- ${CMD_PACMAN_INSTALL[*]} replay-sorcery
+ "${CMD_PACMAN_INSTALL[@]}" replay-sorcery
fi
# Re-add this setting for the Plasma 5 Vapor theme after the system upgrade is complete.
crudini --set /etc/xdg/konsolerc "Desktop Entry" DefaultProfile Vapor.profile
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 5
echo "Upgrading system packages complete."
echo "Upgrading ignored packages..."
@@ -1152,18 +1086,17 @@ elif [[ "${WINESAPOS_DISTRO_DETECTED}" == "manjaro" ]]; then
# Due to conflicts between Mac Linux Gaming Stick 2 versus winesapOS 3, do not replace the 'filesystem' package.
# https://github.com/winesapOS/winesapOS/issues/229#issuecomment-1595886615
if [[ "${WINESAPOS_USER_NAME}" == "stick" ]]; then
- yes | ${CMD_PACMAN} -S core/filesystem
+ yes | ${CMD_PACMAN} -S core/filesystem
else
- yes | ${CMD_PACMAN} -S holo-rel/filesystem
+ yes | ${CMD_PACMAN} -S holo-rel/filesystem
fi
elif [[ "${WINESAPOS_DISTRO_DETECTED}" == "steamos" ]]; then
yes | ${CMD_PACMAN} -S core/linux-lts core/linux-lts-headers linux-steamos linux-steamos-headers core/grub holo-rel/filesystem
fi
echo "Upgrading ignored packages done."
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 6
-${CMD_PACMAN} -Q | grep -q nvidia-dkms
-if [ $? -eq 0 ]; then
+if ${CMD_PACMAN} -Q | grep -q nvidia-dkms; then
echo "Upgrading NVIDIA drivers..."
${CMD_PACMAN} -S --noconfirm \
extra/nvidia-dkms \
@@ -1173,21 +1106,19 @@ if [ $? -eq 0 ]; then
multilib/lib32-opencl-nvidia
echo "Upgrading NVIDIA drivers complete."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 7
echo "Removing unused Pacman packages..."
${CMD_PACMAN} -Qdtq | ${CMD_PACMAN} -R -n -s --noconfirm -
echo "Removing unused Pacman packages done."
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 8
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 8
-dmidecode -s system-product-name | grep -P ^Mac
-if [ $? -eq 0 ]; then
+if dmidecode -s system-product-name | grep -P ^Mac; then
echo "Mac hardware detected."
- ${CMD_PACMAN} -Q mbpfan-git
- if [ $? -ne 0 ]; then
+ if ! ${CMD_PACMAN} -Q mbpfan-git; then
echo "Installing MacBook fan support..."
- ${CMD_YAY_INSTALL[*]} mbpfan-git
+ "${CMD_YAY_INSTALL[@]}" mbpfan-git
crudini --set /etc/mbpfan.conf general min_fan_speed 1300
crudini --set /etc/mbpfan.conf general max_fan_speed 6200
crudini --set /etc/mbpfan.conf general max_temp 105
@@ -1197,20 +1128,19 @@ if [ $? -eq 0 ]; then
else
echo "No Mac hardware detected."
fi
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 9
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 9
# winesapOS 3.0.Y will have broken UEFI boot after an upgrade so we need to re-install it.
# Legacy BIOS boot is unaffected.
# https://github.com/winesapOS/winesapOS/issues/695
-grep "3.0*" /etc/winesapos/VERSION
-if [ $? -eq 0 ]; then
+if grep "3.0*" /etc/winesapos/VERSION; then
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=winesapOS --removable --no-nvram
fi
echo "Rebuilding initramfs with new drivers..."
mkinitcpio -P
echo "Rebuilding initramfs with new drivers complete."
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog Set org.kde.kdialog.ProgressDialog value 10
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog Set org.kde.kdialog.ProgressDialog value 10
echo "Updating Btrfs snapshots in the GRUB menu..."
grub-mkconfig -o /boot/grub/grub.cfg
@@ -1221,8 +1151,8 @@ systemctl unmask packagekit
if [[ "${WINESAPOS_IMAGE_TYPE}" == "secure" ]]; then
echo "Disallow passwordless 'sudo' now that the upgrade is done..."
- rm -f /etc/sudoers.d/${WINESAPOS_USER_NAME}
- mv /root/etc-sudoersd-${WINESAPOS_USER_NAME} /etc/sudoers.d/${WINESAPOS_USER_NAME}
+ rm -f /etc/sudoers.d/"${WINESAPOS_USER_NAME}"
+ mv /root/etc-sudoersd-"${WINESAPOS_USER_NAME}" /etc/sudoers.d/"${WINESAPOS_USER_NAME}"
echo "Disallow passwordless 'sudo' now that the upgrade is done complete."
fi
@@ -1232,22 +1162,24 @@ pacman -Q
echo "VERSION_ORIGINAL=${WINESAPOS_VERSION_ORIGINAL},VERSION_NEW=${WINESAPOS_VERSION_NEW},DATE=${START_TIME}" >> /etc/winesapos/UPGRADED
rm -f /etc/winesapos/VERSION /etc/winesapos/IMAGE_TYPE /usr/lib/os-release-winesapos
curl https://raw.githubusercontent.com/winesapOS/winesapOS/stable/files/os-release-winesapos --location --output /usr/lib/os-release-winesapos
+# shellcheck disable=SC2027 disable=2086
echo -e "VARIANT=\""${WINESAPOS_IMAGE_TYPE}""\"\\nVARIANT_ID=${WINESAPOS_IMAGE_TYPE} | tee -a /usr/lib/os-release-winesapos
ln -s /usr/lib/os-release-winesapos /etc/os-release-winesapos
-sudo -E -u ${WINESAPOS_USER_NAME} ${qdbus_cmd} ${kdialog_dbus} /ProgressDialog org.kde.kdialog.ProgressDialog.close
+sudo -E -u "${WINESAPOS_USER_NAME}" "${qdbus_cmd}" "${kdialog_dbus}" /ProgressDialog org.kde.kdialog.ProgressDialog.close
+# shellcheck disable=SC2181
test_internet_connection
if [ $? -ne 1 ]; then
- sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --msgbox "Upgrade complete but no network connection detected. There may have been an issue during the upgrade."
+ sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --msgbox "Upgrade complete but no network connection detected. There may have been an issue during the upgrade."
else
- sudo -E -u ${WINESAPOS_USER_NAME} kdialog --title "winesapOS Upgrade" --msgbox "Upgrade complete! Please reboot to load new changes."
+ sudo -E -u "${WINESAPOS_USER_NAME}" kdialog --title "winesapOS Upgrade" --msgbox "Upgrade complete! Please reboot to load new changes."
fi
echo "End time: $(date --iso-8601=seconds)"
if [[ "${WINESAPOS_USER_NAME}" == "stick" ]]; then
- mv /tmp/upgrade_${START_TIME}.log /etc/mac-linux-gaming-stick/
+ mv "/tmp/upgrade_${START_TIME}.log" /etc/mac-linux-gaming-stick/
else
- mv /tmp/upgrade_${START_TIME}.log /etc/winesapos/
+ mv "/tmp/upgrade_${START_TIME}.log" /etc/winesapos/
fi
diff --git a/test-build.sh b/test-build.sh
index e4ffc30..2701070 100644
--- a/test-build.sh
+++ b/test-build.sh
@@ -5,4 +5,4 @@
mkdir -p output
docker build --pull --no-cache -t winesapos-img-builder build/.
-docker run --rm -v $(pwd):/workdir --privileged=true -i winesapos-img-builder:latest /bin/bash -x scripts/winesapos-build.sh
+docker run --rm -v "$(pwd)":/workdir --privileged=true -i winesapos-img-builder:latest /bin/bash -x scripts/winesapos-build.sh