Skip to content

Commit 2e507e0

Browse files
committed
hash-cd: Allow caller to provide a path to the cdrom device
1 parent 8de1a8a commit 2e507e0

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

script/hash-cd

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,35 @@ set -euo pipefail
66

77
. oks-lib.sh
88

9+
print_usage ()
10+
{
11+
cat <<END
12+
USAGE:
13+
"${0##*/}" <CDROM>
14+
15+
<CDROM> - path to CDROM device (default: $CD_DEV)
16+
END
17+
}
18+
19+
while test $# -gt 0; do
20+
case $1 in
21+
-h|--help) print_usage; exit $?;;
22+
--) shift; break;;
23+
-*) usage_error "invalid option: '$1'";;
24+
*) break;
25+
esac
26+
shift
27+
done
28+
29+
if [ $# -eq 1 ]; then
30+
CD_DEV="$1"
31+
fi
32+
33+
if [ $# -gt 1 ]; then
34+
>&2 echo "unepected positional parameters"
35+
exit 1
36+
fi
37+
938
TMP_DIR=$(mktemp --directory)
1039
trap 'rm -rf -- "$TMP_DIR"' EXIT
1140

0 commit comments

Comments
 (0)