Use consistent bash5 style for conditionals and quoting
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# Set identification from install inputs
|
||||
if [[ -n "${OMARCHY_USER_NAME//[[:space:]]/}" ]]; then
|
||||
if [[ -n ${OMARCHY_USER_NAME//[[:space:]]/} ]]; then
|
||||
git config --global user.name "$OMARCHY_USER_NAME"
|
||||
fi
|
||||
|
||||
if [[ -n "${OMARCHY_USER_EMAIL//[[:space:]]/}" ]]; then
|
||||
if [[ -n ${OMARCHY_USER_EMAIL//[[:space:]]/} ]]; then
|
||||
git config --global user.email "$OMARCHY_USER_EMAIL"
|
||||
fi
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Detect MacBook models that need SPI keyboard modules
|
||||
product_name="$(cat /sys/class/dmi/id/product_name 2>/dev/null)"
|
||||
if [[ "$product_name" =~ MacBook[89],1|MacBook1[02],1|MacBookPro13,[123]|MacBookPro14,[123] ]]; then
|
||||
if [[ $product_name =~ MacBook[89],1|MacBook1[02],1|MacBookPro13,[123]|MacBookPro14,[123] ]]; then
|
||||
echo "Detected MacBook with SPI keyboard"
|
||||
|
||||
omarchy-pkg-add macbook12-spi-driver-dkms
|
||||
if [[ "$product_name" == "MacBook8,1" ]]; then
|
||||
if [[ $product_name == "MacBook8,1" ]]; then
|
||||
echo "MODULES=(applespi spi_pxa2xx_platform spi_pxa2xx_pci)" | sudo tee /etc/mkinitcpio.conf.d/macbook_spi_modules.conf >/dev/null
|
||||
else
|
||||
echo "MODULES=(applespi intel_lpss_pci spi_pxa2xx_platform)" | sudo tee /etc/mkinitcpio.conf.d/macbook_spi_modules.conf >/dev/null
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
# This prevents NVMe drives from failing to wake from sleep properly
|
||||
MACBOOK_MODEL=$(cat /sys/class/dmi/id/product_name 2>/dev/null || true)
|
||||
|
||||
if [[ "$MACBOOK_MODEL" =~ MacBook(8,1|9,1|10,1)|MacBookPro13,[123]|MacBookPro14,[123] ]]; then
|
||||
if [[ $MACBOOK_MODEL =~ MacBook(8,1|9,1|10,1)|MacBookPro13,[123]|MacBookPro14,[123] ]]; then
|
||||
echo "Detected MacBook model: $MACBOOK_MODEL"
|
||||
|
||||
NVME_DEVICE="/sys/bus/pci/devices/0000:01:00.0/d3cold_allowed"
|
||||
|
||||
if [[ -f "$NVME_DEVICE" ]]; then
|
||||
if [[ -f $NVME_DEVICE ]]; then
|
||||
echo "Applying NVMe suspend fix..."
|
||||
|
||||
cat <<EOF | sudo tee /etc/systemd/system/omarchy-nvme-suspend-fix.service >/dev/null
|
||||
|
||||
@@ -7,7 +7,7 @@ if omarchy-hw-asus-rog; then
|
||||
|
||||
# Unmute the Master control on the ALC285 card (often muted by default)
|
||||
card=$(aplay -l 2>/dev/null | grep -i "ALC285" | head -1 | sed 's/card \([0-9]*\).*/\1/')
|
||||
if [[ -n "$card" ]]; then
|
||||
if [[ -n $card ]]; then
|
||||
amixer -c "$card" set Master 80% unmute 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
# Module list derived from Chris McLeod's manual install instructions
|
||||
# https://chrismcleod.dev/blog/installing-arch-linux-with-secure-boot-on-a-microsoft-surface-laptop-studio/
|
||||
product_name="$(cat /sys/class/dmi/id/product_name 2>/dev/null)"
|
||||
if [[ "$product_name" =~ Surface ]]; then
|
||||
if [[ $product_name =~ Surface ]]; then
|
||||
echo "Detected Surface Device"
|
||||
|
||||
# Modules already exist in the rootfs for the default kernel.
|
||||
if [[ "$product_name" != "Surface Laptop 3" ]]; then
|
||||
if [[ $product_name != "Surface Laptop 3" ]]; then
|
||||
echo "Untested Surface Device: $product_name, additional modules may be required for your device."
|
||||
fi
|
||||
|
||||
echo "Attempting to autodetect required pinctrl module"
|
||||
pinctrl_module=$(lsmod | grep pinctrl_ | cut -f 1 -d" ")
|
||||
if [[ -z "$pinctrl_module" ]]; then
|
||||
if [[ -z $pinctrl_module ]]; then
|
||||
echo "Failed to autodetect pinctrl module."
|
||||
else
|
||||
echo "Detected pinctrl module: $pinctrl_module"
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
# Check if we have an Intel GPU at all
|
||||
if INTEL_GPU=$(lspci | grep -iE 'vga|3d|display' | grep -i 'intel'); then
|
||||
# HD Graphics and newer uses intel-media-driver
|
||||
if [[ "${INTEL_GPU,,}" =~ "hd graphics"|"xe"|"iris" ]]; then
|
||||
if [[ ${INTEL_GPU,,} =~ "hd graphics"|"xe"|"iris" ]]; then
|
||||
omarchy-pkg-add intel-media-driver
|
||||
elif [[ "${INTEL_GPU,,}" =~ "gma" ]]; then
|
||||
elif [[ ${INTEL_GPU,,} =~ "gma" ]]; then
|
||||
# Older generations from 2008 to ~2014-2017 use libva-intel-driver
|
||||
omarchy-pkg-add libva-intel-driver
|
||||
fi
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
legacy_drivers=("radeon")
|
||||
|
||||
for card in /sys/class/drm/card*; do
|
||||
if [[ -e "$card/device/driver" ]]; then
|
||||
if [[ -e $card/device/driver ]]; then
|
||||
driver=$(basename "$(readlink -f "$card/device/driver")")
|
||||
|
||||
for legacy in "${legacy_drivers[@]}"; do
|
||||
if [[ "$driver" == "$legacy" ]]; then
|
||||
if [[ $driver == $legacy ]]; then
|
||||
omarchy-install-terminal alacritty
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
NVIDIA="$(lspci | grep -i 'nvidia')"
|
||||
|
||||
if [ -n "$NVIDIA" ]; then
|
||||
if [[ -n $NVIDIA ]]; then
|
||||
# Check which kernel is installed and set appropriate headers package
|
||||
KERNEL_HEADERS="$(pacman -Qqs '^linux(-zen|-lts|-hardened)?$' | head -1)-headers"
|
||||
|
||||
@@ -14,7 +14,7 @@ if [ -n "$NVIDIA" ]; then
|
||||
GPU_ARCH="maxwell_pascal_volta"
|
||||
fi
|
||||
# Bail if no supported GPU
|
||||
if [ -z "${PACKAGES+x}" ]; then
|
||||
if [[ -z ${PACKAGES+x} ]]; then
|
||||
echo "No compatible driver for your NVIDIA GPU. See: https://wiki.archlinux.org/title/NVIDIA"
|
||||
exit 0
|
||||
fi
|
||||
@@ -32,7 +32,7 @@ MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)
|
||||
EOF
|
||||
|
||||
# Add NVIDIA environment variables based on GPU architecture
|
||||
if [ "$GPU_ARCH" = "turing_plus" ]; then
|
||||
if [[ $GPU_ARCH = "turing_plus" ]]; then
|
||||
# Turing+ (RTX 20xx, GTX 16xx, and newer) with GSP firmware support
|
||||
cat >>"$HOME/.config/hypr/envs.conf" <<'EOF'
|
||||
|
||||
@@ -41,7 +41,7 @@ env = NVD_BACKEND,direct
|
||||
env = LIBVA_DRIVER_NAME,nvidia
|
||||
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
|
||||
EOF
|
||||
elif [ "$GPU_ARCH" = "maxwell_pascal_volta" ]; then
|
||||
elif [[ $GPU_ARCH = "maxwell_pascal_volta" ]]; then
|
||||
# Maxwell/Pascal/Volta (GTX 9xx/10xx, GT 10xx, Quadro P/M/GV, MX series, Titan X/Xp/V) lack GSP firmware
|
||||
cat >>"$HOME/.config/hypr/envs.conf" <<'EOF'
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# First check that wireless-regdb is there
|
||||
if [ -f "/etc/conf.d/wireless-regdom" ]; then
|
||||
if [[ -f "/etc/conf.d/wireless-regdom" ]]; then
|
||||
unset WIRELESS_REGDOM
|
||||
. /etc/conf.d/wireless-regdom
|
||||
fi
|
||||
|
||||
# If the region is already set, we're done
|
||||
if [ ! -n "${WIRELESS_REGDOM}" ]; then
|
||||
if [[ ! -n ${WIRELESS_REGDOM} ]]; then
|
||||
# Get the current timezone
|
||||
if [ -e "/etc/localtime" ]; then
|
||||
if [[ -e "/etc/localtime" ]]; then
|
||||
TIMEZONE=$(readlink -f /etc/localtime)
|
||||
TIMEZONE=${TIMEZONE#/usr/share/zoneinfo/}
|
||||
|
||||
@@ -15,12 +15,12 @@ if [ ! -n "${WIRELESS_REGDOM}" ]; then
|
||||
COUNTRY="${TIMEZONE%%/*}"
|
||||
|
||||
# If we don't have a two letter country, get it from the timezone table
|
||||
if [[ ! "$COUNTRY" =~ ^[A-Z]{2}$ ]] && [ -f "/usr/share/zoneinfo/zone.tab" ]; then
|
||||
if [[ ! $COUNTRY =~ ^[A-Z]{2}$ ]] && [[ -f /usr/share/zoneinfo/zone.tab ]]; then
|
||||
COUNTRY=$(awk -v tz="$TIMEZONE" '$3 == tz {print $1; exit}' /usr/share/zoneinfo/zone.tab)
|
||||
fi
|
||||
|
||||
# Check if we have a two letter country code
|
||||
if [[ "$COUNTRY" =~ ^[A-Z]{2}$ ]]; then
|
||||
if [[ $COUNTRY =~ ^[A-Z]{2}$ ]]; then
|
||||
# Append it to the wireless-regdom conf file that is used at boot
|
||||
echo "WIRELESS_REGDOM=\"$COUNTRY\"" | sudo tee -a /etc/conf.d/wireless-regdom >/dev/null
|
||||
|
||||
|
||||
@@ -15,6 +15,6 @@ for vendor in "${!VULKAN_DRIVERS[@]}"; do
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#PACKAGES[@]} -gt 0 ]; then
|
||||
if (( ${#PACKAGES[@]} > 0 )); then
|
||||
omarchy-pkg-add "${PACKAGES[@]}"
|
||||
fi
|
||||
|
||||
@@ -10,7 +10,7 @@ EOF
|
||||
|
||||
mise trust ~/Work/.mise.toml
|
||||
|
||||
if [[ -n "${OMARCHY_CHROOT_INSTALL:-}" ]]; then
|
||||
if [[ -n ${OMARCHY_CHROOT_INSTALL:-} ]]; then
|
||||
NODE_TARBALL=$(find /opt/packages -name "node-v*-linux-x64.tar.gz" -type f 2>/dev/null | head -n1)
|
||||
|
||||
NODE_VERSION=$(basename "$NODE_TARBALL" | sed 's/node-v\(.*\)-linux-x64.tar.gz/\1/')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
if omarchy-battery-present; then
|
||||
mapfile -t profiles < <(omarchy-powerprofiles-list)
|
||||
|
||||
if [[ ${#profiles[@]} -gt 1 ]]; then
|
||||
if (( ${#profiles[@]} > 1 )); then
|
||||
|
||||
# Default AC profile:
|
||||
# 3 profiles → performance
|
||||
|
||||
Reference in New Issue
Block a user