fix: array not exportable in bash

This commit is contained in:
ange 2024-05-25 16:58:59 +02:00
parent a69d60fa19
commit 88f882668f
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D
8 changed files with 58 additions and 56 deletions

6
config
View File

@ -18,10 +18,8 @@ shell=zsh
hostname="$username-pc" hostname="$username-pc"
tz=Europe/Paris tz=Europe/Paris
locales=( locales=en_US # e.g. 'en_US,fr_FR'
en_US lang=en_US
)
lang="${locales[0]}"
pkg=( pkg=(
base-devel man-{db,pages} tldr base-devel man-{db,pages} tldr

View File

@ -6,4 +6,6 @@ set -a
. ./config . ./config
set +a set +a
printf '%s\n' "${pkg[@]}" > pkglist.txt
bash ./modules/"$install_type".sh bash ./modules/"$install_type".sh

View File

@ -2,7 +2,8 @@
#shellcheck disable=SC2154 #shellcheck disable=SC2154
cp -r ./modules/chroot/ /mnt/ cp -r ./modules/chroot/ /mnt/
for i in *.sh; do
for i in ./modules/prechroot/*.sh; do
bash -x "$i" bash -x "$i"
done done

View File

@ -4,9 +4,9 @@
ln -sf "/usr/share/zoneinfo/$tz" /etc/localtime ln -sf "/usr/share/zoneinfo/$tz" /etc/localtime
hwclock --systohc hwclock --systohc
for l in "${locales[@]}"; do while read -r l; do
sed -i "/^#\s*$l.UTF-8/s/^#\s*//" /etc/locale.gen sed -i "/^#\s*$l.UTF-8/s/^#\s*//" /etc/locale.gen
done done < <(sed 's/,/\n/g' "$locales")
locale-gen locale-gen
echo "LANG=$lang.UTF-8" > /etc/locale.conf echo "LANG=$lang.UTF-8" > /etc/locale.conf

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
#shellcheck disable=SC2154 #shellcheck disable=SC2154
[ -n "$flatpak" ] && flatpak install -y "${flatpak[@]}" [ -s flatpak.txt ] && xargs flatpak install -y < flatpak.txt

View File

@ -1,42 +1,42 @@
#!/bin/bash #!/bin/bash
#shellcheck disable=SC2154 #shellcheck disable=SC2154
pkg+=( #newsraft
aerc w3m printf '%s\n' \
bluez{,-utils} aerc w3m \
dunst libnotify bluez{,-utils} \
feh dunst libnotify \
gammastep feh \
graphicsmagick ghostscript gammastep \
gvfs{,-gphoto2,-mtp} graphicsmagick ghostscript \
materia-gtk-theme papirus-icon-theme gvfs{,-gphoto2,-mtp} \
monero materia-gtk-theme papirus-icon-theme \
mpv monero \
#newsraft mpv \
noto-fonts{,-cjk,-emoji} ttf-{dejavu,liberation} otf-font-awesome noto-fonts{,-cjk,-emoji} ttf-{dejavu,liberation} otf-font-awesome \
pass{,-otp} gcr pass{,-otp} gcr \
pcmanfm-gtk3 pcmanfm-gtk3 \
pipewire{,-pulse,-jack} pavucontrol playerctl pipewire{,-pulse,-jack} pavucontrol playerctl \
polkit-gnome polkit-gnome \
qemu-{base,audio-pipewire,hw-usb-host,hw-display-virtio-{gpu,vga},ui-gtk} dnsmasq qemu-{base,audio-pipewire,hw-usb-host,hw-display-virtio-{gpu,vga},ui-gtk} dnsmasq \
xdg-user-dirs xdg-user-dirs \
yt-dlp yt-dlp \
zathura{,-pdf-poppler} zathura{,-pdf-poppler} \
zenity zenity \
) >> pkglist.txt
flatpakpkg+=( printf '%s\n' \
com.valvesoftware.Steam org.freedesktop.Platform.VulkanLayer.gamescope com.valvesoftware.Steam org.freedesktop.Platform.VulkanLayer.gamescope \
net.lutris.Lutris net.lutris.Lutris \
org.gimp.GIMP org.gimp.GIMP \
org.gtk.Gtk3theme.Materia-dark org.gtk.Gtk3theme.Materia-dark \
org.mozilla.firefox org.mozilla.firefox \
) >> flatpak.txt
case "$(lspci | grep 'VGA\|3D')" in case "$(lspci | grep 'VGA\|3D')" in
*AMD*) pkg+=(vulkan-radeon) ;; *AMD*) echo vulkan-radeon >> pkglist.txt ;;
*Intel*) pkg+=(vulkan-intel) ;; *Intel*) echo vulkan-intel >> pkglist.txt ;;
*NVIDIA*) pkg+=(vulkan-nouveau) ;; *NVIDIA*) echo vulkan-nouveau >> pkglist.txt ;;
*) ;; *) ;;
esac esac

View File

@ -1,22 +1,22 @@
#!/bin/bash #!/bin/bash
#shellcheck disable=SC2154 #shellcheck disable=SC2154
pkg+=( printf '%s\n' \
autorandr autorandr \
i3lock xss-lock i3lock xss-lock \
picom picom \
xorg-{server,xinit,xrandr,xsetroot} xclip xdotool xorg-{server,xinit,xrandr,xsetroot} xclip xdotool \
) >> pkglist.txt
case "$(lsmod)" in case "$(lsmod)" in
*amdgpu*) pkg+=(xf86-video-amdgpu) ;; *amdgpu*) echo xf86-video-amdgpu >> pkglist.txt ;;
*i915*) *i915*)
# https://wiki.archlinux.org/title/Intel_graphics#Installation # https://wiki.archlinux.org/title/Intel_graphics#Installation
#pkg+=(xf86-video-intel) #echo xf86-video-intel >> pkglist.txt
;; ;;
*nouveau*) *nouveau*)
# https://bugs.freedesktop.org/show_bug.cgi?id=94844#c3 # https://bugs.freedesktop.org/show_bug.cgi?id=94844#c3
#pkg+=(xf86-video-nouveau) #echo xf86-video-nouveau >> pkglist.txt
;; ;;
*) *)
;; ;;

View File

@ -2,16 +2,17 @@
#shellcheck disable=SC2154 #shellcheck disable=SC2154
case "$(lscpu)" in case "$(lscpu)" in
*AMD*) pkg+=(amd-ucode) ;; *AMD*) echo amd-ucode >> pkglist.txt ;;
*Intel*) pkg+=(intel-ucode) ;; *Intel*) echo intel-ucode >> pkglist.txt ;;
*) ;; *) ;;
esac esac
[ -n "$flatpak" ] && pkg+=(flatpak xdg-desktop-portal-gtk) [ -s "$flatpakpkg" ] \
&& printf '%s\n' flatpak xdg-desktop-portal-gtk >> pkglist.txt
[ -f /sys/class/power_supply/BAT0 ] && pkg+=(tlp) [ -f /sys/class/power_supply/BAT0 ] && echo tlp >> pkglist.txt
pacstrap -C rootfs/etc/pacman.conf -K /mnt/ \ pacstrap -C rootfs/etc/pacman.conf -K /mnt/ \
base linux{,-lts,-firmware} "$shell" "${pkg[@]}" base linux{,-lts,-firmware} "$shell" - < pkglist.txt
find /mnt/etc -name '*.pacnew' -delete find /mnt/etc -name '*.pacnew' -delete