Skip to content

Instantly share code, notes, and snippets.

@naniwaKun
Forked from kunst1080/archsetup.sh
Last active April 19, 2019 17:41
Show Gist options
  • Save naniwaKun/ee44bd7b00c7710e57098506d267ca64 to your computer and use it in GitHub Desktop.
Save naniwaKun/ee44bd7b00c7710e57098506d267ca64 to your computer and use it in GitHub Desktop.
server instal by archlinux iso image on stickpc
NEWHOSTNAME=$1
ROOTPASSWD=$2
# Keymap
loadkeys jp106
# Setup HDD
sudo parted /dev/mmcblk1 mklabel gpt
parted /dev/mmcblk1 mkpart ESP fat32 1MiB 551MiB
parted /dev/mmcblk1 mkpart primary ext4 551MiB 100%
mkfs.ext4 /dev/mmcblk1p2
mkfs.vfat -F32 /dev/mmcblk1p1
# Install Base system
mount /dev/mmcblk1p2 /mnt
mkdir /mnt/boot
mount /dev/mmcblk1p1 /mnt/boot
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
## boot loader
yes | pacman -S grub dosfstools efibootmgr
grub-install --target=i386-efi --efi-directory=/boot --bootloader-id=grub --recheck
mkdir /boot/EFI/boot
cp /boot/EFI/grub/grubia32.efi /boot/EFI/boot/bootia32.efi
grub-mkconfig -o /boot/grub/grub.cfg
## power management
echo HandleLidSwitch=ignore >> /etc/systemd/logind.conf
++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