@ -0,0 +1,24 @@ | |||||
# YAASS — Yeet's Automatic Arch Setup Scripts | |||||
YAASS is a small project that aims to make installing arch & artix linux easier | |||||
and straight-forward. It tries not to make too many assumptions on what the user | |||||
wants to do with their setup and prompts for input when there is a choice that | |||||
needs to be made. However, it provides a set of default settings that work just fine. | |||||
It doesn't install any packages besides some that **I** believe is essential like | |||||
connman (Network Manager), git, vim, tmux and xorg. | |||||
## Usage | |||||
You just need to download the yass.sh and run it. Assuming you already have an | |||||
installation usb and booted from it of course. If you want to save a few clicks, | |||||
you can do: | |||||
```sh | |||||
bash -C <(https://yigitcolakoglu.com/auto-yass.sh) | |||||
``` | |||||
## Distros Currently Supported | |||||
* Arch Linux | |||||
* Artix Linux (OpenRC) |
@ -0,0 +1,20 @@ | |||||
connman | |||||
efibootmgr | |||||
refind | |||||
dhcpcd | |||||
python | |||||
git | |||||
vim | |||||
pulseaudio | |||||
xorg | |||||
xorg-server | |||||
xorg-xinit | |||||
xorg-apps | |||||
xf86-video-intel | |||||
sudo | |||||
cronie | |||||
wget | |||||
curl | |||||
dash | |||||
mksh | |||||
acpi |
@ -0,0 +1,300 @@ | |||||
#!/bin/bash | |||||
export NC='\033[0m' | |||||
export RED='\033[0;31m' | |||||
export GREEN='\033[0;32m' | |||||
export ORANGE='\033[0;33m' | |||||
export BLUE='\033[0;34m' | |||||
export PURPLE='\033[0;35m' | |||||
export CYAN='\033[0;36m' | |||||
export LIGHTGRAY='\033[0;37m' | |||||
export DARKGRAY='\033[1;30m' | |||||
export LIGHTRED='\033[1;31m' | |||||
export LIGHTGREEN='\033[1;32m' | |||||
export YELLOW='\033[1;33m' | |||||
export LIGHTBLUE='\033[1;34m' | |||||
export LIGHTPURPLE='\033[1;35m' | |||||
export LIGHTCYAN='\033[1;36m' | |||||
export WHITE='\033[1;37m' | |||||
verbose=0 | |||||
info(){ | |||||
printf "[\e[32mINFO\e[0m]:%s\n" "$1" | |||||
} | |||||
debug(){ | |||||
if [ $verbose ]; then | |||||
printf "[\e[33mDEBUG\e[0m]:%s\n" "$1" | |||||
fi | |||||
} | |||||
error(){ | |||||
printf "[\e[31mERROR\e[0m]:%s\n" "$1" | |||||
} | |||||
prompt(){ | |||||
printf "[\e[35mPROMPT\e[0m]: %s" "$1" | |||||
read -r ans | |||||
printf "%s" "$ans" | |||||
} | |||||
install_deps(){ | |||||
info "Installing dependencies" | |||||
sudo pacman -Sy --needed --noconfirm git tmux 2> /dev/null > /dev/null | |||||
} | |||||
banner(){ | |||||
echo "${CYAN} | |||||
dP dP .d888888 .d888888 .d88888b .d88888b | |||||
Y8. .8P d8' 88 d8' 88 88. \"' 88. \"' | |||||
Y8aa8P 88aaaaa88a 88aaaaa88a \`Y88888b. \`Y88888b. | |||||
88 88 88 88 88 \`8b \`8b | |||||
88 88 88 88 88 d8' .8P d8' .8P | |||||
dP 88 88 88 88 Y88888P Y88888P | |||||
${NC}" | |||||
echo " ${PURPLE}Yeet's Automated Arch Setup Script${NC}" | |||||
} | |||||
clear | |||||
boot=$1 | |||||
root=$2 | |||||
swap=$3 | |||||
if [ ! "$(wc -l /install/device)" = "3" ]; then | |||||
home=$4 | |||||
fi | |||||
ln -sf /usr/share/zoneinfo/Europe/Istanbul /etc/localtime | |||||
hwclock --systohc | |||||
echo -e "en_US.UTF-8 UTF-8\ntr_TR.UTF-8 UTF-8" > /etc/locale.gen | |||||
locale-gen | |||||
echo "LANG=en_US.UTF-8" > /etc/locale.conf | |||||
if [ ! -f "/tmp/.blackarch" ]; then | |||||
curl https://blackarch.org/strap.sh > /tmp/strap.sh | |||||
chmod +x /tmp/strap.sh | |||||
/tmp/strap.sh | |||||
if [ -f "/install/artix" ]; then | |||||
echo -e "\n[multilib]\nInclude = /etc/pacman.d/mirrorlist-arch" >> /etc/pacman.conf | |||||
echo -e "\n[lib32]\nInclude = /etc/pacman.d/mirrorlist\n\n[options]\nILoveCandy\nTotalDownload\nColor" >> /etc/pacman.conf | |||||
else | |||||
echo -e "\n[multilib]\nInclude = /etc/pacman.d/mirrorlist\n\n[options]\nILoveCandy\nTotalDownload\nColor" >> /etc/pacman.conf | |||||
fi | |||||
echo -n "Are you going to use a flexo server?(y/N): " | |||||
read flexo | |||||
if [ "$flexo" = "y" ]; then | |||||
echo -n "Please enter ip address of flexo server: " | |||||
read flexo_ip | |||||
echo -e "\nServer = http://$flexo_ip:7878/\$repo/os/\$arch\n" >> /etc/pacman.d/mirrorlist | |||||
fi | |||||
pacman -Syy | |||||
echo -n "Did any errors occur?(y/N): " | |||||
read errors | |||||
if [ "$errors" = "y" ]; then | |||||
echo "Dropping you into a shell so that you can fix them, once you quit the shell, the installation will continue from where you left off." | |||||
bash | |||||
fi | |||||
touch /tmp/.blackarch | |||||
fi | |||||
clear | |||||
echo "Please enter hostname: " | |||||
read hostname | |||||
echo $hostname > /etc/hostname | |||||
echo "Set password for root: " | |||||
passwd root | |||||
echo "Please enter name for regular user:" | |||||
read username | |||||
useradd -m $username | |||||
echo "Set password for user $username: " | |||||
passwd $username | |||||
usermod -aG wheel $username | |||||
echo -e "127.0.0.1 localhost\n::1 localhost\n127.0.0.1 $hostname.localdomain $hostname" > /etc/hosts | |||||
if [ -f "/install/encrypted" ]; then | |||||
cat << EOF > /etc/initcpio/hooks/openswap | |||||
run_hook () | |||||
{ | |||||
x=0; | |||||
while [ ! -b /dev/mapper/root ] && [ \$x -le 10 ]; do | |||||
x=$((x+1)) | |||||
sleep .2 | |||||
done | |||||
mkdir crypto_key_device | |||||
mount /dev/mapper/root crypto_key_device | |||||
cryptsetup open --key-file crypto_key_device/root/.keys/swap-keyfile $swap swap | |||||
umount crypto_key_device | |||||
} | |||||
EOF | |||||
cat << EOF > /etc/initcpio/install/openswap | |||||
build () | |||||
{ | |||||
add_runscript | |||||
} | |||||
help () | |||||
{ | |||||
cat<<HELPEOF | |||||
This opens the swap encrypted partition $swap in /dev/mapper/swap | |||||
HELPEOF | |||||
} | |||||
EOF | |||||
if [ ! "$home" = "" ]; then | |||||
cat << EOF > /etc/initcpio/hooks/openhome | |||||
run_hook () | |||||
{ | |||||
x=0; | |||||
while [ ! -b /dev/mapper/root ] && [ \$x -le 10 ]; do | |||||
x=$((x+1)) | |||||
sleep .2 | |||||
done | |||||
mkdir crypto_key_device | |||||
mount /dev/mapper/root crypto_key_device | |||||
cryptsetup open --key-file crypto_key_device/root/.keys/home-keyfile $home home | |||||
umount crypto_key_device | |||||
} | |||||
EOF | |||||
cat << EOF > /etc/initcpio/install/openhome | |||||
build () | |||||
{ | |||||
add_runscript | |||||
} | |||||
help () | |||||
{ | |||||
cat<<HELPEOF | |||||
This opens the swap encrypted partition $home in /dev/mapper/home | |||||
HELPEOF | |||||
} | |||||
EOF | |||||
cat << EOF > /etc/mkinitcpio.conf | |||||
MODULES=(vfat i915) | |||||
BINARIES=() | |||||
FILES=() | |||||
HOOKS=(base udev plymouth autodetect keyboard keymap consolefont modconf block plymouth-encrypt openswap openhome resume filesystems fsck) | |||||
EOF | |||||
else | |||||
cat << EOF > /etc/mkinitcpio.conf | |||||
MODULES=(vfat i915) | |||||
BINARIES=() | |||||
FILES=() | |||||
HOOKS=(base udev plymouth autodetect keyboard keymap consolefont modconf block plymouth-encrypt openswap resume filesystems fsck) | |||||
EOF | |||||
fi | |||||
else | |||||
cat << EOF > /etc/mkinitcpio.conf | |||||
MODULES=(vfat i915) | |||||
BINARIES=() | |||||
FILES=() | |||||
HOOKS=(base udev plymouth autodetect keyboard keymap consolefont modconf block plymouth resume filesystems fsck) | |||||
EOF | |||||
fi | |||||
pacman -Syu --noconfirm $(cat /install/packages.base | xargs) | |||||
refind-install | |||||
if [ -f "/install/encrypted" ]; then | |||||
line=1 | |||||
blkid | while IFS= read -r i; do | |||||
echo "$line: $i" | |||||
((line=line+1)) | |||||
done | |||||
echo -n "Please select the device you will save the LUKS key to: " | |||||
read keydev | |||||
uuid=$(blkid | sed -n 's/.*UUID=\"\([^\"]*\)\".*/\1/p' | sed -n "$keydev"p) | |||||
cat << EOF > /boot/refind_linux.conf | |||||
"Boot with encryption" "root=/dev/mapper/root resume=/dev/mapper/swap cryptdevice=UUID=$(blkid -s UUID -o value $root):root:allow-discards cryptkey=UUID=$uuid:vfat:key.yeet rw loglevel=3 quiet splash" | |||||
EOF | |||||
clear | |||||
else | |||||
cat << EOF > /boot/refind_linux.conf | |||||
"Boot without encryption" "root=UUID=$(blkid -s UUID -o value $root) resume=UUID=$(blkid -s UUID -o value $swap) rw loglevel=3 quiet splash" | |||||
EOF | |||||
fi | |||||
mkdir -p /etc/sudoers.d | |||||
echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopwd | |||||
sudo -u $username bash -c "git clone https://aur.archlinux.org/yay.git /tmp/yay" | |||||
sudo -u $username bash -c "(cd /tmp/yay; makepkg --noconfirm -si)" | |||||
sudo -u $username bash -c "yay --noconfirm -S plymouth" | |||||
if [ -f "/install/artix" ]; then | |||||
sudo -u $username bash -c "yay --noconfirm -S plymouth-openrc-plugin" | |||||
fi | |||||
clear | |||||
echo -n "Would you like to automatically install my dotfiles?(y/N): " | |||||
read dotfiles | |||||
if [ "$dotfiles" = "y" ]; then | |||||
pacman -R --noconfirm vim | |||||
sudo -u $username bash -c "git clone --recurse-submodules https://github.com/theFr1nge/dotfiles.git ~/.dotfiles" | |||||
sudo -u $username bash -c "(cd ~/.dotfiles; ./install.sh)" | |||||
clear | |||||
fi | |||||
git clone https://github.com/adi1090x/plymouth-themes.git /tmp/pthemes | |||||
cat << EOF > /etc/plymouth/plymouthd.conf | |||||
[Daemon] | |||||
Theme=sphere | |||||
ShowDelay=0 | |||||
DeviceTimeout=8 | |||||
EOF | |||||
cp -r /tmp/pthemes/pack_4/sphere /usr/share/plymouth/themes | |||||
clear | |||||
echo -e "/boot/EFI/refind\n2\n2" | sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/bobafetthotmail/refind-theme-regular/master/install.sh)" | |||||
if [ -f "/install/artix" ]; then | |||||
sudo rc-update add cronie | |||||
sudo rc-update add acpi | |||||
sudo rc-update add dbus | |||||
sudo rc-update add connmand | |||||
sudo rc-update add syslog-ng | |||||
else | |||||
systemctl enable connman | |||||
systemctl enable cronie | |||||
fi | |||||
clear | |||||
mkinitcpio -P | |||||
if [ -f "/install/encrypted" ]; then | |||||
vim /etc/fstab | |||||
fi | |||||
pacman --noconfirm -R nano # uninstall nano, eww | |||||
clear | |||||
rm -rf /etc/sudoers.d/nopwd | |||||
echo "Defaults env_reset,pwfeedback" > /etc/sudoers.d/wheel | |||||
echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers.d/wheel | |||||
echo "$username $hostname =NOPASSWD: /sbin/shutdown ,/sbin/halt,/sbin/reboot,/sbin/hibernate, /bin/pacman -Syyuw --noconfirm" >> /etc/sudoers.d/wheel | |||||
ln -sf /bin/dash /bin/sh | |||||
clear | |||||
echo "SETUP COMPLETE" | |||||
bash | |||||
rm -rf /install |
@ -0,0 +1,270 @@ | |||||
#!/bin/bash | |||||
ln -sf /bin/bash /bin/sh | |||||
if [ ! -f "/install/device" ]; then | |||||
mkdir -p /install | |||||
echo "Now you will specify the partitions you have created" | |||||
echo "Please enter the suffix for each partition. For Ex:" | |||||
echo "1 if boot partition is /dev/sda1 or p1 if boot is on /dev/nvme0n1p1 and the disk is /dev/nvme0n1" | |||||
echo -n "Please enter boot partition suffix: " | |||||
read boot_p | |||||
boot=$device$boot_p | |||||
echo -n "Please enter root partition suffix: " | |||||
read root_p | |||||
root=$device$root_p | |||||
echo -n "Please enter swap partition suffix: " | |||||
read swap_p | |||||
swap=$device$swap_p | |||||
echo -n "Did you create a home partition as well?(y/N): " | |||||
read home_s | |||||
if [ "$home_s" = "y" ]; then | |||||
echo -n "Please enter home partition suffix: " | |||||
read home_p | |||||
home=$device$home_p | |||||
echo -en "$boot\n$root\n$swap\n$home" > /install/device | |||||
else | |||||
echo -en "$boot\n$root\n$swap" > /install/device | |||||
fi | |||||
fi | |||||
clear | |||||
boot=$(head -n 1 /install/device | tail -n 1) | |||||
root=$(head -n 2 /install/device | tail -n 1) | |||||
swap=$(head -n 3 /install/device | tail -n 1) | |||||
if [ ! "$(wc -l /install/device)" = "3" ]; then | |||||
home=$(head -n 4 /install/device | tail -n 1) | |||||
fi | |||||
ln -sf /usr/share/zoneinfo/Europe/Istanbul /etc/localtime | |||||
hwclock --systohc | |||||
echo -e "en_US.UTF-8 UTF-8\ntr_TR.UTF-8 UTF-8" > /etc/locale.gen | |||||
locale-gen | |||||
echo "LANG=en_US.UTF-8" > /etc/locale.conf | |||||
if [ ! -f "/tmp/.blackarch" ]; then | |||||
curl https://blackarch.org/strap.sh > /tmp/strap.sh | |||||
chmod +x /tmp/strap.sh | |||||
/tmp/strap.sh | |||||
if [ -f "/install/artix" ]; then | |||||
echo -e "\n[multilib]\nInclude = /etc/pacman.d/mirrorlist-arch" >> /etc/pacman.conf | |||||
echo -e "\n[lib32]\nInclude = /etc/pacman.d/mirrorlist\n\n[options]\nILoveCandy\nTotalDownload\nColor" >> /etc/pacman.conf | |||||
else | |||||
echo -e "\n[multilib]\nInclude = /etc/pacman.d/mirrorlist\n\n[options]\nILoveCandy\nTotalDownload\nColor" >> /etc/pacman.conf | |||||
fi | |||||
echo -n "Are you going to use a flexo server?(y/N): " | |||||
read flexo | |||||
if [ "$flexo" = "y" ]; then | |||||
echo -n "Please enter ip address of flexo server: " | |||||
read flexo_ip | |||||
echo -e "\nServer = http://$flexo_ip:7878/\$repo/os/\$arch\n" >> /etc/pacman.d/mirrorlist | |||||
fi | |||||
pacman -Syy | |||||
echo -n "Did any errors occur?(y/N): " | |||||
read errors | |||||
if [ "$errors" = "y" ]; then | |||||
echo "Dropping you into a shell so that you can fix them, once you quit the shell, the installation will continue from where you left off." | |||||
bash | |||||
fi | |||||
touch /tmp/.blackarch | |||||
fi | |||||
clear | |||||
echo "Please enter hostname: " | |||||
read hostname | |||||
echo $hostname > /etc/hostname | |||||
echo "Set password for root: " | |||||
passwd root | |||||
echo "Please enter name for regular user:" | |||||
read username | |||||
useradd -m $username | |||||
echo "Set password for user $username: " | |||||
passwd $username | |||||
usermod -aG wheel $username | |||||
echo -e "127.0.0.1 localhost\n::1 localhost\n127.0.0.1 $hostname.localdomain $hostname" > /etc/hosts | |||||
if [ -f "/install/encrypted" ]; then | |||||
cat << EOF > /etc/initcpio/hooks/openswap | |||||
run_hook () | |||||
{ | |||||
x=0; | |||||
while [ ! -b /dev/mapper/root ] && [ \$x -le 10 ]; do | |||||
x=$((x+1)) | |||||
sleep .2 | |||||
done | |||||
mkdir crypto_key_device | |||||
mount /dev/mapper/root crypto_key_device | |||||
cryptsetup open --key-file crypto_key_device/root/.keys/swap-keyfile $swap swap | |||||
umount crypto_key_device | |||||
} | |||||
EOF | |||||
cat << EOF > /etc/initcpio/install/openswap | |||||
build () | |||||
{ | |||||
add_runscript | |||||
} | |||||
help () | |||||
{ | |||||
cat<<HELPEOF | |||||
This opens the swap encrypted partition $swap in /dev/mapper/swap | |||||
HELPEOF | |||||
} | |||||
EOF | |||||
if [ ! "$home" = "" ]; then | |||||
cat << EOF > /etc/initcpio/hooks/openhome | |||||
run_hook () | |||||
{ | |||||
x=0; | |||||
while [ ! -b /dev/mapper/root ] && [ \$x -le 10 ]; do | |||||
x=$((x+1)) | |||||
sleep .2 | |||||
done | |||||
mkdir crypto_key_device | |||||
mount /dev/mapper/root crypto_key_device | |||||
cryptsetup open --key-file crypto_key_device/root/.keys/home-keyfile $home home | |||||
umount crypto_key_device | |||||
} | |||||
EOF | |||||
cat << EOF > /etc/initcpio/install/openhome | |||||
build () | |||||
{ | |||||
add_runscript | |||||
} | |||||
help () | |||||
{ | |||||
cat<<HELPEOF | |||||
This opens the swap encrypted partition $home in /dev/mapper/home | |||||
HELPEOF | |||||
} | |||||
EOF | |||||
cat << EOF > /etc/mkinitcpio.conf | |||||
MODULES=(vfat i915) | |||||
BINARIES=() | |||||
FILES=() | |||||
HOOKS=(base udev plymouth autodetect keyboard keymap consolefont modconf block plymouth-encrypt openswap openhome resume filesystems fsck) | |||||
EOF | |||||
else | |||||
cat << EOF > /etc/mkinitcpio.conf | |||||
MODULES=(vfat i915) | |||||
BINARIES=() | |||||
FILES=() | |||||
HOOKS=(base udev plymouth autodetect keyboard keymap consolefont modconf block plymouth-encrypt openswap resume filesystems fsck) | |||||
EOF | |||||
fi | |||||
else | |||||
cat << EOF > /etc/mkinitcpio.conf | |||||
MODULES=(vfat i915) | |||||
BINARIES=() | |||||
FILES=() | |||||
HOOKS=(base udev plymouth autodetect keyboard keymap consolefont modconf block plymouth resume filesystems fsck) | |||||
EOF | |||||
fi | |||||
pacman -Syu --noconfirm $(cat /install/packages.base | xargs) | |||||
refind-install | |||||
if [ -f "/install/encrypted" ]; then | |||||
line=1 | |||||
blkid | while IFS= read -r i; do | |||||
echo "$line: $i" | |||||
((line=line+1)) | |||||
done | |||||
echo -n "Please select the device you will save the LUKS key to: " | |||||
read keydev | |||||
uuid=$(blkid | sed -n 's/.*UUID=\"\([^\"]*\)\".*/\1/p' | sed -n "$keydev"p) | |||||
cat << EOF > /boot/refind_linux.conf | |||||
"Boot with encryption" "root=/dev/mapper/root resume=/dev/mapper/swap cryptdevice=UUID=$(blkid -s UUID -o value $root):root:allow-discards cryptkey=UUID=$uuid:vfat:key.yeet rw loglevel=3 quiet splash" | |||||
EOF | |||||
clear | |||||
else | |||||
cat << EOF > /boot/refind_linux.conf | |||||
"Boot without encryption" "root=UUID=$(blkid -s UUID -o value $root) resume=UUID=$(blkid -s UUID -o value $swap) rw loglevel=3 quiet splash" | |||||
EOF | |||||
fi | |||||
mkdir -p /etc/sudoers.d | |||||
echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopwd | |||||
sudo -u $username bash -c "git clone https://aur.archlinux.org/yay.git /tmp/yay" | |||||
sudo -u $username bash -c "(cd /tmp/yay; makepkg --noconfirm -si)" | |||||
sudo -u $username bash -c "yay --noconfirm -S plymouth" | |||||
if [ -f "/install/artix" ]; then | |||||
sudo -u $username bash -c "yay --noconfirm -S plymouth-openrc-plugin" | |||||
fi | |||||
clear | |||||
echo -n "Would you like to automatically install my dotfiles?(y/N): " | |||||
read dotfiles | |||||
if [ "$dotfiles" = "y" ]; then | |||||
pacman -R --noconfirm vim | |||||
sudo -u $username bash -c "git clone --recurse-submodules https://github.com/theFr1nge/dotfiles.git ~/.dotfiles" | |||||
sudo -u $username bash -c "(cd ~/.dotfiles; ./install.sh)" | |||||
clear | |||||
fi | |||||
git clone https://github.com/adi1090x/plymouth-themes.git /tmp/pthemes | |||||
cat << EOF > /etc/plymouth/plymouthd.conf | |||||
[Daemon] | |||||
Theme=sphere | |||||
ShowDelay=0 | |||||
DeviceTimeout=8 | |||||
EOF | |||||
cp -r /tmp/pthemes/pack_4/sphere /usr/share/plymouth/themes | |||||
clear | |||||
echo -e "/boot/EFI/refind\n2\n2" | sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/bobafetthotmail/refind-theme-regular/master/install.sh)" | |||||
if [ -f "/install/artix" ]; then | |||||
sudo rc-update add cronie | |||||
sudo rc-update add acpi | |||||
sudo rc-update add dbus | |||||
sudo rc-update add connmand | |||||
sudo rc-update add syslog-ng | |||||
else | |||||
systemctl enable connman | |||||
systemctl enable cronie | |||||
fi | |||||
clear | |||||
mkinitcpio -P | |||||
if [ -f "/install/encrypted" ]; then | |||||
vim /etc/fstab | |||||
fi | |||||
pacman --noconfirm -R nano # uninstall nano, eww | |||||
clear | |||||
rm -rf /etc/sudoers.d/nopwd | |||||
echo "Defaults env_reset,pwfeedback" > /etc/sudoers.d/wheel | |||||
echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers.d/wheel | |||||
echo "$username $hostname =NOPASSWD: /sbin/shutdown ,/sbin/halt,/sbin/reboot,/sbin/hibernate, /bin/pacman -Syyuw --noconfirm" >> /etc/sudoers.d/wheel | |||||
ln -sf /bin/dash /bin/sh | |||||
clear | |||||
echo "SETUP COMPLETE" | |||||
bash | |||||
rm -rf /install |
@ -0,0 +1,25 @@ | |||||
efibootmgr | |||||
refind | |||||
python | |||||
git | |||||
vim | |||||
pulseaudio | |||||
xorg | |||||
xorg-server | |||||
xorg-xinit | |||||
xorg-apps | |||||
xf86-video-intel | |||||
sudo | |||||
wget | |||||
curl | |||||
dash | |||||
mksh | |||||
acpi | |||||
dbus | |||||
syslog-ng | |||||
connman | |||||
avahi-openrc | |||||
acpi-openrc | |||||
dbus-openrc | |||||
syslog-ng-openrc | |||||
connman-openrc |
@ -0,0 +1,282 @@ | |||||
#!/bin/bash | |||||
export NC='\033[0m' | |||||
export RED='\033[0;31m' | |||||
export GREEN='\033[0;32m' | |||||
export ORANGE='\033[0;33m' | |||||
export BLUE='\033[0;34m' | |||||
export PURPLE='\033[0;35m' | |||||
export CYAN='\033[0;36m' | |||||
export LIGHTGRAY='\033[0;37m' | |||||
export DARKGRAY='\033[1;30m' | |||||
export LIGHTRED='\033[1;31m' | |||||
export LIGHTGREEN='\033[1;32m' | |||||
export YELLOW='\033[1;33m' | |||||
export LIGHTBLUE='\033[1;34m' | |||||
export LIGHTPURPLE='\033[1;35m' | |||||
export LIGHTCYAN='\033[1;36m' | |||||
export WHITE='\033[1;37m' | |||||
verbose=0 | |||||
info(){ | |||||
printf "[\e[32mINFO\e[0m]:%s\n" "$1" | |||||
} | |||||
debug(){ | |||||
if [ $verbose ]; then | |||||
printf "[\e[33mDEBUG\e[0m]:%s\n" "$1" | |||||
fi | |||||
} | |||||
error(){ | |||||
printf "[\e[31mERROR\e[0m]:%s\n" "$1" | |||||
} | |||||
prompt(){ | |||||
printf "[\e[35mPROMPT\e[0m]: %s" "$1" | |||||
read -r ans | |||||
printf "%s" "$ans" | |||||
} | |||||
install_deps(){ | |||||
info "Installing dependencies" | |||||
sudo pacman -Sy --needed --noconfirm git tmux 2> /dev/null > /dev/null | |||||
} | |||||
banner(){ | |||||
echo "${CYAN} | |||||
dP dP .d888888 .d888888 .d88888b .d88888b | |||||
Y8. .8P d8' 88 d8' 88 88. \"' 88. \"' | |||||
Y8aa8P 88aaaaa88a 88aaaaa88a \`Y88888b. \`Y88888b. | |||||
88 88 88 88 88 \`8b \`8b | |||||
88 88 88 88 88 d8' .8P d8' .8P | |||||
dP 88 88 88 88 Y88888P Y88888P | |||||
${NC}" | |||||
echo " ${PURPLE}Yeet's Automated Arch Setup Script${NC}" | |||||
} | |||||
help(){ | |||||
echo " | |||||
${GREEN} Usage:${NC}\n | |||||
-o Select the OS you are installing this on | |||||
${ORANGE}Author:${NC} Yigit Colakoglu aka. ${BLUE}<===8 Fr1nge 8===>${NC}\n" | |||||
exit 0 | |||||
} | |||||
os="" | |||||
while [[ $# -gt 0 ]] | |||||
do | |||||
key="$1" | |||||
case $key in | |||||
-o|--os) | |||||
os="$(echo "$2" | tr '[:upper:]' '[:lower:]')" | |||||
shift 2 | |||||
;; | |||||
-v|--verbose) | |||||
verbose=1 | |||||
shift | |||||
;; | |||||
*) | |||||
help | |||||
;; | |||||
esac | |||||
done | |||||
if [ "$os" = "" ]; then | |||||
os=$(prompt "Please enter the OS you want to install on(Arch/Artix): " | tr '[:upper:]' '[:lower:]') | |||||
fi | |||||
if [ ! "$os" = "arch" ] && [ ! "$os" = "artix" ]; then | |||||
error "OS must be Arch or Artix" | |||||
exit 1 | |||||
fi | |||||
# Disk setup | |||||
lsblk | |||||
device=$(prompt "What is the install device: ") | |||||
info "Installing to $device... (Enter to continue)" | |||||
read -r _ | |||||
clear | |||||
wipe=$(prompt "Would you like to wipe and re-partition the disk $device?(Y/n): ") | |||||
if [ ! "$wipe" = "n" ]; then | |||||
# Disk wipe | |||||
secure=$(prompt "Should I do a secure wipe?(y/N): ") | |||||
if [ "$secure" = "y" ]; then | |||||
info "Writing random data to disk, this might take a while if you have a large drive..." | |||||
cryptsetup open -q --type plain -d /dev/urandom "$device" wipe | |||||
dd if=/dev/zero of=/dev/mapper/wipe status=progress | |||||
cryptsetup -q close wipe | |||||
fi | |||||
info "Wiping the partition table..." | |||||
cryptsetup erase "$device" | |||||
wipefs -a -f "$device" | |||||
sleep 1 | |||||
fi | |||||
clear | |||||
# Run cfdisk for manual partitioning | |||||
cfdisk "$device" | |||||
clear | |||||
sleep 2 | |||||
[ ! "$(command -v partprobe)" = "" ] && partprobe | |||||
lsblk "$device" | |||||
satisfied=$(prompt "Are you satisfied with your partitions?(Y/n): ") | |||||
while [ "$satisfied" = "n" ]; do | |||||
cfdisk "$device" | |||||
clear | |||||
[ ! "$(command -v partprobe)" = "" ] && partprobe | |||||
lsblk "$device" | |||||
satisfied=$(prompt "Are you satisfied with your partitions?(Y/n): ") | |||||
done | |||||
clear | |||||
lsblk "$device" | |||||
echo "" | |||||
echo "Now you will specify the partitions you have created" | |||||
echo "Please enter the suffix for each partition. For Ex:" | |||||
echo "1 if boot partition is /dev/sda1 or p1 if boot is on /dev/nvme0n1p1 and the disk is /dev/nvme0n1" | |||||
boot_p=$(prompt "Please enter boot partition suffix: ") | |||||
root_p=$(prompt "Please enter root partition suffix: ") | |||||
swap_p=$(prompt "Please enter swap partition suffix: ") | |||||
boot=$device$boot_p | |||||
root=$device$root_p | |||||
swap=$device$swap_p | |||||
if [ -z "$home_s" ]; then | |||||
home_s=$(prompt "Did you create a home partition as well?(y/N): ") | |||||
fi | |||||
if [ "$home_s" = "y" ]; then | |||||
home_p=$(prompt "Please enter home partition suffix: ") | |||||
home=$device$home_p | |||||
fi | |||||
clear | |||||
# Create the boot partition | |||||
info "Formatting boot partition" | |||||
mkfs.fat -F32 "$boot" | |||||
encryption=$(prompt "Would you like to enrypt your disks?(y/N): ") | |||||
if [ "$encryption" = "y" ]; then | |||||
clear | |||||
info "Running benchmark" | |||||
cryptsetup benchmark | |||||
cipher=$(prompt "Please select the ciphering algorithm(aes-xts-plain64): ") | |||||
if [ "$cipher" = "" ]; then | |||||
cipher="aes-xts-plain64" | |||||
fi | |||||
iter=$("Please select the iter time(750): ") | |||||
if [ "$iter" = "" ]; then | |||||
iter="750" | |||||
fi | |||||
keysize=$("Please select the key size(512): ") | |||||
if [ "$keysize" = "" ]; then | |||||
keysize="512" | |||||
fi | |||||
# Create the swap partition | |||||
mkdir /root/.keys | |||||
dd if=/dev/urandom of=/root/.keys/swap-keyfile bs=1024 count=4 | |||||
chmod 600 /root/.keys/swap-keyfile | |||||
cryptsetup --key-size "$keysize" --cipher "$cipher" --iter-time "$iter" -q luksFormat "$swap" < /root/.keys/swap-keyfile | |||||
info "Keyfile saved to /root/.keys/swap-keyfile" | |||||
cryptsetup open --key-file="/root/.keys/swap-keyfile" "$swap" swap | |||||
mkswap /dev/mapper/swap | |||||
swapon /dev/mapper/swap | |||||
# Create the root partition | |||||
root_pass="$(prompt "Enter password for root encryption")" | |||||
echo "$root_pass" | cryptsetup --key-size "$keysize" --cipher "$cipher" --iter-time "$iter" -q luksFormat "$root" | |||||
dd bs=512 count=4 if=/dev/random of=/root/.keys/root-keyfile iflag=fullblock | |||||
chmod 600 /root/.keys/root-keyfile | |||||
echo "$root_pass" | cryptsetup luksAddKey "$root" /root/.keys/root-keyfile | |||||
echo "[INFO]: Keyfile saved to /root/.keys/root-keyfile" | |||||
cryptsetup open --key-file="/root/.keys/root-keyfile" "$root" root | |||||
mkfs.ext4 -F /dev/mapper/root | |||||
mkdir /mnt/sys | |||||
mount /dev/mapper/root /mnt/sys | |||||
if [ "$home_s" = "y" ]; then | |||||
home_pass="$(prompt "Enter password for home encryption")" | |||||
echo "$home_pass" | cryptsetup --key-size "$keysize" --cipher "$cipher" --iter-time "$iter" -q luksFormat "$home" | |||||
dd bs=512 count=4 if=/dev/random of=/root/.keys/home-keyfile iflag=fullblock | |||||
chmod 600 /root/.keys/home-keyfile | |||||
echo "$home_pass" | cryptsetup luksAddKey "$home" /root/.keys/home-keyfile | |||||
echo "[INFO]: Keyfile saved to /root/.keys/home-keyfile" | |||||
cryptsetup open --key-file="/root/.keys/home-keyfile" "$home" home | |||||
mkfs.ext4 -F /dev/mapper/home | |||||
mkdir /mnt/sys/home | |||||
mount "/dev/mapper/home" /mnt/sys/home | |||||
fi | |||||
else | |||||
mkswap "$swap" | |||||
swapon "$swap" | |||||
mkfs.ext4 -F "$root" | |||||
mkdir /mnt/sys | |||||
mount "$root" /mnt/sys | |||||
if [ "$home_s" = "y" ]; then | |||||
mkfs.ext4 -F "$home" | |||||
mkdir /mnt/sys/home | |||||
mount "$home" /mnt/sys/home | |||||
fi | |||||
fi | |||||
mkdir /mnt/sys/boot | |||||
mount "$boot" /mnt/sys/boot | |||||
clear | |||||
mkdir /mnt/sys/install | |||||
case $os in | |||||
arch) | |||||
pacstrap /mnt/sys base linux linux-firmware base-devel vi nano | |||||
genfstab -U /mnt/sys >> /mnt/sys/etc/fstab | |||||
curl https://raw.githubusercontent.com/theFr1nge/YAASS/main/arch/pkg.list > /mnt/sys/install/packages.base | |||||
curl https://raw.githubusercontent.com/theFr1nge/YAASS/main/arch/stage2.sh > /mnt/sys/install/stage2.sh | |||||
;; | |||||
artix) | |||||
basestrap /mnt/sys base linux linux-firmware base-devel vi nano openrc | |||||
fstabgen -U /mnt/sys >> /mnt/sys/etc/fstab | |||||
curl https://raw.githubusercontent.com/theFr1nge/YAASS/main/artix/pkg.list > /mnt/sys/install/packages.base | |||||
curl https://raw.githubusercontent.com/theFr1nge/YAASS/main/artix/stage2.sh > /mnt/sys/install/stage2.sh | |||||
;; | |||||
esac | |||||
chmod +x /mnt/sys/install/stage2.sh | |||||
tmpfs_ok=$(prompt "Would you like to use tmpfs (This can drastically improve performance)?(Y/n): ") | |||||
if [ ! "$tmpfs_ok" = "n" ]; then | |||||
tmpfs_size=$("How big should the tmpfs be?(end with G or M): ") | |||||
printf "\n#tmpfs\ntmpfs /tmp tmpfs rw,nodev,nosuid,size=%s 0 0\n" "$tmpfs_size" >> /mnt/sys/etc/fstab | |||||
fi | |||||
clear | |||||
if [ ! "$encryption" = "n" ]; then | |||||
cp -r /root/.keys /mnt/sys/root | |||||
fi | |||||
if [ "$os" = "arch" ];then | |||||
if [ "$home_s" = "y" ]; then | |||||
tmux new-session -s "arch-setup" "arch-chroot /mnt/sys /install/stage2.sh \"$boot\" \"$root\" \"$swap\" \"$home\"" || arch-chroot /mnt/sys /install/stage2.sh "$boot" "$root" "$swap" "$home" | |||||
else | |||||
tmux new-session -s "arch-setup" "arch-chroot /mnt/sys /install/stage2.sh \"$boot\" \"$root\" \"$swap\"" || arch-chroot /mnt/sys /install/stage2.sh "$boot" "$root" "$swap" | |||||
fi | |||||
else | |||||
if [ "$home_s" = "y" ]; then | |||||
tmux new-session -s "artix-setup" "artix-chroot /mnt/sys /install/stage2.sh \"$boot\" \"$root\" \"$swap\" \"$home\"" || artix-chroot /mnt/sys /install/stage2.sh "$boot" "$root" "$swap" "$home" | |||||
else | |||||
tmux new-session -s "artix-setup" "artix-chroot /mnt/sys /install/stage2.sh \"$boot\" \"$root\" \"$swap\"" || artix-chroot /mnt/sys /install/stage2.sh "$boot" "$root" "$swap" | |||||
fi | |||||
fi |