|
|
@ -54,12 +54,14 @@ eval set -- "$options" |
|
|
|
size= |
|
|
|
format= |
|
|
|
name= |
|
|
|
configs= |
|
|
|
cfgs= |
|
|
|
while [ $# -gt 0 ]; do |
|
|
|
case "$1" in |
|
|
|
-h) |
|
|
|
create_usage |
|
|
|
exit 0 ;; |
|
|
|
-s) size=`size_in_bytes "$2"`; shift ;; |
|
|
|
-c) cfgs="$cfgs $2"; shift ;; |
|
|
|
*) echo_abort 1 "$1: Unknown argument, aborting." |
|
|
|
esac |
|
|
|
shift |
|
|
@ -76,11 +78,20 @@ fi |
|
|
|
# |
|
|
|
size_in_bytes() { |
|
|
|
lsize="$1" |
|
|
|
size2=$(echo "$1" | sed -n -e '/^[0-9]\+\(\.[0-9]*\)\?[kKmMgGtT]\?$/p') |
|
|
|
[ -n "$size2" ] || echo_abort 1 "$lsize: invalid format, use <number>[U] where U can be kKmMgGtT" |
|
|
|
bytes=$( echo "$size2" | sed -e 's,[t|T]$, 1099511627776,' -e 's,[gG]$, 1073741824,' \ |
|
|
|
-e 's,[mM]$, 1048576,' -e 's,[kK]$, 1024,' -e 's,^[0-9]\+$,\0 1,' | gawk '{printf("%d",$1 * $2)}' ) |
|
|
|
[ "$bytes" -gt 0 ] || echo_abort 1 "$lsize: invalid size ($bytes <= 0)" |
|
|
|
|
|
|
|
case "$lsize" in |
|
|
|
dvd) bytes=$( gawk '{printf("%d",4480*1048576}' ) ;; |
|
|
|
dvd-dl) bytes=$( gawk '{printf("%d",8140*1048576 }') ;; |
|
|
|
cd) bytes=$( gawk '{printf("%d",702*1048576 }') ;; |
|
|
|
cd74) bytes=$( gawk '{printf("%d",650*1048576 }') ;; |
|
|
|
cd90) bytes=$( gawk '{printf("%d",790*1048576 }') ;; |
|
|
|
cd99) bytes=$( gawk '{printf("%d",870*1048576 }') ;; |
|
|
|
*) |
|
|
|
size2=$(echo "$lsize" | sed -n -e '/^[0-9]\+\(\.[0-9]*\)\?[kKmMgGtT]\?$/p') |
|
|
|
[ -n "$size2" ] || echo_abort 1 "$lsize: invalid format, use <number>[U] where U can be kKmMgGtT" |
|
|
|
bytes=$( echo "$size2" | sed -e 's,[t|T]$, 1099511627776,' -e 's,[gG]$, 1073741824,' \ |
|
|
|
-e 's,[mM]$, 1048576,' -e 's,[kK]$, 1024,' -e 's,^[0-9]\+$,\0 1,' | gawk '{printf("%d",$1 * $2)}' ) |
|
|
|
[ "$bytes" -gt 0 ] || echo_abort 1 "$lsize: invalid size ($bytes <= 0)" |
|
|
|
esac |
|
|
|
echo $bytes |
|
|
|
} |
|
|
|
|