early_patch: document ownership for files bind mounted into /home/amnesia
[tails.git] / bin / create-test-iuks
blobdab63eef641993205f43238111c90efc28627c40
1 #!/bin/sh
3 set -e
4 set -u
5 set -x
7 VERSIONS="6.0~testoverlayfs 6.2~testoverlayfs 6.3~testoverlayfs"
8 SOURCE_DATE_EPOCH=$(date --utc '+%s')
9 export SOURCE_DATE_EPOCH
11 [ -d "$TAILS_CHECKOUT" ] || exit 2
13 WORKDIR=$(mktemp -d)
15 for version in $VERSIONS; do
16 ISO_SRC="$WORKDIR/$version"/iso_src
17 for dir in EFI/BOOT isolinux live utils/linux utils/mbr; do
18 mkdir -p "$ISO_SRC/$dir"
19 done
20 SQUASHFS_SRC="$WORKDIR/$version"/squashfs_src
21 mkdir -p "$SQUASHFS_SRC"
22 mkdir -p "$SQUASHFS_SRC"/etc/amnesia "$SQUASHFS_SRC"/usr/share
24 cp -a /usr/share/common-licenses "$SQUASHFS_SRC"/usr/share/
25 mkdir -p "$SQUASHFS_SRC"/usr/share/doc
26 if [ "$version" = '6.0~testoverlayfs' ]; then
27 mkdir -p "$SQUASHFS_SRC"/usr/share/doc/tor
28 echo "Some content" > "$SQUASHFS_SRC"/usr/share/doc/tor/README.Debian
30 if [ "$version" != '6.0~testoverlayfs' ]; then
31 echo "Some content" > "$SQUASHFS_SRC"/some_new_file
32 rm "$SQUASHFS_SRC"/usr/share/common-licenses/BSD
34 if [ "$version" = '6.3~testoverlayfs' ]; then
35 echo "Some content 6.3" > "$SQUASHFS_SRC"/some_new_file_6.3
36 rm "$SQUASHFS_SRC"/usr/share/common-licenses/MPL-1.1
38 cat > "$SQUASHFS_SRC"/etc/os-release <<EOF
39 NAME="Tails"
40 VERSION="$version"
41 EOF
42 mksquashfs \
43 "$SQUASHFS_SRC" \
44 "$ISO_SRC"/live/filesystem.squashfs \
45 -no-progress -noappend -comp xz -Xbcj x86 -b 1024K -Xdict-size 1024K \
46 -all-root
48 echo vmlinuz > "$ISO_SRC"/live/vmlinuz
49 echo initrd > "$ISO_SRC"/live/initrd.img
50 echo isolinux > "$ISO_SRC"/isolinux/isolinux.cfg
51 echo 'filesystem.squashfs' > "$ISO_SRC"/live/Tails.module
52 cp /usr/lib/syslinux/mbr/gptmbr.bin "$ISO_SRC"/utils/mbr/mbr.bin
53 if [ "$version" = '6.0~testoverlayfs' ]; then
54 cp /usr/bin/syslinux "$ISO_SRC"/utils/linux
56 if [ "$version" = '6.3~testoverlayfs' ]; then
57 rm "$ISO_SRC"/utils/mbr/mbr.bin
59 xorriso \
60 -as mkisofs -R -r -J -joliet-long -l -cache-inodes -iso-level 3 \
61 --modification-date=2019112316114600 \
62 -o "$WORKDIR/$version.iso" "$ISO_SRC"
63 done
65 for dest_version in 6.2~testoverlayfs 6.3~testoverlayfs; do
66 echo "Generating IUK file from 6.0~testoverlayfs to $dest_version"
67 sudo su -c \
68 "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH \
69 LC_ALL=C \
70 TMPDIR=\"${TMPDIR:-/tmp}\" \
71 PERL5LIB=\"${TAILS_CHECKOUT:?}/config/chroot_local-includes/usr/src/perl5lib/lib\" \
72 ${TAILS_CHECKOUT:?}/config/chroot_local-includes/usr/src/iuk/bin/tails-create-iuk \
73 --squashfs_diff_name \"${dest_version}.squashfs\" \
74 --old_iso \"$WORKDIR/6.0~testoverlayfs.iso\" \
75 --new_iso \"$WORKDIR/${dest_version}.iso\" \
76 --outfile \"$WORKDIR/Tails_amd64_6.0~testoverlayfs_to_${dest_version}.iuk\""
77 done
79 echo "Generated test IUKS:"
80 ls -lh "$WORKDIR"/*.iuk