-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlrc-livecd
executable file
·123 lines (97 loc) · 2.31 KB
/
lrc-livecd
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/usr/bin/env bash
# Directions loosly taken from here: https://help.ubuntu.com/community/MakeALiveCD/DVD/BootableFlashFromHarddiskInstall
#exec 200>/var/lock/lrc-livecd
#flock -n 200 || exit 1
RELEASE=trusty
RELEASE=xenial
if ! test -d /var/chroot/$RELEASE ; then
debootstrap \
--variant=minbase \
--include=grub-pc \
$RELEASE \
/var/chroot/$RELEASE.part \
http://archive.ubuntu.com/ubuntu
mv /var/chroot/$RELEASE.part /var/chroot/$RELEASE
fi
cat << EOF > /var/chroot/$RELEASE/finish-up.sh
#!/usr/bin/env bash
set -x
mount none -t proc /proc
mount none -t sysfs /sys
mount none -t devpts /dev/pts
export HOME=/root
export LC_ALL=C
apt-get update
apt-get upgrade --yes
apt-get install --yes \
btrfs-tools \
casper \
e2fsprogs \
jfsutils \
laptop-detect \
linux-generic \
lupin-casper \
lvm2 \
net-tools \
os-prober \
reiserfsprogs \
squashfs-tools \
ubuntu-standard \
vim \
xfsprogs
update-initramfs -u
update-grub
printf "root\nroot\n" | passwd
umount /proc
umount /sys/kernel/security
umount /sys
umount /dev/pts
EOF
chmod +x /var/chroot/$RELEASE/finish-up.sh
chroot /var/chroot/$RELEASE finish-up.sh
rm -rf cdroot
mkdir -p cdroot/{casper,boot/grub}
mksquashfs /var/chroot/$RELEASE $RELEASE.squashfs.part -noappend && \
mv $RELEASE.squashfs.part cdroot/casper/filesystem.squashfs
cp -r /var/chroot/$RELEASE/boot/* cdroot/boot/.
(
cd cdroot/boot
ln -s $(ls -1 vmlinuz*) vmlinuz
ln -s $(ls -1 initrd.img*) initrd.img
)
cat << EOF > cdroot/boot/grub/grub.cfg
set default="0"
set timeout=20
menuentry "Ubuntu CLI" {
linux /boot/vmlinuz boot=casper textonly
initrd /boot/initrd.img
}
menuentry "Ubuntu GUI" {
linux /boot/vmlinuz boot=casper quiet splash
initrd /boot/initrd.img
}
menuentry "Ubuntu in safe mode" {
linux /boot/vmlinuz boot=casper xforcevesa
initrd /boot/initrd.img
}
menuentry "Ubuntu GUI persistent mode" {
linux /boot/vmlinuz boot=casper persistent quiet splash
initrd /boot/initrd.img
}
menuentry "Ubuntu GUI from RAM" {
linux /boot/vmlinuz boot=casper toram quiet splash
initrd /boot/initrd.img
}
menuentry "Check Disk for Defects" {
linux /boot/vmlinuz boot=casper integrity-check quiet splash
initrd /boot/initrd.img
}
menuentry "Memory Test" {
linux16 /boot/memtest86+.bin
}
menuentry "Boot from the first hard disk" {
set root=(hd0)
chainloader +1
}
EOF
grub-mkrescue -o live-cd.iso cdroot