Calendar: remove past event
[tails/test.git] / bin / create-test-iuks
blob6772d3f2ed6daea821cfe819cc5cbb4a25cca414
1 #!/bin/sh
3 set -e
4 set -u
5 set -x
7 VERSIONS="2.0~testoverlayfs 2.2~testoverlayfs 2.3~testoverlayfs"
8 export SOURCE_DATE_EPOCH=$(date --utc '+%s')
10 [ -d "$TAILS_CHECKOUT" ] || exit 2
12 WORKDIR=$(mktemp -d)
14 for version in $VERSIONS; do
15 ISO_SRC="$WORKDIR/$version"/iso_src
16 for dir in EFI/BOOT isolinux live utils/linux utils/mbr; do
17 mkdir -p "$ISO_SRC/$dir"
18 done
19 SQUASHFS_SRC="$WORKDIR/$version"/squashfs_src
20 mkdir -p "$SQUASHFS_SRC"
21 mkdir -p "$SQUASHFS_SRC"/etc/amnesia "$SQUASHFS_SRC"/usr/share
23 cp -a /usr/share/common-licenses "$SQUASHFS_SRC"/usr/share/
24 mkdir -p "$SQUASHFS_SRC"/usr/share/doc
25 if [ "$version" = '2.0~testoverlayfs' ]; then
26 mkdir -p "$SQUASHFS_SRC"/usr/share/doc/tor
27 echo "Some content" > "$SQUASHFS_SRC"/usr/share/doc/tor/README.Debian
29 if [ "$version" != '2.0~testoverlayfs' ]; then
30 echo "Some content" > "$SQUASHFS_SRC"/some_new_file
31 rm "$SQUASHFS_SRC"/usr/share/common-licenses/BSD
33 if [ "$version" = '2.3~testoverlayfs' ]; then
34 echo "Some content 2.3" > "$SQUASHFS_SRC"/some_new_file_2.3
35 rm "$SQUASHFS_SRC"/usr/share/common-licenses/MPL-1.1
37 cat > "$SQUASHFS_SRC"/etc/amnesia/version <<EOF
38 $version - 20380119
39 ffffffffffffffffffffffffffffffffffffffff
40 live-build: 3.0.5+really+is+2.0.12-0.tails2
41 live-boot: 4.0.2-1
42 live-config: 4.0.4-1
43 EOF
44 cat > "$SQUASHFS_SRC"/etc/os-release <<EOF
45 TAILS_PRODUCT_NAME="Tails"
46 TAILS_VERSION_ID="$version"
47 EOF
48 mksquashfs \
49 "$SQUASHFS_SRC" \
50 "$ISO_SRC"/live/filesystem.squashfs \
51 -no-progress -noappend -comp xz -Xbcj x86 -b 1024K -Xdict-size 1024K \
52 -all-root
54 echo vmlinuz > "$ISO_SRC"/live/vmlinuz
55 echo initrd > "$ISO_SRC"/live/initrd.img
56 echo isolinux > "$ISO_SRC"/isolinux/isolinux.cfg
57 echo 'filesystem.squashfs' > "$ISO_SRC"/live/Tails.module
58 cp /usr/lib/syslinux/mbr/gptmbr.bin "$ISO_SRC"/utils/mbr/mbr.bin
59 if [ "$version" = '2.0~testoverlayfs' ]; then
60 cp /usr/bin/syslinux "$ISO_SRC"/utils/linux
62 if [ "$version" = '2.3~testoverlayfs' ]; then
63 rm "$ISO_SRC"/utils/mbr/mbr.bin
65 xorriso \
66 -as mkisofs -R -r -J -joliet-long -l -cache-inodes -iso-level 3 \
67 --modification-date=2019112316114600 \
68 -o "$WORKDIR/$version.iso" "$ISO_SRC"
69 done
71 for dest_version in 2.2~testoverlayfs 2.3~testoverlayfs; do
72 echo "Generating IUK file from 2.0~testoverlayfs to $dest_version"
73 sudo su -c \
74 "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH \
75 LC_ALL=C \
76 TMPDIR=\"${TMPDIR:-/tmp}\" \
77 PERL5LIB=\"${TAILS_CHECKOUT:?}/config/chroot_local-includes/usr/src/perl5lib/lib\" \
78 ${TAILS_CHECKOUT:?}/config/chroot_local-includes/usr/src/iuk/bin/tails-create-iuk \
79 --squashfs_diff_name \"${dest_version}.squashfs\" \
80 --old_iso \"$WORKDIR/2.0~testoverlayfs.iso\" \
81 --new_iso \"$WORKDIR/${dest_version}.iso\" \
82 --outfile \"$WORKDIR/Tails_amd64_2.0~testoverlayfs_to_${dest_version}.iuk\""
83 done
85 echo "Generated test IUKS:"
86 ls -lh "$WORKDIR"/*.iuk