-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
75 lines (75 loc) · 2.7 KB
/
install.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
67
68
69
70
71
72
73
74
75
#!/bin/sh
echo "Welcome to Artix Linux install script!"
echo "Checking for internet connection..."
ping -c 4 gnu.org
echo "Test succesful."
lsblk
echo "What is your swap partition? ex /dev/sda1"
read -r swappart
echo "What is your boot partition? ex /dev/sda2"
read -r bootpart
echo "What is your root partition? ex /dev/sda3"
read -r rootpart
echo "Your partitions will be formatted. ARE YOU SURE THAT YOU WANNA FORMAT YOUR PARTITIONS? (Y/N) " && read formatforsure
case $formatforsure in
"Y") echo "Partitions will be formatted and mounted...";
continue;;
"N") echo "Exiting.";
exit;;
"y") echo "Partitions will be formatted and mounted...";
continue;;
"n") echo "Exiting.";
exit;;
* ) echo "Invalid answer";;
esac
mkswap $swappart
mkfs.fat -F32 $bootpart
mkfs.ext4 $rootpart
mount $rootpart /mnt
mkdir -p /mnt/boot
mount $bootpart /mnt/boot
swapon $swappart
echo "Installing base system..."
basestrap /mnt base base-devel openrc elogind-openrc
echo "Installing kernel..."
basestrap /mnt linux linux-firmware
echo "Generating fstab"
fstabgen -U /mnt >> /mnt/etc/fstab
echo "You will be chrooted into your new system."
echo "Setting up timezone. What is your timezone? ex Europe/Brussels"
read -r timezone
echo "Linking $timezone to /etc/localtime..."
artix-chroot /mnt sh -c "ln -sf /usr/share/zoneinfo/$timezone /etc/localtime"
artix-chroot /mnt sh -c "hwclock --systohc"
echo "Installing nano"
artix-chroot /mnt sh -c "pacman -S nano"
echo "Add your locales in /etc/locale.gen. Opening nano in 5 seconds..."
sleep 5
artix-chroot /mnt sh -c "nano /etc/locale.gen"
locale-gen
echo "Installing bootloader... Default bootloader will be GRUB."
artix-chroot /mnt sh -c "pacman -S grub os-prober efibootmgr"
artix-chroot /mnt sh -c "grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub"
artix-chroot /mnt sh -c "grub-mkconfig -o /boot/grub/grub.cfg"
echo "Changing password for root."
artix-chroot /mnt sh -c "passwd root"
echo "Network Configuration"
echo "Change your hostname. Opening nano in 5 seconds..."
sleep 5
artix-chroot /mnt sh -c "nano /etc/conf.d/hostname"
artix-chroot /mnt sh -c "hostname > /etc/hostname"
artix-chroot /mnt sh -c "printf "127.0.0.1 localhost\n::1 localhost" > /etc/hosts"
echo "Installing DHCP client..."
artix-chroot /mnt sh -c "pacman -S dhcpcd"
ip a
echo "Whats your network interface? Note that "lo" does not count. ex, eth0"
read -r networkinterface
echo "Linking network interface..."
artix-chroot /mnt sh -c "ln -s /etc/init.d/net.lo /etc/init.d/net.$networkinterface"
artix-chroot /mnt sh -c "rc-update add net.$networkinterface default"
echo "Installation of Artix Linux is done! You can reboot your system now."
echo "Unmounting drives..."
umount -l /mnt/boot
umount -R /mnt
echo "Exiting."
exit