1
0

cbr2cbz(1)

This commit is contained in:
dtb 2024-04-10 12:59:01 -06:00
parent fdd5f5050b
commit 92f1bb5c72

27
cbz/cbr2cbz Normal file
View File

@ -0,0 +1,27 @@
#!/bin/sh
set -e
usage(){
printf 'Usage: %s [files...]\n' "$0"
exit 64 # sysexits.h(3) EX_USAGE
}
command -v zip \
>/dev/null \
&& command -v unrar \
>/dev/null
test -n "$1" \
|| usage
d="$(mktemp -d || printf '%s/.cbr2cbz\n' "$HOME/")"
if test -n "$DEBUG"
then set -x; d=x
else trap 'rm -rf "$d"; trap - EXIT; exit' EXIT INT HUP
fi
while test -n "$1"; do
unrar x -op"$d" "$1"
zip -Z deflate "$1".cbz "$d"/*
done