#! /bin/sh . .config label="" prog=burn+diff setattrs=NO COPY=NO MOVE=NO DELETE=NO while getopts l:p:cmrs opt; do case $opt in l) label="$OPTARG" ;; p) prog="$OPTARG" ;; c) COPY=YES ;; m) MOVE=YES ;; r) DELETE=YES ;; s) setattrs=YES ;; esac done shift `expr $OPTIND - 1` source="$1" if [ "$2" -o \( "$source" -a $COPY = NO -a $MOVE = NO \) -o \( $COPY = YES -a $MOVE = YES \) ]; then echo "Usage: $0 [-l label] [-p program] [-s] [-c|-m] [source]" exit 1 fi if [ "$source" ]; then if [ -f "$source" ]; then mkdir -p "$source_dir" || exit 1 elif [ -d "$source" ]; then [ "$label" = "" ] && label="`basename \"$source\"`" else echo "$0 can only write files or directories" exit 1 fi if [ $COPY = YES ]; then if [ -f "$source" ]; then cp -p "$source" "$source_dir" else cpdir "$source" "$source_dir" fi elif [ $MOVE = YES ]; then mv "$source" "$source_dir" fi || exit 1 fi if [ $setattrs = YES ]; then setattrs.sh "$source_dir" fi if [ -z "$label" ]; then label="`guess_label.py`" fi if [ "$label" ]; then mk-image "$label" else mk-image fi && ls-image && $prog && rm "$cd_image_iso" || exit 1 if [ $DELETE = YES ]; then exec rm -r "$source_dir" fi