2013-04-30 03:24:09 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
die() {
|
|
|
|
echo "${2}"
|
|
|
|
echo "Usage: ${0} <path to directory> <output file>"
|
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
|
|
|
[[ $# -eq 2 ]] || die 22 "Invalid number of arguments"
|
|
|
|
[[ -d "${1}" ]] || die 20 "${1} is not a directory"
|
2013-05-01 23:32:57 +00:00
|
|
|
[[ -e "${2}" ]] && [[ ! -f "$(readlink -f "${2}")" ]] && die 17 "${2} exists and is not a file"
|
2013-04-30 03:24:09 +00:00
|
|
|
|
|
|
|
[[ -f "${1}/pv" ]] || die 2 "${1}/pv does not exist. Read README!"
|
|
|
|
[[ -f "${1}/busybox" ]] || die 2 "${1}/busybox does not exist. Read README!"
|
|
|
|
|
|
|
|
file=$(readlink -f ${2})
|
|
|
|
|
|
|
|
cd "${1}"
|
|
|
|
find . -print0 | cpio --null -ov --format=newc | gzip -9 > "${file}"
|
|
|
|
|