1#!/bin/sh
2# Extract uuencoded and bzipped busybox binaries
3# from system-image-*.log files
4
5for logfile in system-image-*.log; do
6	grep -q '^begin 744 busybox.bz2' "$logfile" \
7	|| { echo "No busybox.bz2 in $logfile"; continue; }
8
9	arch=${logfile%.log}
10	arch=${arch#system-image-}
11
12	test -e "busybox-$arch" \
13	&& { echo "busybox-$arch exists, not overwriting"; continue; }
14
15	uudecode -o - "$logfile" | bunzip2 >"busybox-$arch" \
16	&& chmod 755 "busybox-$arch"
17done
18