-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
55 lines (40 loc) · 1.7 KB
/
Makefile
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
.PHONY: enter iso test
all: iso
enter: .edit.timestamp
cp /etc/resolv.conf edit/etc/
cp /etc/hosts edit/etc/
cp chroot.sh edit/
mount --bind /dev/ edit/dev
chroot edit /chroot.sh
umount edit/dev
touch .enter.timestamp
.edit.timestamp:
mkdir -p mnt
mount -o loop ubuntu.iso mnt
unsquashfs mnt/install/filesystem.squashfs
mv squashfs-root edit
mkdir -p extract-cd
rsync --exclude=/install/filesystem.squashfs -a mnt/ extract-cd
umount mnt
rmdir mnt
touch .edit.timestamp
.enter.timestamp:
touch .enter.timestamp
extract-cd/casper/filesystem.manifest: .edit.timestamp .enter.timestamp
chmod +w extract-cd/casper/filesystem.manifest
chroot edit dpkg-query -W --showformat='${Package} ${Version}\n' > extract-cd/casper/filesystem.manifest
extract-cd/install/filesystem.squashfs: extract-cd/casper/filesystem.manifest
- rm extract-cd/install/filesystem.squashfs
# not working; mksquashfs edit extract-cd/install/filesystem.squashfs -nolzma
mksquashfs edit extract-cd/install/filesystem.squashfs
extract-cd/install/filesystem.size: extract-cd/install/filesystem.squashfs
printf $(sudo du -sx --block-size=1 edit | cut -f1) > extract-cd/install/filesystem.size
extract-cd/md5sum.txt: extract-cd/install/filesystem.squashfs
cd extract-cd; rm md5sum.txt; find -type f -print0 | sudo xargs -0 md5sum | grep -v isolinux/boot.cat > md5sum.txt
ubuntu-custom.iso: extract-cd/md5sum.txt
cd extract-cd; mkisofs -D -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../ubuntu-custom.iso .
iso: ubuntu-custom.iso
test:
qemu -cdrom ubuntu-custom.iso -boot d -m 2048
dist-clean:
rm -Rf edit extract-cd .edit.timestamp .enter.timestamp