xref: /aosp_15_r20/external/toybox/mkroot/tar-for-web.sh (revision cf5a6c84e2b8763fc1a7db14496fd4742913b199)
1#!/bin/bash
2
3# tar up completed system images to send to website, with READMEs
4
5rm -f root/toybox-* root/*.tgz
6for i in root/*/fs/bin/toybox
7do
8  cp $i root/toybox-$(echo $i | sed 's@root/\([^/]*\)/.*@\1@') || exit 1
9done
10
11for i in root/*/run-qemu.sh
12do
13  i=${i%/run-qemu.sh} j=${i#root/}
14  [ ! -e "$i" ] && continue
15  # Add README, don't include "fs" dir (you can extract it from cpio.gz)
16  cp mkroot/README.root $i/docs/README &&
17  tar cvzfC $i.tgz root --exclude=fs $j || exit 1
18done
19
20# Generate top level README
21KVERS=$(toybox sed -n '3s@# Linux/[^ ]* \(.*\) Kernel Configuration@\1@p' root/*/docs/linux-fullconfig)
22cat > root/README << EOF
23Bootable system images created by:
24
25  mkroot/mkroot.sh LINUX=~/linux CROSS=allnonstop
26
27Each system image is built from two packages: toybox and linux.
28The run-qemu.sh script in each tarball should boot the system
29to a shell prompt under qemu, exit from that shell to shut down the
30virtual system and stop the emulator.
31
32See https://landley.net/toybox/faq.html#mkroot for details.
33
34Built from mkroot $(git describe --tags), and Linux $KVERS with patches in linux-patches/
35EOF
36
37if [ $# -eq 2 ]
38then
39  scp root/toybox-* "$1/$2/" &&
40  scp root/*.tgz root/README "$1/mkroot/$2/"
41fi
42