forked from MichaIng/DietPi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prep
executable file
·40 lines (29 loc) · 875 Bytes
/
prep
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
#!/bin/bash
if [ ! -e "$1" ] ; then
exit
fi
# at least TinkerOS image is smaller than parition end (but not fs end), so make partprobe happy
while ! partprobe $1 ; do
dd if=/dev/zero bs=1M count=100 >> $1
done
# should call "losetup -f" to get a free device name but then it'd have to be passed to "post" script too
losetup /dev/loop7 $1
partprobe /dev/loop7
rm -rf m
mkdir m
# mount partitions
mount /dev/loop7p2 m
mount /dev/loop7p1 m/boot
# /proc is needed for systemctl (which will then understand it's inside chroot and do nothing)
mount null -t proc m/proc
# qemu
cp $(which qemu-arm-static) m/usr/bin/
# main script
cp PREP_SYSTEM_FOR_DIETPI.sh m/root/
chmod 755 m/root/PREP_SYSTEM_FOR_DIETPI.sh
# TinkerOS-specific
rm m/md5sum.txt
#rm m/var/lib/dpkg/info/bluez.prerm
#rm m/var/lib/dpkg/info/acpid.prerm
# ready to roll
chroot m qemu-arm-static /bin/bash