forked from krushndayshmookh/krushn-arch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·151 lines (126 loc) · 5.11 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#! /bin/bash
set -e # Stop script on error
# 'TGTDEV=/dev/sda bash install.sh' <--(example use of this script)
# This is my Arch Linux Installation Script.
# Forked from krushndayshmookh.github.io/krushn-arch.
echo
echo "Wilson's Auto-Arch Installation Script!"
echo
echo "Set up network connection, This script will fail otherwise."
echo "Press any key to continue or Ctrl+C to cancel..."
read tmpvar
echo
# Set up time
timedatectl set-ntp true
echo
echo "Now the time will be synced"
echo
# Filesystem mount warning
echo "This script will create and format the partitions as follows:"
echo "${TGTDEV}1 - 512Mb will be mounted as /boot/efi"
echo "${TGTDEV}2 - rest of space will be mounted as /"
read -p 'Continue? [y/N]: ' fsok
if ! [ $fsok = 'y' ] && ! [ $fsok = 'Y' ]
then
echo "Edit the script to continue..."
exit
fi
# to create the partitions programatically (rather than manually)
# we're going to simulate the manual input to fdisk
# The sed script strips off all the comments so that we can
# document what we're doing in-line with the actual commands
# Note that a blank line (commented as "defualt" will send a empty
# line terminated with a newline to take the fdisk default.
sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk ${TGTDEV}
g # clear the in memory partition table, and make a new gpt one
n # new partition
1 # partition number 1
# default - start at beginning of disk
+512M # 512MB boot parttion
t # type of partition
1 # partition type 1 'efi'
n # new partition
2 # partition number 2
# default, start immediately after preceding partition
+32G # 32Gib root partition
t # type of partition
2 # partition number 2
24 # partition type 24 'Linux root (x86-64)'
n # new partition
3 # partition number 3
# default, start immediately after preceding partition
# default, Go to the end of the disk
t # type of partition
3 # partition number 3
28 # partition type 28 'Linux Home'
p # print the in-memory partition table
w # write the partition table
EOF
# Format the partitions
mkfs.fat -F32 ${TGTDEV}1
mkfs.ext4 ${TGTDEV}2
mkfs.ext4 ${TGTDEV}3
################################
# echo
# echo "Initiate pacman keyrings"
# echo
#
# # Initate pacman keyring
# pacman-key --init
# pacman-key --populate archlinux
# pacman-key --refresh-keys
################################
# ^^^ commented all this out as it somehow deleted my mirrorlist maybe?
# luke smith also doesnt do this
echo
echo "Mount the partitions"
echo
# Mount the partitions
mount ${TGTDEV}2 /mnt
mkdir -pv /mnt/boot/efi
mount ${TGTDEV}1 /mnt/boot/efi
echo
echo "Installing and running reflector for sorting the mirrorslist. Will keep a backup of the old one incase you-know-what hits the fan."
echo
# Install reflector for sorting mirrors
pacman -Sy reflector
# Store a backup of the mirrors that came with the installation
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
# Get the fastest in-sync (up-to-date) mirrors and store 10 of them (sorted) in mirrorlist
reflector -l 200 -f 10 --sort score > /etc/pacman.d/mirrorlist
# Install Arch Linux
echo "Starting install.."
echo "About to install Arch Linux, OpenBox with Gnome Terminal, Thunar, and GRUB2 as bootloader using pacstrap."
echo "Press any key to continue or Ctrl+C to cancel... (Note: If you cancel while packages are downloading you should be able to restart this scrip without issue, but if pacstrap is cancelled during installation, bad things might happen and you may need to reformat and start over from the beginning of this scrpit)"
read tmpvar
echo
# minimal pacstrap option
# pacstrap /mnt base base-devel linux linux-firmware intel-ucode nano
# lightdm lightdm-pantheon-greeter
pacstrap /mnt base base-devel linux linux-firmware nano zsh grub intel-ucode efibootmgr os-prober xorg-server xorg-xinit mesa xf86-video-intel git neovim exa tigervnc openssh dosfstools network-manager-applet freetype2 fuse2 networkmanager mtools iw wpa_supplicant dialog pulseaudio xorg-xrandr openbox gnome-terminal firefox thunar neofetch sl figlet cowsay nitrogen tint2 lxappearance
echo
echo "Generating the fstab file, this determines what drives are mounted at boot"
echo
# Generate fstab
genfstab -U /mnt >> /mnt/etc/fstab
echo
echo "Copying the post-install system configuration script to new /root in preperation for arch-chroot"
echo
# Copy post-install system configuration scripts to new / (or currently /mnt for us before chroot)
cp -rfv post-install.sh /mnt/
chmod a+x /mnt/post-install.sh
cp -rfv post-post-install.sh /mnt/
chmod a+x /mnt/post-post-install.sh
echo
echo "You are now ready to change your root directory from your installation media to the drive that you are installing to!"
echo "Press any key to continue or Ctrl+C to cancel..."
read tmpvar
echo
# Chroot into new system
echo "After chrooting into newly installed OS, please run the post-install.sh by executing ./post-install.sh"
echo "Press any key to chroot..."
read tmpvar
arch-chroot /mnt /bin/zsh
# Finish
echo
echo "This installation script is now finished! You now need to run post-install.sh, if that script is run successfully you will now have a fully working bootable Arch Linux system installed."