| 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2009 Karel Zak <[email protected]> |
| 4 | # |
| 5 | # This file is part of util-linux. |
| 6 | # |
| 7 | # This file is free software; you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by |
| 9 | # the Free Software Foundation; either version 2 of the License, or |
| 10 | # (at your option) any later version. |
| 11 | # |
| 12 | # This file 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 | TS_TOPDIR="${0%/*}/../.." |
| 18 | TS_DESC="mkfs fsck" |
| 19 | |
| 20 | . "$TS_TOPDIR"/functions.sh |
| 21 | ts_init "$*" |
| 22 | |
| 23 | ts_check_test_command "$TS_CMD_MKMINIX" |
| 24 | ts_check_test_command "$TS_CMD_FSCKMINIX" |
| 25 | |
| 26 | mkfs_and_fsck_minix() { |
| 27 | local ret |
| 28 | ts_log "#####################################" |
| 29 | ts_log_both "$ mkfs.minix $1 image" |
| 30 | $TS_CMD_MKMINIX $1 $img >> $TS_OUTPUT 2>> $TS_ERRLOG |
| 31 | ret=$? |
| 32 | echo "return mkfs: $ret" >> $TS_OUTPUT |
| 33 | test $ret = 0 || return $ret |
| 34 | |
| 35 | ts_log_both "$ fsck.minix -lavsf image" |
| 36 | $TS_CMD_FSCKMINIX -lavsf $img >> $TS_OUTPUT 2>> $TS_ERRLOG |
| 37 | ret=$? |
| 38 | echo "return fsck: $ret" >> $TS_OUTPUT |
| 39 | return $ret |
| 40 | } |
| 41 | |
| 42 | img=$(ts_image_init) |
| 43 | |
| 44 | # TODO looping over arbitrary badblock files (-l bad) gives a lot segfaults |
| 45 | for ver in "" "-1" "-2" "-3"; do |
| 46 | for n in "" "-n 14" "-n 30" "-n 60"; do |
| 47 | mkfs_and_fsck_minix "$ver $n" |
| 48 | done |
| 49 | done |
| 50 | |
| 51 | rm -f $img |
| 52 | |
| 53 | # escape "@" with "\@" in $img. This way sed correctly |
| 54 | # replaces paths containing "@" characters |
| 55 | sed -i "s@${img//\@/\\\@}@image@g" $TS_OUTPUT |
| 56 | |
| 57 | |
| 58 | ts_finalize |
| 59 |