-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path04-debootstrap-stage-2.sh
executable file
·66 lines (45 loc) · 1.43 KB
/
04-debootstrap-stage-2.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
60
61
62
63
64
65
#!/bin/bash
# On the Chromebook
DEV=/dev/mmcblk1
MNT=/mnt
# Chroot into the SD card, and perform the second debootstrap stage
umount ${DEV}p[1-5]
mount ${DEV}p4 ${MNT}
[[ ${?} -eq 0 ]] || exit 1;
# Bind the following special filesystems for use in the chroot
mount --bind /dev/ ${MNT}/dev/
[[ ${?} -eq 0 ]] || exit 1;
mount --bind /proc/ ${MNT}/proc/
[[ ${?} -eq 0 ]] || exit 1;
mount --bind /sys/ ${MNT}/sys/
[[ ${?} -eq 0 ]] || exit 1;
chroot ${MNT} /debootstrap/debootstrap --second-stage
[[ ${?} -eq 0 ]] || exit 1;
# Setup /etc/fstab for the two unencrypted partitions
cat > ${MNT}/etc/fstab <<EOF
${DEV}p4 / ext4 errors=remount-ro 0 1
${DEV}p3 /boot/ ext2 errors=remount-ro 0 1
EOF
# Populate the /etc/apt/sources.list with target = wheezy
cat > ${MNT}/etc/apt/sources.list <<EOF
deb http://ftp.ca.debian.org/debian wheezy main non-free contrib
deb-src http://ftp.ca.debian.org/debian wheezy main non-free contrib
EOF
# Update the packages
chroot ${MNT} apt-get update
[[ ${?} -eq 0 ]] || exit 1;
chroot ${MNT} apt-get upgrade
[[ ${?} -eq 0 ]] || exit 1;
# Install useful packages
chroot ${MNT} apt-get install wpasupplicant iw upower cryptsetup
echo "yourhostname" > ${MNT}/etc/hostname
# Set the root password
chroot ${MNT} passwd
# Copy over built-in wireless firmware
mkdir ${MNT}/lib/firmware/mrvl/
cp /lib/firmware/mrvl/* ${MNT}/lib/firmware/mrvl/
umount ${MNT}/dev/
umount ${MNT}/proc/
umount ${MNT}/sys/
umount ${MNT}
exit 0