diff options
Diffstat (limited to '')
| -rwxr-xr-x | scripts/mkdisk.sh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/mkdisk.sh b/scripts/mkdisk.sh index 6bdd50c..2c62f76 100755 --- a/scripts/mkdisk.sh +++ b/scripts/mkdisk.sh | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | # ./scripts/mkdisk.sh --size 128M # different size (default 64M) | 9 | # ./scripts/mkdisk.sh --size 128M # different size (default 64M) |
| 10 | # ./scripts/mkdisk.sh /path/img # custom image path | 10 | # ./scripts/mkdisk.sh /path/img # custom image path |
| 11 | # ./scripts/mkdisk.sh --no-seed # skip the seed/ directory | 11 | # ./scripts/mkdisk.sh --no-seed # skip the seed/ directory |
| 12 | # ./scripts/mkdisk.sh --label CRASHLOG # volume label (default RSDOS) | ||
| 12 | # | 13 | # |
| 13 | # The image is created with `mkfs.fat -C`, which is the option that | 14 | # The image is created with `mkfs.fat -C`, which is the option that |
| 14 | # actually creates the file — plain `mkfs.fat` only writes into an | 15 | # actually creates the file — plain `mkfs.fat` only writes into an |
| @@ -23,6 +24,7 @@ IMG="/tmp/disk.img" | |||
| 23 | SIZE="64M" | 24 | SIZE="64M" |
| 24 | FRESH=0 | 25 | FRESH=0 |
| 25 | SEED_DIR="$PROJECT_DIR/seed" | 26 | SEED_DIR="$PROJECT_DIR/seed" |
| 27 | LABEL="RSDOS" | ||
| 26 | 28 | ||
| 27 | while [ $# -gt 0 ]; do | 29 | while [ $# -gt 0 ]; do |
| 28 | case "$1" in | 30 | case "$1" in |
| @@ -32,6 +34,10 @@ while [ $# -gt 0 ]; do | |||
| 32 | SIZE="$1" | 34 | SIZE="$1" |
| 33 | ;; | 35 | ;; |
| 34 | --no-seed) SEED_DIR="" ;; | 36 | --no-seed) SEED_DIR="" ;; |
| 37 | --label) | ||
| 38 | shift | ||
| 39 | LABEL="$1" | ||
| 40 | ;; | ||
| 35 | --help | -h) | 41 | --help | -h) |
| 36 | head -20 "$0" | grep "^#" | sed 's/^# \?//' | 42 | head -20 "$0" | grep "^#" | sed 's/^# \?//' |
| 37 | exit 0 | 43 | exit 0 |
| @@ -65,9 +71,9 @@ if [ -z "$SIZE_BLOCKS" ] || [ "$SIZE_BLOCKS" -le 0 ] 2>/dev/null; then | |||
| 65 | exit 1 | 71 | exit 1 |
| 66 | fi | 72 | fi |
| 67 | 73 | ||
| 68 | echo "mkdisk: creating $IMG ($SIZE FAT32, label RSDOS)" | 74 | echo "mkdisk: creating $IMG ($SIZE FAT32, label $LABEL)" |
| 69 | rm -f "$IMG" | 75 | rm -f "$IMG" |
| 70 | mkfs.fat -C -F 32 -n RSDOS "$IMG" "$SIZE_BLOCKS" | 76 | mkfs.fat -C -F 32 -n "$LABEL" "$IMG" "$SIZE_BLOCKS" |
| 71 | 77 | ||
| 72 | if [ -n "$SEED_DIR" ] && [ -d "$SEED_DIR" ]; then | 78 | if [ -n "$SEED_DIR" ] && [ -d "$SEED_DIR" ]; then |
| 73 | if ! command -v mcopy >/dev/null 2>&1; then | 79 | if ! command -v mcopy >/dev/null 2>&1; then |
