Changes between Initial Version and Version 1 of linux/debootstrap-install


Ignore:
Timestamp:
2020-06-15T14:59:46Z (4 years ago)
Author:
root
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • linux/debootstrap-install

    v1 v1  
     1{{{#!bash
     2export LANG='en_US.UTF-8'
     3export LANGUAGE='en_US.UTF-8'
     4export LC_ALL='en_US.UTF-8'
     5unset LC_ALL
     6
     7lvremove -f vg_main
     8vgremove -f vg_main
     9pvremove /dev/sda2
     10rm -rf /dev/vg_main
     11sgdisk -Z /dev/sda
     12sgdisk -g \
     13 -n 1:0:+4M \
     14 -t 1:ef02 \
     15 -c 1:bios \
     16 -n 2:0:+512M \
     17 -t 2:8300 \
     18 -c 2:boot \
     19 -n 3  \
     20 -t 3:8e00 \
     21 -c 3:main \
     22 /dev/sda
     23pvcreate -f /dev/sda3
     24vgcreate -y -f vg_main /dev/sda3
     25lvcreate -y -L 7G -n lv_swap vg_main
     26lvcreate -y -l 100%FREE -n lv_root vg_main
     27mke2fs -F -t ext3 -m 1 -L boot /dev/sda1
     28mke2fs -F -t ext3 -m 1 -L boot /dev/sda2
     29mke2fs -F -t ext4 -m 1 -L root /dev/vg_main/lv_root
     30mount /dev/vg_main/lv_root /mnt
     31mkdir -vp /mnt/{dev,sys,proc,boot}
     32mount /dev/sda2 /mnt/boot
     33export DEBOOTSTRAP_DIR='/root/debootstrap'
     34curl -o - \
     35 http://ftp.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.123.tar.gz |
     36 tar xzf -
     37debootstrap/debootstrap --include locales,linux-image-amd64,grub-pc --arch amd64 buster /mnt http://mirror.yandex.ru/debian
     38
     39mount -o bind /dev /mnt/dev
     40mount -o bind /sys /mnt/sys
     41mount -o bind /proc /mnt/proc
     42
     43#/mnt/debootstrap/debootstrap.log
     44
     45cat <<EOF >/mnt/etc/fstab
     46/dev/mapper/vg_main-lv_root / ext4 noatime,errors=remount-ro 0 1
     47/dev/sda2 /boot ext3 defaults 0 2
     48/dev/mapper/vg_main-lv_swap none swap sw 0 0
     49EOF
     50mkdir -vp /mnt/etc/network/interfaces.d/ /mnt/root/.ssh/ /mnt/etc/default/grub.d/
     51cat <<EOF >/mnt/etc/network/interfaces
     52source /etc/network/interfaces.d/*
     53auto lo
     54iface lo inet loopback
     55auto eth0
     56iface eth0 inet static
     57 address 192.168.79.23
     58 netmask 24
     59 gateway 192.168.79.2
     60EOF
     61cp -v ~/.ssh/authorized_keys /mnt/root/.ssh/
     62echo xpsvic > /mnt/etc/hostname
     63cat <<EOF > /mnt/etc/default/grub.d/net-ifnames.cfg
     64# set net.ifnames=0
     65GRUB_CMDLINE_LINUX_DEFAULT="\${GRUB_CMDLINE_LINUX_DEFAULT} net.ifnames=0"
     66EOF
     67
     68cat <<EOF >/mnt/etc/apt/sources.list
     69deb http://mirror.corbina.net/debian/ buster main non-free contrib
     70deb-src http://mirror.corbina.net/debian/ buster main non-free contrib
     71deb http://security.debian.org/debian-security buster/updates main contrib non-free
     72deb-src http://security.debian.org/debian-security buster/updates main contrib non-free
     73deb http://mirror.corbina.net/debian/ buster-updates main contrib non-free
     74deb-src http://mirror.corbina.net/debian/ buster-updates main contrib non-free
     75deb http://mirror.corbina.net/debian/ buster-backports main contrib non-free
     76deb-src http://mirror.corbina.net/debian/ buster-backports main contrib non-free
     77EOF
     78
     79echo 'en_US.UTF-8 UTF-8' > /mnt/etc/locale.gen
     80chroot /mnt locale-gen
     81
     82chroot /mnt hostname -F /etc/hostname
     83export DEBIAN_FRONTEND=noninteractive
     84chroot /mnt apt-get update
     85#echo 'GRUB_CMDLINE_LINUX_DEFAULT="--verbose nosplash debug"' >>/mnt/etc/default/grub
     86echo 'GRUB_CMDLINE_LINUX_DEFAULT="--verbose nosplash"' >>/mnt/etc/default/grub
     87chroot /mnt update-initramfs -u
     88chroot /mnt update-grub2
     89
     90# chroot /mnt grub-probe --verbose --device /dev/vg_main/lv_root --target=fs_uuid
     91# chroot /mnt grub-probe --verbose --device /dev/mapper/vg_main-lv_root --target=fs_uuid
     92# grub-probe: info: cannot open `/boot/grub/device.map': No such file or directory.
     93# grub-probe: info: /dev/vg_main/lv_root is not present.
     94#  WARNING: Device /dev/loop0 not initialized in udev database even after waiting 10000000 microseconds.
     95#  WARNING: Device /dev/sda not initialized in udev database even after waiting 10000000 microseconds.
     96#  WARNING: Device /dev/vg_main/lv_swap not initialized in udev database even after waiting 10000000 microseconds.
     97#  WARNING: Device /dev/sda1 not initialized in udev database even after waiting 10000000 microseconds.
     98
     99chroot /mnt grub-install --debug-image=all --boot-directory=/boot /dev/sda
     100chroot /mnt grub-install --debug-image=all --boot-directory=/boot /dev/sda1
     101
     102umount /mnt/sys
     103umount /mnt/proc
     104chroot /mnt apt-get -y install lvm2
     105mount -o bind /dev /mnt/dev
     106chroot /mnt update-initramfs -u
     107umount -R /mnt
     108sync
     109}}}