fix: arrays not passed through with env
This commit is contained in:
parent
956f923f3f
commit
2de46a3872
2
config
2
config
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
set -a
|
set -a
|
||||||
|
|
||||||
swapfile=auto # true|MB
|
swapfile=auto # auto|MB
|
||||||
|
|
||||||
username=ange
|
username=ange
|
||||||
user_passwd=ange
|
user_passwd=ange
|
||||||
|
21
dotfiles.sh
21
dotfiles.sh
@ -1,23 +1,6 @@
|
|||||||
#!/bin/bash -ex
|
#!/bin/bash -ex
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
. ./config
|
. ./config
|
||||||
. ./lib.sh
|
|
||||||
|
|
||||||
awk 'p; /pattern/{p=1}' "$0" | arch-chroot /mnt/ su "$username" -c bash -ex; exit
|
arch-chroot /mnt/ su "$username" -c bash -ex \
|
||||||
|
< src/dotfiles.sh
|
||||||
|
|
||||||
config=(git --git-dir "$HOME/.dotfiles" --work-tree "$HOME")
|
|
||||||
repo='https://git.maby.dev/ange/.dotfiles.git'
|
|
||||||
|
|
||||||
if [ "$EUID" = 0 ]; then
|
|
||||||
echo 'You are currently logged in as root. Continue?'
|
|
||||||
read -r
|
|
||||||
fi
|
|
||||||
|
|
||||||
git clone --bare "$repo" "$HOME/.dotfiles"
|
|
||||||
|
|
||||||
"${config[@]}" checkout -f
|
|
||||||
"${config[@]}" submodule update --init --recursive --remote
|
|
||||||
"${config[@]}" config status.showUntrackedFiles no
|
|
||||||
|
|
||||||
echo -e "${BOLD}${GREEN}DONE. You need to reboot to apply the changes.${NORMAL}"
|
|
||||||
|
@ -1,29 +1,7 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
. ./config
|
|
||||||
. ../../lib.sh
|
|
||||||
|
|
||||||
awk 'p; /pattern/{p=1}' "$(basename "$0")" | arch-chroot /mnt/ bash -ex; exit
|
arch-chroot /mnt/ bash -ex \
|
||||||
|
< ../../src/lib.sh \
|
||||||
|
< config \
|
||||||
# drivers
|
< src/install.sh
|
||||||
case "$(lspci -k | grep -A3 -E '(VGA|3D)')" in
|
|
||||||
*amdgpu*)
|
|
||||||
pkg=("${pkg[@]}" xf86-video-amdgpu)
|
|
||||||
;;
|
|
||||||
*i915*)
|
|
||||||
pkg=("${pkg[@]}" xf86-video-intel)
|
|
||||||
;;
|
|
||||||
*nouveau*)
|
|
||||||
pkg=("${pkg[@]}" xf86-video-nouveau)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
pac "${pkg[@]}"
|
|
||||||
|
|
||||||
cp -rfT rootfs /
|
|
||||||
|
|
||||||
git clone https://git.maby.dev/ange/suckless.git /tmp/suckless/
|
|
||||||
cd /tmp/suckless
|
|
||||||
./update.sh
|
|
||||||
|
|
||||||
echo -e "${BOLD}${GREEN}DONE. I recommend you to install dotfiles.sh to get a fully functioning config.${NORMAL}"
|
|
||||||
|
23
gui/dwm/src/install
Normal file
23
gui/dwm/src/install
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash -ex
|
||||||
|
|
||||||
|
# drivers
|
||||||
|
case "$(lspci -k | grep -A3 -E '(VGA|3D)')" in
|
||||||
|
*amdgpu*)
|
||||||
|
pkg=("${pkg[@]}" xf86-video-amdgpu)
|
||||||
|
;;
|
||||||
|
*i915*)
|
||||||
|
pkg=("${pkg[@]}" xf86-video-intel)
|
||||||
|
;;
|
||||||
|
*nouveau*)
|
||||||
|
pkg=("${pkg[@]}" xf86-video-nouveau)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
pac "${pkg[@]}"
|
||||||
|
|
||||||
|
cp -rfT rootfs /
|
||||||
|
|
||||||
|
git clone https://git.maby.dev/ange/suckless.git /tmp/suckless/
|
||||||
|
cd /tmp/suckless
|
||||||
|
./update.sh
|
||||||
|
|
||||||
|
echo -e "${BOLD}${GREEN}DONE. I recommend you to install dotfiles.sh to get a fully functioning config.${NORMAL}"
|
@ -1,32 +1,7 @@
|
|||||||
#!/bin/bash -ex
|
#!/bin/bash -ex
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
. ./config
|
|
||||||
. ../lib.sh
|
|
||||||
|
|
||||||
awk 'p; /pattern/{p=1}' "$(basename "$0")" | arch-chroot /mnt/ bash -ex; exit
|
arch-chroot /mnt/ bash -ex \
|
||||||
|
< config \
|
||||||
|
< ../src/lib.sh \
|
||||||
pac "${pkg[@]}" flatpak
|
< src/install.sh
|
||||||
flatpak install -y "${flatpakpkg[@]}"
|
|
||||||
|
|
||||||
case "$(lspci -k | grep -E '(VGA|3D)')" in
|
|
||||||
*AMD*)
|
|
||||||
pac mesa vulkan-radeon
|
|
||||||
modules=amdgpu
|
|
||||||
;;
|
|
||||||
*Intel*)
|
|
||||||
pac mesa vulkan-intel
|
|
||||||
modules=i915
|
|
||||||
;;
|
|
||||||
*NVIDIA*)
|
|
||||||
pac nvidia{,-utils,-settings}
|
|
||||||
modules='nvidia nvidia_modeset nvidia_uvm nvidia_drm'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
sed -i "s/^MODULES=(/MODULES=($modules/" /etc/mkinitcpio.conf
|
|
||||||
mkinitcpio -P
|
|
||||||
|
|
||||||
xdg-user-dirs-update
|
|
||||||
|
|
||||||
echo -e "${BOLD}${GREEN}GPU drivers install finished.${NORMAL}"
|
|
||||||
|
26
gui/src/install.sh
Normal file
26
gui/src/install.sh
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash -ex
|
||||||
|
|
||||||
|
pac "${pkg[@]}" flatpak
|
||||||
|
flatpak install -y "${flatpakpkg[@]}"
|
||||||
|
|
||||||
|
case "$(lspci -k | grep -E '(VGA|3D)')" in
|
||||||
|
*AMD*)
|
||||||
|
pac mesa vulkan-radeon
|
||||||
|
modules=amdgpu
|
||||||
|
;;
|
||||||
|
*Intel*)
|
||||||
|
pac mesa vulkan-intel
|
||||||
|
modules=i915
|
||||||
|
;;
|
||||||
|
*NVIDIA*)
|
||||||
|
pac nvidia{,-utils,-settings}
|
||||||
|
modules='nvidia nvidia_modeset nvidia_uvm nvidia_drm'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
sed -i "s/^MODULES=(/MODULES=($modules/" /etc/mkinitcpio.conf
|
||||||
|
mkinitcpio -P
|
||||||
|
|
||||||
|
xdg-user-dirs-update
|
||||||
|
|
||||||
|
echo -e "${BOLD}${GREEN}GPU drivers install finished.${NORMAL}"
|
83
install.sh
83
install.sh
@ -6,17 +6,18 @@ cd "$(dirname "$0")"
|
|||||||
(
|
(
|
||||||
case "$swapfile" in
|
case "$swapfile" in
|
||||||
[0-9]*)
|
[0-9]*)
|
||||||
size=$swapfile
|
size="$swapfile"
|
||||||
;;
|
;;
|
||||||
true)
|
true)
|
||||||
size="$(python -c "from math import ceil,log; print(2**ceil((log($swapfile)/log(2))))")"
|
ram="$(free -h | awk '$1 == "Mem:" {print $2}')"
|
||||||
|
size="$(python -c "from math import ceil,log; print(2**ceil((log($ram)/log(2))))")"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
dd if=/dev/zero of=/mnt/swapfile bs=1M count="$swapfile" status=progress
|
dd if=/dev/zero of=/mnt/swapfile bs=1M count="$size" status=progress
|
||||||
chmod 600 /mnt/swapfile
|
chmod 600 /mnt/swapfile
|
||||||
mkswap /mnt/swapfile
|
mkswap /mnt/swapfile
|
||||||
swapon /mnt/swapfile
|
swapon /mnt/swapfile
|
||||||
@ -25,75 +26,11 @@ cd "$(dirname "$0")"
|
|||||||
cp -f rootfs/etc/pacman.conf /etc/pacman.conf
|
cp -f rootfs/etc/pacman.conf /etc/pacman.conf
|
||||||
systemctl restart reflector
|
systemctl restart reflector
|
||||||
pacman -Sy
|
pacman -Sy
|
||||||
pacstrap -K /mnt/ "${pkg[@]}"
|
pacstrap -K --needed /mnt/ "${pkg[@]}"
|
||||||
cp -rfT rootfs/ /mnt/
|
cp -rfT rootfs/ /mnt/
|
||||||
genfstab -U /mnt >> /mnt/etc/fstab
|
genfstab -U /mnt/ >> /mnt/etc/fstab
|
||||||
|
|
||||||
|
arch-chroot /mnt/ bash -ex \
|
||||||
|
< config \
|
||||||
awk 'p; /pattern/{p=1}' "$0" | arch-chroot /mnt/ bash -ex; exit
|
< src/lib.sh \
|
||||||
|
< src/install.sh
|
||||||
|
|
||||||
|
|
||||||
# System config
|
|
||||||
ln -sf "/usr/share/zoneinfo/$tz" /etc/localtime
|
|
||||||
hwclock --systohc
|
|
||||||
for l in "${locales[@]}"; do
|
|
||||||
sed -i "/^#\s*$l.UTF-8/s/^#\s*//" /etc/locale.gen
|
|
||||||
done
|
|
||||||
locale-gen
|
|
||||||
echo "LANG=$lang.UTF-8" > /etc/locale.conf
|
|
||||||
echo "$hostname" > /etc/hostname
|
|
||||||
|
|
||||||
# Drivers
|
|
||||||
case "$(lscpu | grep Vendor)" in
|
|
||||||
*AuthenticAMD*) cpu=amd ;;
|
|
||||||
*GenuineIntel*) cpu=intel ;;
|
|
||||||
esac
|
|
||||||
sed -i '/^HOOKS=(/s/filesystems/encrypt filesystems/' /etc/mkinitcpio.conf
|
|
||||||
|
|
||||||
# Services
|
|
||||||
pac "$cpu-ucode"
|
|
||||||
systemctl enable \
|
|
||||||
NetworkManager \
|
|
||||||
ip6tables \
|
|
||||||
iptables \
|
|
||||||
podman.socket \
|
|
||||||
reflector.timer \
|
|
||||||
systemd-resolved \
|
|
||||||
systemd-timesyncd
|
|
||||||
|
|
||||||
if ls -d /sys/class/power_supply/BAT*/ > /dev/null 2>&1; then
|
|
||||||
pac "${laptop_pkg[@]}"
|
|
||||||
systemctl enable tlp
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Users
|
|
||||||
echo "root:$root_passwd" | chpasswd
|
|
||||||
useradd -mG wheel,video "$username" -s "${default_shell-/bin/bash}"
|
|
||||||
echo "$username:$user_passwd" | chpasswd
|
|
||||||
su "$username" -c 'xdg-user-dirs-update' 2> /dev/null || true
|
|
||||||
|
|
||||||
sed -i '/^#\s*%wheel\s\+ALL=(ALL:ALL)\s\+ALL/s/^#\s*//' /etc/sudoers
|
|
||||||
|
|
||||||
# Bootloader
|
|
||||||
bootctl install
|
|
||||||
|
|
||||||
root="$(findmnt -nr -o source /)"
|
|
||||||
cryptdev="$(cryptsetup status "$root" | grep device | awk '{print $2}' || true)"
|
|
||||||
if [ -n "$cryptdev" ]; then
|
|
||||||
uuid="$(blkid | grep "$cryptdev" | awk '{print $2}')"
|
|
||||||
options="cryptdevice=$uuid:$(basename "$root") "
|
|
||||||
fi
|
|
||||||
|
|
||||||
options="${options}root=$root"
|
|
||||||
|
|
||||||
for f in /boot/loader/entries/*.conf; do
|
|
||||||
cat << EOF >> "$f"
|
|
||||||
initrd /$cpu-ucode.img
|
|
||||||
options $options rw
|
|
||||||
EOF
|
|
||||||
done
|
|
||||||
|
|
||||||
echo -e "${BOLD}${GREEN}DONE. You can install a desktop environment \
|
|
||||||
(see README.md). Then, you can Ctrl+D, umount -R /mnt/ and reboot${NORMAL}"
|
|
||||||
|
17
src/dotfiles.sh
Normal file
17
src/dotfiles.sh
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash -ex
|
||||||
|
|
||||||
|
config=(git --git-dir "$HOME/.dotfiles" --work-tree "$HOME")
|
||||||
|
repo='https://git.maby.dev/ange/.dotfiles.git'
|
||||||
|
|
||||||
|
if [ "$EUID" = 0 ]; then
|
||||||
|
echo 'You are currently logged in as root. Continue?'
|
||||||
|
read -r
|
||||||
|
fi
|
||||||
|
|
||||||
|
git clone --bare "$repo" "$HOME/.dotfiles"
|
||||||
|
|
||||||
|
"${config[@]}" checkout -f
|
||||||
|
"${config[@]}" submodule update --init --recursive --remote
|
||||||
|
"${config[@]}" config status.showUntrackedFiles no
|
||||||
|
|
||||||
|
echo -e "${BOLD}${GREEN}DONE. You need to reboot to apply the changes.${NORMAL}"
|
64
src/install.sh
Normal file
64
src/install.sh
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/bash -ex
|
||||||
|
|
||||||
|
# System config
|
||||||
|
ln -sf "/usr/share/zoneinfo/$tz" /etc/localtime
|
||||||
|
hwclock --systohc
|
||||||
|
for l in "${locales[@]}"; do
|
||||||
|
sed -i "/^#\s*$l.UTF-8/s/^#\s*//" /etc/locale.gen
|
||||||
|
done
|
||||||
|
locale-gen
|
||||||
|
echo "LANG=$lang.UTF-8" > /etc/locale.conf
|
||||||
|
echo "$hostname" > /etc/hostname
|
||||||
|
|
||||||
|
# Drivers
|
||||||
|
case "$(lscpu | grep Vendor)" in
|
||||||
|
*AuthenticAMD*) cpu=amd ;;
|
||||||
|
*GenuineIntel*) cpu=intel ;;
|
||||||
|
esac
|
||||||
|
sed -i '/^HOOKS=(/s/filesystems/encrypt filesystems/' /etc/mkinitcpio.conf
|
||||||
|
|
||||||
|
# Services
|
||||||
|
pac "$cpu-ucode"
|
||||||
|
systemctl enable \
|
||||||
|
NetworkManager \
|
||||||
|
ip6tables \
|
||||||
|
iptables \
|
||||||
|
podman.socket \
|
||||||
|
reflector.timer \
|
||||||
|
systemd-resolved \
|
||||||
|
systemd-timesyncd
|
||||||
|
|
||||||
|
if ls -d /sys/class/power_supply/BAT*/ > /dev/null 2>&1; then
|
||||||
|
pac "${laptop_pkg[@]}"
|
||||||
|
systemctl enable tlp
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Users
|
||||||
|
echo "root:$root_passwd" | chpasswd
|
||||||
|
useradd -mG wheel,video "$username" -s "${default_shell-/bin/bash}"
|
||||||
|
echo "$username:$user_passwd" | chpasswd
|
||||||
|
su "$username" -c 'xdg-user-dirs-update' 2> /dev/null || true
|
||||||
|
|
||||||
|
sed -i '/^#\s*%wheel\s\+ALL=(ALL:ALL)\s\+ALL/s/^#\s*//' /etc/sudoers
|
||||||
|
|
||||||
|
# Bootloader
|
||||||
|
bootctl install
|
||||||
|
|
||||||
|
root="$(findmnt -nr -o source /)"
|
||||||
|
cryptdev="$(cryptsetup status "$root" | grep device | awk '{print $2}' || true)"
|
||||||
|
if [ -n "$cryptdev" ]; then
|
||||||
|
uuid="$(blkid | grep "$cryptdev" | awk '{print $2}')"
|
||||||
|
options="cryptdevice=$uuid:$(basename "$root") "
|
||||||
|
fi
|
||||||
|
|
||||||
|
options="${options}root=$root"
|
||||||
|
|
||||||
|
for f in /boot/loader/entries/*.conf; do
|
||||||
|
cat << EOF >> "$f"
|
||||||
|
initrd /$cpu-ucode.img
|
||||||
|
options $options rw
|
||||||
|
EOF
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -e "${BOLD}${GREEN}DONE. You can install a desktop environment \
|
||||||
|
(see README.md). Then, you can Ctrl+D, umount -R /mnt/ and reboot${NORMAL}"
|
Loading…
Reference in New Issue
Block a user