Skip to content

Instantly share code, notes, and snippets.

@Buttars
Last active February 3, 2024 03:56
Show Gist options
  • Save Buttars/3bb7690438d987258a0d699febf37f90 to your computer and use it in GitHub Desktop.
Save Buttars/3bb7690438d987258a0d699febf37f90 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
# ____ _ _
#| __ ) _ _| |_| |_ __ _ _ __ ___
#| _ \| | | | __| __/ _` | '__/ __|
#| |_) | |_| | |_| || (_| | | \__ \
#|____/ \__,_|\__|\__\__,_|_| |___/
# _ _
# / \ _ __ ___| |__
# / _ \ | '__/ __| '_ \
# / ___ \| | | (__| | | |
#/_/ \_\_| \___|_| |_|
# ___ _ _ _ _ _
#|_ _|_ __ ___| |_ __ _| | | __ _| |_(_) ___ _ __
# | || '_ \/ __| __/ _` | | |/ _` | __| |/ _ \| '_ \
# | || | | \__ \ || (_| | | | (_| | |_| | (_) | | | |
#|___|_| |_|___/\__\__,_|_|_|\__,_|\__|_|\___/|_| |_|
# author Landon Buttars
# created: May 2018
# modified: May 2018
# =========================
if [ -d /sys/firmware/efi ]; then UEFI=true; else UEFI=false; fi
pacman -Sy
pacman -S --noconfirm --needed --noprogressbar --quiet reflector
reflector -l 3 --sort rate --save /etc/pacman.d/mirrorlist
pacman -S --noconfirm --needed --noprogressbar --quiet awk
if [ $UEFI == false ]
then
parted -s /dev/sda -- mklabel msdos \
mkpart primary ext4 1MiB 100MiB \
set 1 boot on \
mkpart primary linux-swap 100MiB 8GiB\
mkpart primary ext4 8GiB 55% \
mkpart primary ext4 55% 100%
else
parted -s /dev/sda -- mklabel gpt \
mkpart primary ext4 0% 1GiB \
set 1 boot on \
mkpart primary linux-swap 1GiB 16GiB \
mkpart primary ext4 16GiB 55% \
mkpart primary ext4 55% 100%
fi
mkfs.fat -F32 /dev/sda1
mkswap /dev/sda2
swapon /dev/sda2
mkfs.ext4 /dev/sda3
mkfs.ext4 /dev/sda4
mount /dev/sda3 /mnt
mkdir -p /mnt/boot
mount /dev/sda1 /mnt/boot
mkdir -p /mnt/home
mount /dev/sda4 /mnt/home
pacstrap /mnt base base-devel
genfstab -U -p /mnt >> /mnt/etc/fstab
#====================================================================
cat <<- EOF > /mnt/second.sh
echo LANG=en_US.UTF-8 > /etc/locale.conf
sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen
locale-gen
ln -svf /usr/share/zoneinfo/America/Denver /etc/localtime
hwclock --systohc --utc
pacman -Sy
pacman -S --noconfirm --needed --noprogressbar --quiet reflector
reflector -l 3 --sort rate --save /etc/pacman.d/mirrorlist
pacman -Syu
pacman -S --noconfirm --needed archlinux-keyring
pacman -S --noconfirm --needed \
ack \
alsa-lib \
alsa-utils \
arandr \
aspell-en \
autoconf \
automake \
avahi \
bison \
cups \
dbus \
dolphin \
fakeroot \
file-roller \
firefox \
flac \
flex \
gdm \
gist \
git \
gnupg \
gparted \
hplip \
htop \
i3-gaps \
inetutils \
intel-ucode \
iputils \
java-environment-common \
java-runtime-common \
jfsutils \
licenses \
logrotate \
lttng-ust \
make \
man-db \
man-pages \
mono \
zsh \
useradd -m -g users -G wheel -s /bin/zsh buttars
sed -i 's/# %wheel ALL=(ALL) NOPASSWD/%wheel ALL=(ALL) NOPASSWD/g' /etc/sudoers
chsh -s /bin/zsh root
cd /tmp
git clone https://aur.archlinux.org/package-query.git
chown -R buttars package-query
cd package-query
sudo -u buttars makepkg
pacman -U package-query-*.pkg.tar.xz --noconfirm
cd /tmp
git clone https://aur.archlinux.org/yay.git
chown -R buttars yay
cd yay
sudo -u buttars makepkg
pacman -U yay-*.pkg.tar.xz --noconfirm
if [ $UEFI == false ]
then
pacman -S grub os-prober --noconfirm
grub-install --target=i386-pc --recheck /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
else
bootctl --path=/boot install
mkdir -p /boot/loader/entries/
echo "default arch\ntimeout 4\neditor 0" > /boot/loader/loader.conf
echo "
title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options root=/dev/sda3 rw
resume=/dev/sda2
" > /boot/loader/entries/arch.conf
fi
EOF
#====================================================================
cat <<- EOF > /mnt/user.sh
yay -S --noconfirm
bullet-train-oh-my-zsh-theme-git \
discord \
discord-canary \
consolas-font \
google-chrome \
mirage \
i3-gaps \
rofi \
oh-my-zsh-git \
ttf-google-fonts-git \
ttf-symbola \
google-chrome \
visual-studio-code-bin \
polybar \
git clone --bare https://github.com/buttars/.dotfiles $HOME/.dotfiles
alias dotfiles="/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME"
dotfiles config --local status.showUntrackedFiles no
dotfiles checkout
EOF
#====================================================================
cat <<- EOF > /mnt/final.sh
echo buttars- > /etc/hostname
systemctl enable dhcpcd
systemctl enable sddm
systemctl enable sshd
echo buttars:password | chpasswd
passwd buttars -e
echo root:password | chpasswd
passwd root -e
EOF
#====================================================================
arch-chroot /mnt /bin/bash -e -x /second.sh
arch-chroot /mnt /bin/bash -e -x sudo -u /user.sh
arch-chroot /mnt /bin/bash -e -x /final.sh
rm /mnt/second.sh
rm /mnt/user.sh
rm /mnt/final.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment