nutools/mkiso

41 lines
1016 B
Bash
Executable File

#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
function display_help() {
uecho "$scriptname: créer une image iso d'un répertoire
USAGE
$scriptname [options] srcdir [dest.iso]
OPTIONS
-M, --hfs
créer une image hybride ISO/HFS"
}
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
hfsmode=
parse_opts "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \
-M,--hfs hfsmode=1 \
@ args -- "$@" && set -- "${args[@]}" || die "$args"
srcdir="$(abspath "${1:-.}")"; shift
srcname="$(basename "$srcdir")"
dest="$(abspath "${1:-$srcname.iso}")"; shift
found=
for prog in genisoimage mkisofs; do
if progexists "$prog"; then
found=1
break
fi
done
[ -n "$found" ] || die "Impossible de trouver genisoimage/mkisofs"
if ask_yesno "$(ppath "$srcdir")/* --> $(ppath "$dest")" O; then
"$prog" -A "CD: $srcname" -V "$srcname" -r -hide-rr-moved -J ${hfsmode:+-hfs -part --netatalk} "$@" -o "$dest" "$srcdir"
fi