-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrpi-debootstrap.sh
executable file
·47 lines (34 loc) · 1.16 KB
/
rpi-debootstrap.sh
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
#!/bin/bash
# requires debootstrap, qemu-arm-static
rootfs=$1
dist="stretch"
mirror="http://archive.raspbian.org/raspbian"
include="net-tools,isc-dhcp-client,nano,openssh-server,rsync,wget"
aptsources="deb http://archive.raspbian.org/raspbian stretch main contrib non-free\ndeb-src http://archive.raspbian.org/raspbian stretch main contrib non-free"
if [ "$rootfs" == "" ]; then
echo "No directory to install to given."
exit 1
fi
if [ $EUID -ne 0 ]; then
echo "This tool must be run as root."
exit 1
fi
echo "Executing debootstrap..."
debootstrap --arch armhf --foreign --variant minbase --no-check-gpg --include $include $dist $rootfs $mirror
echo "Preparing for ARM emulation..."
cp /usr/bin/qemu-arm-static $rootfs/usr/bin
echo "Executing second stage debootstrap..."
chroot $rootfs /debootstrap/debootstrap --second-stage
echo "Configuring RootFS..."
echo -e $aptsources > $rootfs/etc/apt/sources.list
cat > $rootfs/etc/apt/apt.conf << EOF
APT::Install-Recommends "0";
APT::Install-Suggests "0";
EOF
cat > $rootfs/etc/network/interfaces << EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
EOF
echo "RootFS installation into '$rootfs' completed."