59 lines
1.4 KiB
Bash
Executable File
59 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
INSTALL_DIR="${INSTALL_DIR:-$ROOT_DIR/.local/microdicom}"
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
Usage:
|
|
scripts/setup-microdicom.sh --source-dir DIR [--install-dir DIR]
|
|
|
|
Behavior:
|
|
- Copies a prepared MicroDicom directory into a local ignored directory.
|
|
- Expected source contents include files like AUTORUN.INF, RUN.BAT, and MICROD/.
|
|
EOF
|
|
}
|
|
|
|
SOURCE_DIR=""
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--source-dir)
|
|
SOURCE_DIR="${2:?missing value for --source-dir}"
|
|
shift 2
|
|
;;
|
|
--install-dir)
|
|
INSTALL_DIR="${2:?missing value for --install-dir}"
|
|
shift 2
|
|
;;
|
|
-h|--help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "Unknown argument: $1" >&2
|
|
usage >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
[[ -n "$SOURCE_DIR" ]] || { echo "--source-dir is required" >&2; exit 1; }
|
|
[[ -d "$SOURCE_DIR" ]] || { echo "source directory does not exist: $SOURCE_DIR" >&2; exit 1; }
|
|
[[ -f "$SOURCE_DIR/AUTORUN.INF" ]] || { echo "missing AUTORUN.INF in source directory" >&2; exit 1; }
|
|
[[ -d "$SOURCE_DIR/MICROD" ]] || { echo "missing MICROD/ in source directory" >&2; exit 1; }
|
|
|
|
rm -rf "$INSTALL_DIR"
|
|
mkdir -p "$INSTALL_DIR"
|
|
cp -a "$SOURCE_DIR"/. "$INSTALL_DIR"/
|
|
|
|
echo "installed MicroDicom assets -> $INSTALL_DIR"
|
|
cat <<EOF
|
|
|
|
Done.
|
|
Set this config value:
|
|
|
|
iso:
|
|
microdicom_path: "$INSTALL_DIR"
|
|
EOF
|