L4Re/departure

libe2access/host/mkfs

391:bc65615a8fed
2022-06-30 Paul Boddie Added missing structure members. mmap-region-flags
     1 #!/bin/sh     2      3 # Make a filesystem image.     4 #     5 # Copyright (C) 2019, 2021 Paul Boddie <paul@boddie.org.uk>     6 #     7 # This program is free software; you can redistribute it and/or     8 # modify it under the terms of the GNU General Public License as     9 # published by the Free Software Foundation; either version 2 of    10 # the License, or (at your option) any later version.    11 #    12 # This program is distributed in the hope that it will be useful,    13 # but WITHOUT ANY WARRANTY; without even the implied warranty of    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    15 # GNU General Public License for more details.    16 #    17 # You should have received a copy of the GNU General Public License    18 # along with this program; if not, write to the Free Software    19 # Foundation, Inc., 51 Franklin Street, Fifth Floor,    20 # Boston, MA  02110-1301, USA    21     22 TARGET=$1    23     24 if [ -e "$TARGET" ] ; then    25     echo "File already exists: $TARGET" 1>&2    26     exit 1    27 fi    28     29 if [ ! "$TARGET" ] ; then    30     echo "Creating temporary file." 1>&2    31     TARGET=`mktemp`    32 fi    33     34 SIZE=${2:-2000}    35     36 # Make a filesystem.    37     38   dd if=/dev/zero of="$TARGET" bs=1024 count=1 seek="$SIZE" \    39 > /dev/null 2>&1    40     41 if ! `/sbin/mkfs.ext2 -q "$TARGET"` ; then    42     exit 1    43 fi    44     45 echo "$TARGET"    46     47 # vim: tabstop=4 expandtab shiftwidth=4