blob: f2b8c945ca540e3ceda5c2b35c94bc649c5df237 [file] [log] [blame]
#!/bin/sh
# Check the sizes of Stage 2 and Stage 1.5's.
# Copyright (C) 1999,2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Written by OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
# This function checks if the size of the first argument (filename) is
# greater than the second argument (limit). If so, then exit with the
# status 1, otherwise do nothing.
check ()
{
file=$1
limit=$2
set dummy `ls -l $file`
size=$6
if test $size -gt $limit; then
echo "$file is too big ($size > $limit)."
exit 1
fi
}
# The bootloader area of a FFS partition is 14 sectors.
check ffs_stage1_5 7168
check ufs2_stage1_5 7168
# Stage 1.5 can be installed in the sectors immediately after MBR in the
# first cylinder, so the size is (63 - 1) sectors.
check fat_stage1_5 31744
# Likewise.
check e2fs_stage1_5 31744
# Likewise.
check minix_stage1_5 31744
# Success.
exit 0