-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup_chroot_env.sh
executable file
·59 lines (44 loc) · 1.47 KB
/
setup_chroot_env.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
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" >&2
exit 1
fi
set -e
START_DIR=$(pwd)
VAGRANT_DIR="/vagrant"
CHROOT="./qemu_chroot"
echo "Running debootstrap"
qemu-debootstrap --arch=armhf --variant=minbase --include=sysvinit-core,sysvinit-utils --exclude=systemd jessie $CHROOT http://ftp.debian.org/debian/
# qemu-debootstrap copies this automatically
#echo "Setting up qemu"
#cp /usr/bin/qemu-arm-static ${CHROOT}/usr/bin/
echo "Copying configuration"
cp -r ${VAGRANT_DIR}/config/* ${CHROOT}/
cp -a /etc/resolv.conf ${CHROOT}/etc/
cp -a /etc/apt/sources.list ${CHROOT}/etc/apt/
# TODO why should just include a sane hosts file
echo cp /etc/hosts ${CHROOT}/etc/
echo "Populating /dev"
cp ${VAGRANT_DIR}/makenodes.sh ${CHROOT}/
cd ${CHROOT}/
rm -rf dev/*
./makenodes.sh
rm makenodes.sh
cd $START_DIR
echo "Copying scripts"
cp ${VAGRANT_DIR}/apt_preseed ${CHROOT}/root/
cp ${VAGRANT_DIR}/finalize_chroot_env.sh ${CHROOT}/root/
cp ${VAGRANT_DIR}/init_env.sh ${CHROOT}/root/
#cp ${VAGRANT_DIR}/chroot.sh ${CHROOT}/../
# Downloading fread apt public key
wget -qO - https://fread.ink/fread-apt-key.pub > ${CHROOT}/tmp/fread-apt-key.pub
echo "This is a magic file for scripts to check to know they're in the right chroot env" > ${CHROOT}/etc/fread_qemu_cross_compile_chroot
echo ""
echo "First stage completed!"
echo ""
echo "Now copy in your kernel modules"
echo "and modules.dep file."
echo ""
echo " See README.md for precise instructions"
echo ""
set +e