Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- set -e
- # Architecture
- ARCH=amd64
- # Linux release
- RELEASE=bionic
- # Partition labels
- PARTITION_NAME=dave
- PARTITION_SEC_NAME=davesecure
- ############################
- # END OF USER CONFIG OPTIONS
- ############################
- # Partition numbers
- PARTBOOT=1
- PART1=2
- PART2=3
- function chroot_run {
- chroot $MNTUSB /bin/bash -c "$@"
- }
- function prted {
- parted -s $DEVICE $@
- }
- lsblk
- read -p 'Device? (ex: /dev/sdb): ' DEVICE
- # Create partitions
- prted $DEVICE mklabel gpt
- prted mkpart ESP fat32 1MiB 512MiB
- prted name 1 EFI
- prted set 1 esp on
- prted mkpart primary ext4 512MiB 10000MiB
- prted name 2 LINUX
- prted set 2 msftdata on
- prted mkpart primary ext4 10000MiB 100%
- sync
- mkfs.ext4 -F $DEVICE$PART1 -L $NAME
- mkfs.vfat -F 32 $DEVICE$PARTBOOT
- # Mount everything
- if [ ! -d $MNTUSB ]
- then
- mkdir $MNTUSB
- fi
- mount $DEVICE$PART1 $MNTUSB
- mkdir -p $MNTUSB/efi
- mount $DEVICE$PARTBOOT $MNTUSB/efi
- # Install
- debootstrap --arch $ARCH $RELEASE $MNTUSB
- mount -t proc none $MNTUSB/proc
- mount --bind /sys $MNTUSB/sys
- mount --bind /dev $MNTUSB/dev
- chroot_run "echo ${HOSTNAME} > /etc/hostname"
- chroot_run "apt-get install -y --allow-unauthenticated locales"
- chroot_run "dpkg-reconfigure locales"
- chroot_run "apt-get install -y --allow-unauthenticated net-tools vim linux-base linux-image-amd64 cryptsetup util-linux parted build-essential grub-efi-amd64"
- chroot_run "dpkg-reconfigure tzdata"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement