-
Notifications
You must be signed in to change notification settings - Fork 0
/
myinstall.sh
113 lines (95 loc) · 3.78 KB
/
myinstall.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
#!/bin/sh
sudo add-apt-repository multiverse
sudo apt update
sudo apt install curl arch-install-scripts
# Disk Partitioning and mount
lsblk
read -p "Installation Device: " HARDDRIVE
sudo gdisk $HARDDRIVE
read -p "Install Partition Number: " PARTNO
echo '-writing new filesystem'
sudo mkfs.btrfs -f -n 64K $HARDDRIVE$PARTNO
echo '-mounting filesystem'
sudo mount $HARDDRIVE$PARTNO /mnt
lsblk
read -p "EFI Partition: " BOOTPART
mkdir -p /mnt/boot/efi
mount $BOOTPART /mnt/boot/efi
# Download verify and install bootstrap
echo '-fetching bootstrap and keys'
curl -O http://mirror.rackspace.com/archlinux/iso/latest/archlinux-bootstrap-$(date +%Y.%m).01-x86_64.tar.gz
curl -O http://mirror.rackspace.com/archlinux/iso/latest/archlinux-bootstrap-$(date +%Y.%m).01-x86_64.tar.gz.sig
curl -O http://mirror.rackspace.com/archlinux/iso/latest/md5sums.txt
curl -O http://mirror.rackspace.com/archlinux/iso/latest/sha1sums.txt
echo '-verifying keys'
gpg --keyserver pgp.mit.edu --keyserver-options auto-key-retrieve --verify archlinux-bootstrap-$(date +%Y.%m).01-x86_64.tar.gz.sig
md5sum -c md5sums.txt
sha1sum -c sha1sums.txt
sleep 5s
echo '-extracting bootstrap'
sudo tar -xzvf archlinux-bootstrap-$(date +%Y.%m).01-x86_64.tar.gz -C /mnt
sudo mv /mnt/root.x86_64/* /mnt
sudo cp postinstall-gnome.sh /mnt
sudo mkdir /boot/efi
echo '-setting network'
read -p "Hostname: " $MYHOSTNAME
echo $MYHOSTNAME > /mnt/etc/hostname
echo 127.0.0.1 localhost >> /mnt/etc/hosts
echo ::1 localhost >> /mnt/etc/hosts
echo 127.0.1.1 $MYHOSTNAME.localdomain $MYHOSTNAME >> /mnt/etc/hosts
sudo vi /mnt/etc/pacman.d/mirrorlist
genfstab -U /mnt >> /mnt/etc/fstab
# Chroot
sudo mount --bind /mnt /mnt
cd /mnt
sudo cp /etc/resolv.conf /mnt/etc
sudo mount -t proc /proc proc
sudo mount --make-rslave --rbind /sys sys
sudo mount --make-rslave --rbind /dev dev
sudo mount --make-rslave --rbind /run run # (assuming /run exists on the system)
sudo cat << EOF | sudo chroot /mnt /bin/bash
# Base Config
ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
hwclock --systohc
echo en_GB.UTF-8 UTF-8 >> /etc/locale.gen
echo en_US.UTF-8 UTF-8 >> /etc/locale.gen
echo LANG=en_GB.UTF-8 > /etc/locale.conf
locale-gen
echo KEYMAP=uk > /etc/vconsole.conf
vi /etc/pacman.d/mirrorlist
pacman-key --init
pacman-key --populate archlinux
pacman -Syy
# Base Packages
echo -ne '\n' | pacman -S --noconfirm base base-devel elinks efibootmgr bluez wpa_supplicant openvpn dialog grub efibootmgr e2fsprogs lz4 git
lsblk
mkdir /boot/grub
sed -i 's/COMPRESSION="gzip"/#COMPRESSION="gzip"/' /etc/mkinitcpio.conf
sed -i 's/#COMPRESSION="lz4"/COMPRESSION="lz4"/' /etc/mkinitcpio.conf
mkinitcpio -p linux
grub-mkconfig -o /boot/grub/grub.cfg
grub-install --target=x86_64-efi --efi-directory=/boot/grub/efi --bootloader-id=GRUB
EOF
read -p "Username: " USERNAME
sudo chroot /mnt /usr/bin/useradd -b /home -G wheel -m $USERNAME
sudo chroot /mnt /usr/bin/passwd $USERNAME
echo "Password for Root:"
sudo chroot /mnt /usr/bin/passwd
sudo chroot /mnt /usr/bin/visudo
read -p "Desktop Environment (1 for mate, 2 for gnome, 3 for kde):" DECHOICE
if [[ "$DECHOICE" == "1" ]]; then
sudo chroot /mnt /usr/bin/pacman -S --noconfirm mate-extra connman xorg-server mate-media mate-power-manager system-config-printer blueman arc-gtk-theme arc-icon-theme mate-utils eom lightdm lightdm-gtk-greeter
sudo cp postinstall-mate.sh /mnt/home/$USERNAME
fi
if [[ "$DECHOICE" == "2" ]]; then
sudo chroot /mnt /usr/bin/pacman -S --noconfirm gnome networkmanager
sudo systemctl enable gdm
sudo systemctl disable netctl
sudo systemctl enable networkmanager
sudo cp postinstall-gnome.sh /mnt/home/$USERNAME
fi
if [[ "$DECHOICE" == "3" ]]; then
sudo chroot /mnt /usr/bin/pacman -s --noconfirm plasma xorg kde-appplications
sudo cp postinstall-kde.sh /mnt/home/$USERNAME
fi
sudo cat postinstall.sh >> /mnt/home/$USERNAME/postinstall*