-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate.sh
executable file
·69 lines (61 loc) · 1.81 KB
/
generate.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
66
67
68
69
#!/bin/bash -xe
sudo ./clean.sh
source ./config.cfg
test -z "$tftproot" -o -z "$image" && echo "Usage: $0 <tftproot> <gentoo-iso>" >&2 && exit 1
test -e "$tmp" && echo "Temporary path '$tmp' already exists." >&2 && exit 1
# prepare directories
mkdir -p "$tmp" "$iso" "$initrd/mnt/cdrom"
# extract files from ISO image
sudo mount -o ro,loop "$image" "$iso"
cp "$iso"/{image.squashfs,isolinux/gentoo,isolinux/gentoo.igz} "$tmp"
sudo umount "$iso"
# patch initramfs and add squashfs to it
xz -dc "$tmp/gentoo.igz" | ( cd "$initrd" && sudo cpio -idv )
sudo patch -d "$initrd" -p0 <<'EOF'
--- init.orig 2018-07-21 18:33:34.528587830 +0300
+++ init 2018-07-21 21:08:15.106424520 +0300
@@ -491,9 +491,9 @@
CHROOT=${NEW_ROOT}
fi
- if [ /dev/nfs != "$REAL_ROOT" ] && [ sgimips != "$LOOPTYPE" ] && [ 1 != "$aufs" ] && [ 1 != "$overlayfs" ]; then
- bootstrapCD
- fi
+# if [ /dev/nfs != "$REAL_ROOT" ] && [ sgimips != "$LOOPTYPE" ] && [ 1 != "$aufs" ] && [ 1 != "$overlayfs" ]; then
+# bootstrapCD
+# fi
if [ "${REAL_ROOT}" = '' ]
then
@@ -558,7 +558,7 @@
REAL_ROOT="${ROOT_DEV}"
else
prompt_user "REAL_ROOT" "root block device"
- got_good_root=0
+ got_good_root=1
continue
fi
;;
@@ -636,7 +636,7 @@
else
bad_msg "Block device ${REAL_ROOT} is not a valid root device..."
REAL_ROOT=""
- got_good_root=0
+ got_good_root=1
fi
done
@@ -718,7 +718,7 @@
[ -z "${LOOP}" ] && find_loop
[ -z "${LOOPTYPE}" ] && find_looptype
- cache_cd_contents
+ #cache_cd_contents
# If encrypted, find key and mount, otherwise mount as usual
if [ -n "${CRYPT_ROOT}" ]
EOF
echo "Unpack image squashfs"
sudo ./unsqfs.sh $tmp $tmp/image.squashfs
if [ $auto -eq 1 ]; then
echo "Add Squashfs tool in image"
sudo ./prepare.sh
sudo ./mkautostart.sh
sudo ./pack_image.sh
sudo ./mkpxeboot.sh
fi