summaryrefslogtreecommitdiffstats
path: root/arch-install/arch-setup-0.sh
blob: d64c98bd2300c309542610c11b1bf2d5b7151def (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
64
65
66
67
68
69
#! /bin/bash

DEV=/dev/sda

function say()
{
   echo -e "\n$1 *************************************"
}

loadkeys fr_CH

say "EFIVARS"
modprobe -r efivars 2>/dev/null
umount /sys/firmware/efi/efivars 2>/dev/null
modprobe -r efivarfs 2>/dev/null
modprobe efivarfs
mount -t efivarfs efivarfs /sys/firmware/efi/efivars

VARS=$(efivar -l | wc -l)
echo "UEFI VARS : $VARS"
[ $VARS -eq 0 ] && exit 1

# http://www.rodsbooks.com/gdisk/sgdisk-walkthrough.html
# to retreive size info $ sgdisk -p $DEV
# N sectors * 512 / 1024 / 1024 / 1024 -> Gb
say "SGDISK"
sgdisk -og $DEV || exit 1
sgdisk -n 1::+256M -c 1:efi -t 1:ef02 $DEV || exit 1
sgdisk -n 2::+100G -c 2:rootfs -t 2:8300 $DEV || exit 1
sgdisk -n 3:: -c 3:homefs -t 3:8300 $DEV || exit 1
#sgdisk -n 3:209979392:976773168 -c 3:homefs -t 3:8300 $DEV || exit 1
sgdisk -p $DEV || exit 1

say "MKFS"
mkfs.fat -F32 ${DEV}1 || exit 1
mkfs.ext4 -L root ${DEV}2 || exit 1
mkfs.ext4 -L home ${DEV}3 || exit 1
parted $DEV set 1 bios_grub on

say "MOUNT"
mount ${DEV}2 /mnt
mkdir /mnt/boot
mount ${DEV}1 /mnt/boot
mkdir /mnt/home
mount ${DEV}3 /mnt/home

say "SWAPFS"
dd if=/dev/zero of=/mnt/swapfile bs=1M count=512 || exit 1
chmod 600 /mnt/swapfile || exit 1
mkswap /mnt/swapfile || exit 1
swapon /mnt/swapfile || exit 1

say "BASE SYSTEM"
pacman -Sy archlinux-keyring
echo "Server = http://mirror.puzzle.ch/archlinux/\$repo/os/\$arch" > /etc/pacman.d/mirrorlist
pacstrap /mnt base

say "ETC"
genfstab -U -p /mnt >> /mnt/etc/fstab
sed -i 's/\/mnt//' /mnt/etc/fstab
sed -i 's/\/mnt//' /etc/fstab
cp hostname locale.conf vconsole.conf /mnt/etc/
sed -i 's/#fr_CH/fr_CH/; s/#en_GB/en_GB/; s/#en_US/en_US/;' /mnt/etc/locale.gen
sed -i 's/^#\[multilib\]/[multilib]/; T; n; s/^#Include/Include/' /mnt/etc/pacman.conf

cp arch-setup-1.sh /mnt/ || exit 1

say " *** now launch ./arch-setup-1.sh !"
arch-chroot /mnt