This repository has been archived by the owner on Jan 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·79 lines (65 loc) · 1.89 KB
/
install
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
76
77
78
79
#!/bin/bash
# script global variables
RED='\033[1;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
BLUE='\033[1;34m'
NC='\033[0m'
# Get partitions
containsElement () {
local e match="$1"
shift
for e; do [[ "$e" == "$match" ]] && return 1; done
return 0
}
# Input partitions
read -p "Enter root partition: " partition_root
read -p "Enter boot partition: " partition_boot
read -p "Enter swap partition: " partition_swap
read -p "Enter hdd partition: " partition_hdd
read -p "Enter windows partition: " partition_windows
# Input username
read -p "Please type your username: " username
read -s -p "Enter new password for ${username}: (input is not visible)" userpw
# Format and mount partitions
echo
echo Mounting created partition onto /mnt
echo "y" | mkfs.ext4 ${partition_root}
mount ${partition_root} /mnt
echo Mounting remaining partitions
if [ "${partition_hdd}" != "" ]; then
mkdir /mnt/hdd
mount ${partition_hdd} /mnt/hdd
fi
if [ "${partition_swap}" != "" ]; then
mkswap ${partition_swap}
swapon ${partition_swap}
fi
# Install arch_linux
echo Installing arch linux into /mnt. This may take some time...
pacstrap /mnt base base-devel linux linux-firmware
echo Finished installing arch linux
# Change pacman mirror
cat /etc/pacman.d/mirrorlist > /mnt/etc/pacman.d/mirrorlist
# Generate file that indicates which partitions to mount on boot
genfstab -U /mnt >> /mnt/etc/fstab
# Chroot into installed linux
echo "#!bin/bash
RED='\033[1;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
BLUE='\033[1;34m'
NC='\033[0m'
partition_root=\"${partition_root}\"
partition_boot=\"${partition_boot}\"
partition_swap=\"${partition_swap}\"
partition_hdd=\"${partition_hdd}\"
partition_windows=\"${partition_windows}\"
username=\"${username}\"
userpw=\"${userpw}\"
" | cat - apply_settings > temp && mv temp apply_settings
chmod +x apply_settings
cp ./apply_settings /mnt
echo
echo Chrooting into /mnt
arch-chroot /mnt /apply_settings