-
Notifications
You must be signed in to change notification settings - Fork 0
/
arch-installer.sh
executable file
·66 lines (53 loc) · 2.09 KB
/
arch-installer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
YELLOW=`tput setaf 3`
MAGENTA=`tput setaf 5`
RESET=`tput sgr0`
# Checking for Internet with DNS
if ! ping -q -c 1 -W 1 google.com >/dev/null; then
echo "${MAGENTA}Ensure you are connected to the internet with DNS.${RESET}"
exit
fi
# Ask to Confirm Mountpoints
if ! mountpoint -q -- "/mnt";
then
echo "${MAGENTA}There is no filesystem mounted at /mnt.${RESET}"
exit
elif ! mountpoint -q -- "/mnt/boot";
then
echo "${MAGENTA}There is no filesystem mounted at /mnt/boot.${RESET}"
exit
fi
# Installer pacman Config
echo "${YELLOW}:: ${MAGENTA}Installing pacman config...${RESET}"
sed -i "s/#Color/Color/g" /etc/pacman.conf
sed -i "s/#ParallelDownloads/ParallelDownloads/g" /etc/pacman.conf
sed -i "s/#[multilib]\n#Include = \/etc\/pacman.d\/mirrorlist/[multilib]\nInclude = \/etc\/pacman.d\/mirrorlist/g" /etc/pacman.conf
# Record Hostname for System Specialisations
echo "${MAGENTA}Please Enter a Hostname:${RESET}"
read hostname
# Installing minimum viable system
echo "${YELLOW}:: ${MAGENTA}Installing system...${RESET}"
pacman -Sy --noconfirm archlinux-keyring
pacstrap /mnt ansible base git linux linux-firmware networkmanager sudo vim zsh
# Write Hostname to New System
echo $hostname > /mnt/etc/hostname
echo -e "127.0.0.1\tlocalhost\n::1\tlocalhost\n127.0.1.1\t$hostname.local\t$hostname" > /mnt/etc/hosts
# Genfstab
echo "${YELLOW}:: ${MAGENTA}Generating fstab...${RESET}"
genfstab -U -f /mnt/boot /mnt > /mnt/etc/fstab
# Copying Dotfiles to New System
echo "${YELLOW}:: ${MAGENTA}Copying dotfiles to new system...${RESET}"
rm -rf /mnt/dotfiles
mkdir -p /mnt/dotfiles
shopt -s dotglob nullglob
cp -r ./* /mnt/dotfiles
# Chroot Into New System
echo "${YELLOW}:: ${MAGENTA}Chrooting into new system...${RESET}"
arch-chroot /mnt /dotfiles/.chroot.sh
# Cleaning up Files
rm -rf /mnt/dotfiles
# Configuring Bootloader
echo "${YELLOW}:: ${MAGENTA}Inserting PARTUUID into boot entry...${RESET}"
PARTUUID=$(findmnt /mnt -no PARTUUID)
sed -i "s/PARTUUID=\"/PARTUUID=$PARTUUID\"/g" /mnt/boot/loader/entries/arch.conf
echo "${MAGENTA}Please reboot and continue with the ansible part of the installation.${RESET}"