#!/usr/bin/env python3 # Stand-in for the bzip2 program, used only by build.sh when the host has # none: busybox's build runs `bzip2 -1` as a filter (stdin -> stdout). import bz2, sys args = sys.argv[1:] level = next((int(a[1:]) for a in args if a[1:].isdigit()), 9) data = sys.stdin.buffer.read() out = bz2.decompress(data) if "-d" in args else bz2.compress(data, level) sys.stdout.buffer.write(out)