aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/debootstrap01.sh
blob: 9c33ebedd3775decc51b4255ba94bb1cc3b1f6ca (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
70
71
72
73
74
75
76
77
78
79
80
81
#! /bin/sh

. ./settings00.sh

#
# Build ZFS from scratch requirements
#
apt-get install build-essential autoconf libtool gawk alien fakeroot gdebi linux-headers-amd64
apt-get install zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev libssl-dev parted lsscsi wget ksh gdebi
apt-get install python3 python3-dev python3-setuptools python3-cffi

# 
# debootstrap and iso-image requirements
#
apt-get install \
    debootstrap xorriso live-build syslinux isolinux squashfs-tools genisoimage memtest86+ \
    rsync

rm -f $STRAPBALL
rm -rf $STRAPROOT
mkdir -p $STRAPROOT

mkdir -p $STRAPROOT/var/tmp
chmod 1777 $STRAPROOT/var/tmp

debootstrap --arch=amd64 --variant=buildd \
   --include=net-tools,ifupdown,isc-dhcp-client,vim,openssh-server,locales,rsync,sharutils,psmisc,htop,iftop,patch,less \
   --components main,contrib,non-free bullseye $STRAPROOT

echo $MYHOSTNAME > $STRAPROOT/etc/hostname

mkdir -p $STRAPROOT/etc/network
echo "auto lo" >> $STRAPROOT/etc/network/interfaces
echo "iface lo inet loopback" >> $STRAPROOT/etc/network/interfaces
echo "#auto enp6s0" >> $STRAPROOT/etc/network/interfaces
echo "#allow-hotplug enp6s0" >> $STRAPROOT/etc/network/interfaces
echo "#iface enp6s0 inet dhcp" >> $STRAPROOT/etc/network/interfaces

echo "deb http://deb.debian.org/debian bullseye main contrib non-free" > $STRAPROOT/etc/apt/sources.list
echo "deb-src http://deb.debian.org/debian bullseye main contrib non-free" >> $STRAPROOT/etc/apt/sources.list
echo "" >> $STRAPROOT/etc/apt/sources.list
echo "deb http://deb.debian.org/debian/ bullseye-updates main non-free contrib" >> $STRAPROOT/etc/apt/sources.list
echo "deb-src http://deb.debian.org/debian/ bullseye-updates main non-free contrib" >> $STRAPROOT/etc/apt/sources.list
echo "" >> $STRAPROOT/etc/apt/sources.list
echo "deb http://security.debian.org/debian-security bullseye-security main contrib" >> $STRAPROOT/etc/apt/sources.list
echo "deb-src http://security.debian.org/debian-security bullseye-security main contrib" >> $STRAPROOT/etc/apt/sources.list
echo "" >> $STRAPROOT/etc/apt/sources.list
# echo "deb http://deb.debian.org/debian/ bullseye-backports main non-free contrib" >> $STRAPROOT/etc/apt/sources.list
# echo "deb-src http://deb.debian.org/debian/ bullseye-backports main non-free contrib" >> $STRAPROOT/etc/apt/sources.list
# echo "" >> $STRAPROOT/etc/apt/sources.list

mount --rbind /dev  $STRAPROOT/dev
mount --rbind /proc $STRAPROOT/proc
mount --rbind /sys  $STRAPROOT/sys
mount --make-rslave $STRAPROOT/dev
mount --make-rslave $STRAPROOT/proc
mount --make-rslave $STRAPROOT/sys
echo
echo "Later we will unmount this via"
echo umount -R $STRAPROOT/dev
echo umount -R $STRAPROOT/proc
echo umount -R $STRAPROOT/sys
echo "cat /proc/mounts | awk '{print \$2}' | grep "^$STRAPROOT" | sort -r | xargs umount"

mkdir -p $STRAPROOT/root/debian-zfs-live
cp -a ../* $STRAPROOT/root/debian-zfs-live

mkdir -p $STRAPROOT/root/debian
if [ -e ../../debian/packages ] ; then
    cp -a ../../debian/packages $STRAPROOT/root/debian/
fi

mkdir -p $STRAPROOT/root/.ssh
cp -a /home/$IMPORTUSERNAME/.ssh/authorized_keys $STRAPROOT/root/.ssh/
cp -a /home/$IMPORTUSERNAME/.vimrc               $STRAPROOT/root/
cp -a /home/$IMPORTUSERNAME/.exrc                $STRAPROOT/root/

echo RUN: chroot $STRAPROOT /bin/bash --login
echo then: cd /root/debian-zfs-live/scripts 
echo to continue the process with debootstrap02.sh etc