aboutsummaryrefslogtreecommitdiff
path: root/install.sh
blob: 37f0665326cdf57f40736b3b1a0de912b92de396 (plain)
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
LIGHTGREEN='\033[1;32m'
LIGHTRED='\033[1;91m'
WHITE='\033[1;97m'
MAGENTA='\033[1;35m'
CYAN='\033[1;96m'
NoColor='\033[0m'

printf ${LIGHTGREEN}"Do you want default linux-zen kernel or custom one?\nType 1 for default and 2 for custom:${NoColor}\n"
read _kernelflag

printf ${LIGHTGREEN}"Enter disk label (e.g. sda, nvme0n1p <- p is mandatory in nvme case):${NoColor}\n"
read disk_drive
printf ${LIGHTGREEN}"Enter comma-separated partition numbers (e.g., 5,6 for 5 boot 6 root):${NoColor}\n"
read partitions
IFS=',' read -r -a partition_array <<< "$partitions"
root_drive="$disk_drive${partition_array[1]}"
boot_drive="$disk_drive${partition_array[0]}"

printf ${LIGHTGREEN}"Enter the Hostname you want to use:${NoColor}\n"
read _hostname
printf ${LIGHTGREEN}"Enter the Username you want to use:${NoColor}\n"
read _username
printf ${LIGHTRED}"Enter the password for ROOT:${NoColor}\n"
read -s _rootpasswd
printf ${LIGHTGREEN}"Enter the password for $_username:${NoColor}\n"
read -s _userpasswd

mkfs.fat -F32 /dev/$boot_drive
mkfs.ext4 -F /dev/$root_drive

mount /dev/$root_drive /mnt
mkdir /mnt/boot
mkdir /mnt/home

if [ "$_kernelflag" -eq 1 ]; then
  mkdir /mnt/boot/efi
  mount /dev/$boot_drive /mnt/boot/efi
  sv up ntpd
  pacman -Sy --confirm
  basestrap /mnt base runit seatd-runit linux-zen linux-zen-headers 
  fstabgen -U /mnt >> /mnt/etc/fstab
  cp post_chroot.sh /mnt
elif [ "$_kernelflag" -eq 2 ]; then
  mount /dev/$boot_drive /mnt/boot
  sv up ntpd
  pacman -Sy --confirm
  basestrap /mnt base runit seatd-runit 
  fstabgen -U /mnt >> /mnt/etc/fstab
  cp post_chroot.sh /mnt
else
  printf ${LIGHTRED}"Wrong kernelflag value.${NoColor}\n"
  exit 1
fi

export root_drive
export boot_drive
export _hostname
export _username
export _rootpasswd
export _userpasswd
export _kernelflag

artix-chroot /mnt ./post_chroot.sh