Skip to content

Instantly share code, notes, and snippets.

@kunst1080
Created October 19, 2014 12:12
Show Gist options
  • Save kunst1080/c8693227e92e104d7bb0 to your computer and use it in GitHub Desktop.
Save kunst1080/c8693227e92e104d7bb0 to your computer and use it in GitHub Desktop.
Setup ArchLinux
NEWHOSTNAME=$1
ROOTPASSWD=$2
# Keymap
loadkeys jp106
# Setup HDD
parted /dev/sda mklabel gpt
parted /dev/sda mkpart primary btrfs 1049KB 8591MB
parted /dev/sda mkpart primary linux-swap 8591MB 10.7GB
mkfs.btrfs /dev/sda1
mkswap /dev/sda2
swapon /dev/sda2
# Install Base system
mount /dev/sda1 /mnt
grep jp /etc/pacman.d/mirrorlist > mirrorlist
cat /etc/pacman.d/mirrorlist >> mirrorlist
cp mirrorlist /etc/pacman.d/mirrorlist
yes "" | pacstrap -i /mnt base base-devel
# fstab
genfstab -p /mnt >> /mnt/etc/fstab
# Create Setup Script on chroot environment
cat <<++EOS>>/mnt/setup.sh
#!/bin/bash
echo $NEWHOSTNAME >> /etc/hostname
ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
echo en_US.UTF-8 UTF-8 >> /etc/locale.gen
echo ja_JP.UTF-8 UTF-8 >> /etc/locale.gen
locale-gen
echo LANG=en_US.UTF-8 >> /etc/locale.conf
echo KEYMAP=jp106 >> /etc/vconsole.conf
echo root:$ROOTPASSWD | chpasswd
## Network
systemctl enable dhcpcd.service
## boot loader
yes | pacman -S gptfdisk
yes | pacman -S syslinux
syslinux-install_update -iam
sed -i 's%root=/dev/sda[0-9]%root=/dev/sda1%g' /boot/syslinux/syslinux.cfg
++EOS
chmod +x /mnt/setup.sh
# Setup chroot environment
arch-chroot /mnt "/setup.sh"
# end
umount -R /mnt
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment