diff options
author | Tim Shimmin <tes@sgi.com> | 2004-07-30 05:28:14 +0000 |
---|---|---|
committer | Tim Shimmin <tes@sgi.com> | 2004-07-30 05:28:14 +0000 |
commit | 59aeee91831a0d3063a290d88479ea76deadff76 (patch) | |
tree | 2b7c45b1d977dd3ab9f3cb989c0e35f3385e9879 | |
parent | e30b7c2fac3e7ce0cd18de15e6d2300fc641f1c8 (diff) |
get quota stuff working on IRIX as well as Linux
-rwxr-xr-x | 050 | 48 | ||||
-rw-r--r-- | 050.gqnoenforce | 64 | ||||
-rw-r--r-- | 050.grpquota | 64 | ||||
-rw-r--r-- | 050.uqnoenforce | 64 | ||||
-rw-r--r-- | 050.usrquota | 64 | ||||
-rwxr-xr-x | 052 | 42 | ||||
-rwxr-xr-x | 054 | 12 | ||||
-rw-r--r-- | common.quota | 96 |
8 files changed, 245 insertions, 209 deletions
@@ -3,7 +3,7 @@ # # Exercises basic XFS quota functionality # MOUNT_OPTIONS env var switches the test type (uid/gid/acct/enfd) -# options are: (-o) usrquota, grpquota, uqnoenforce, gqnoenforce +# options are: (-o) uquota, gquota, uqnoenforce, gqnoenforce # #----------------------------------------------------------------------- # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. @@ -47,8 +47,6 @@ here=`pwd` tmp=/tmp/$$ status=1 # failure is the default! -export MOUNT_OPTIONS=-ousrquota - # get standard environment, filters and checks . ./common.rc . ./common.filter @@ -66,7 +64,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 # real QA test starts here _supported_fs xfs -_supported_os Linux +_supported_os Linux IRIX rm -f $seq.out cp /dev/null $seq.full @@ -75,6 +73,11 @@ chmod a+rwx $seq.full # arbitrary users will write here _require_scratch _require_quota +# setup a default run +if [ -z "$MOUNT_OPTIONS" ]; then + export MOUNT_OPTIONS="-o uquota" +fi + blksoft=100 blkhard=500 inosoft=4 @@ -98,7 +101,7 @@ _filter_and_check_blocks() } s/^('$name'\s+[-|+][-|+]\s+)(\d+)/\1 OK/g; } - ' | _filter_repquota $1 + ' | _filter_repquota } _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs @@ -109,21 +112,28 @@ cat $tmp.mkfs >>$seq.full _qmount +# Irix uses filesystem name and Linux uses device of filesystem +if [ $HOSTOS = "Linux" ]; then + QUOTA_FS=$SCRATCH_DEV +else + QUOTA_FS=$SCRATCH_MNT +fi + # setup exactly what it is we'll be testing enforce=1 if src/feature -u $SCRATCH_DEV then - type=u ; eval `_choose_uid`; ln $seq.usrquota $seq.out + type=u ; eval `_choose_uid`; ln -s $seq.usrquota $seq.out elif src/feature -g $SCRATCH_DEV then - type=g ; eval `_choose_gid`; ln $seq.grpquota $seq.out + type=g ; eval `_choose_gid`; ln -s $seq.grpquota $seq.out elif src/feature -U $SCRATCH_DEV then - type=u ; eval `_choose_uid`; ln $seq.uqnoenforce $seq.out + type=u ; eval `_choose_uid`; ln -s $seq.uqnoenforce $seq.out enforce=0 elif src/feature -G $SCRATCH_DEV then - type=g ; eval `_choose_gid`; ln $seq.gqnoenforce $seq.out + type=g ; eval `_choose_gid`; ln -s $seq.gqnoenforce $seq.out enforce=0 else _notrun "No quota support at mount time" @@ -134,26 +144,28 @@ echo "and using type=$type id=$id" >>$seq.full echo echo "*** report no quota settings" | tee -a $seq.full -repquota -$type $SCRATCH_DEV | _filter_repquota 6 +_repquota -$type $QUOTA_FS | _filter_repquota echo echo "*** report initial settings" | tee -a $seq.full _file_as_id $SCRATCH_MNT/initme $id $type 1024 0 -setquota -$type $id $blksoft $blkhard $inosoft $inohard $SCRATCH_DEV -repquota -$type $SCRATCH_DEV | _filter_repquota 7 +echo "ls -l $SCRATCH_MNT" >>$seq.full +ls -l $SCRATCH_MNT >>$seq.full +_setquota -$type $id $blksoft $blkhard $inosoft $inohard $QUOTA_FS +_repquota -$type $QUOTA_FS | _filter_repquota echo echo "*** push past the soft inode limit" | tee -a $seq.full _file_as_id $SCRATCH_MNT/softie1 $id $type 1024 0 _file_as_id $SCRATCH_MNT/softie2 $id $type 1024 0 _qmount -repquota -$type $SCRATCH_DEV | _filter_repquota 7 +_repquota -$type $QUOTA_FS | _filter_repquota echo echo "*** push past the soft block limit" | tee -a $seq.full _file_as_id $SCRATCH_MNT/softie $id $type 1024 140 _qmount -repquota -$type $SCRATCH_DEV | _filter_repquota 7 +_repquota -$type $QUOTA_FS | _filter_repquota echo # Note: for quota accounting (not enforcement), EDQUOT is not expected @@ -163,17 +175,17 @@ do _file_as_id $SCRATCH_MNT/hard$i $id $type 1024 0 done _qmount -repquota -$type $SCRATCH_DEV | _filter_repquota 7 +_repquota -$type $QUOTA_FS | _filter_repquota echo # Note: for quota accounting (not enforcement), EDQUOT is not expected echo "*** push past the hard block limit (expect EDQUOT)" | tee -a $seq.full _file_as_id $SCRATCH_MNT/softie $id $type 1024 540 +echo "ls -l $SCRATCH_MNT" >>$seq.full +ls -l $SCRATCH_MNT >>$seq.full _qmount -repquota -$type $SCRATCH_DEV | _filter_and_check_blocks 7 - +_repquota -$type $QUOTA_FS | _filter_and_check_blocks -export -n MOUNT_OPTIONS # success, all done status=0 diff --git a/050.gqnoenforce b/050.gqnoenforce index ff1c417e..b2b083f2 100644 --- a/050.gqnoenforce +++ b/050.gqnoenforce @@ -7,56 +7,38 @@ log =LDEV bsize=XXX blocks=XXX realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX *** report no quota settings -*** Report for group quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -Group used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 + Block limits File limits +Group used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 *** report initial settings -*** Report for group quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -Group used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] -- 0 100 500 1 4 10 + Block limits File limits +Group used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name -* 0 100 500 1 4 10 *** push past the soft inode limit -*** Report for group quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -Group used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] -- 0 100 500 3 4 10 + Block limits File limits +Group used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name -* 0 100 500 3 4 10 *** push past the soft block limit -*** Report for group quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -Group used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] +- 140 100 500 4 4 10 + Block limits File limits +Group used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name +* 140 100 500 4 4 10 *** push past the hard inode limit (expect EDQUOT) -*** Report for group quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -Group used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 4 0 0 3 0 0 -[NAME] ++ 140 100 500 16 4 10 + Block limits File limits +Group used soft hard grace used soft hard grace +name -* 4 0 0 3 0 0 +name +* 140 100 500 16 4 10 *** push past the hard block limit (expect EDQUOT) -*** Report for group quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -Group used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 4 0 0 3 0 0 -[NAME] ++ 540 100 500 16 4 10 + Block limits File limits +Group used soft hard grace used soft hard grace +name -* 4 0 0 3 0 0 +name +* 540 100 500 16 4 10 *** unmount diff --git a/050.grpquota b/050.grpquota index 68a761d1..a2759433 100644 --- a/050.grpquota +++ b/050.grpquota @@ -7,56 +7,38 @@ log =LDEV bsize=XXX blocks=XXX realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX *** report no quota settings -*** Report for group quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -Group used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 + Block limits File limits +Group used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 *** report initial settings -*** Report for group quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -Group used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] -- 0 100 500 1 4 10 + Block limits File limits +Group used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name -* 0 100 500 1 4 10 *** push past the soft inode limit -*** Report for group quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -Group used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] -- 0 100 500 3 4 10 + Block limits File limits +Group used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name -* 0 100 500 3 4 10 *** push past the soft block limit -*** Report for group quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -Group used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] +- 140 100 500 7days 4 4 10 7days + Block limits File limits +Group used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name +* 140 100 500 7days 4 4 10 7days *** push past the hard inode limit (expect EDQUOT) -*** Report for group quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -Group used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] ++ 140 100 500 7days 10 4 10 7days + Block limits File limits +Group used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name +* 140 100 500 7days 10 4 10 7days *** push past the hard block limit (expect EDQUOT) -*** Report for group quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -Group used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] ++ OK 100 500 7days 10 4 10 7days + Block limits File limits +Group used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name +* OK 100 500 7days 10 4 10 7days *** unmount diff --git a/050.uqnoenforce b/050.uqnoenforce index 619e3dd5..1bc3d2e8 100644 --- a/050.uqnoenforce +++ b/050.uqnoenforce @@ -7,56 +7,38 @@ log =LDEV bsize=XXX blocks=XXX realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX *** report no quota settings -*** Report for user quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -User used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 + Block limits File limits +User used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 *** report initial settings -*** Report for user quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -User used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] -- 0 100 500 1 4 10 + Block limits File limits +User used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name -* 0 100 500 1 4 10 *** push past the soft inode limit -*** Report for user quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -User used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] -- 0 100 500 3 4 10 + Block limits File limits +User used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name -* 0 100 500 3 4 10 *** push past the soft block limit -*** Report for user quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -User used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] +- 140 100 500 4 4 10 + Block limits File limits +User used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name +* 140 100 500 4 4 10 *** push past the hard inode limit (expect EDQUOT) -*** Report for user quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -User used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 4 0 0 3 0 0 -[NAME] ++ 140 100 500 16 4 10 + Block limits File limits +User used soft hard grace used soft hard grace +name -* 4 0 0 3 0 0 +name +* 140 100 500 16 4 10 *** push past the hard block limit (expect EDQUOT) -*** Report for user quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -User used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 4 0 0 3 0 0 -[NAME] ++ 540 100 500 16 4 10 + Block limits File limits +User used soft hard grace used soft hard grace +name -* 4 0 0 3 0 0 +name +* 540 100 500 16 4 10 *** unmount diff --git a/050.usrquota b/050.usrquota index 25d92080..4915d3a6 100644 --- a/050.usrquota +++ b/050.usrquota @@ -7,56 +7,38 @@ log =LDEV bsize=XXX blocks=XXX realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX *** report no quota settings -*** Report for user quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -User used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 + Block limits File limits +User used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 *** report initial settings -*** Report for user quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -User used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] -- 0 100 500 1 4 10 + Block limits File limits +User used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name -* 0 100 500 1 4 10 *** push past the soft inode limit -*** Report for user quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -User used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] -- 0 100 500 3 4 10 + Block limits File limits +User used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name -* 0 100 500 3 4 10 *** push past the soft block limit -*** Report for user quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -User used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] +- 140 100 500 7days 4 4 10 7days + Block limits File limits +User used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name +* 140 100 500 7days 4 4 10 7days *** push past the hard inode limit (expect EDQUOT) -*** Report for user quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -User used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] ++ 140 100 500 7days 10 4 10 7days + Block limits File limits +User used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name +* 140 100 500 7days 10 4 10 7days *** push past the hard block limit (expect EDQUOT) -*** Report for user quotas on device [DEVICE] -Block grace time: 7days; Inode grace time: 7days - Block limits File limits -User used soft hard grace used soft hard grace ----------------------------------------------------------------------- -[NAME] -- 0 0 0 3 0 0 -[NAME] ++ OK 100 500 7days 10 4 10 7days + Block limits File limits +User used soft hard grace used soft hard grace +name -* 0 0 0 3 0 0 +name +* OK 100 500 7days 10 4 10 7days *** unmount @@ -3,8 +3,8 @@ # # Ensure that quota(1) displays blocksizes matching ondisk dquots. # -# MOUNT_OPTIONS can be set to grpquota to test group quota, -# defaults to usrquota if MOUNT_OPTIONS is not set. +# MOUNT_OPTIONS can be set to gquota to test group quota, +# defaults to uquota if MOUNT_OPTIONS is not set. # #----------------------------------------------------------------------- # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. @@ -48,8 +48,6 @@ here=`pwd` tmp=/tmp/$$ status=1 # failure is the default! -export MOUNT_OPTIONS=-ousrquota - # get standard environment, filters and checks . ./common.rc . ./common.filter @@ -74,7 +72,7 @@ _require_quota # setup a default run if [ -z "$MOUNT_OPTIONS" ]; then - MOUNT_OPTIONS="-o usrquota"; export MOUNT_OPTIONS + export MOUNT_OPTIONS="-o uquota" fi _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs @@ -88,9 +86,9 @@ _qmount # setup user/group to test if src/feature -U $SCRATCH_DEV ; then - type=u ; eval `_choose_uid` + type=u; eval `_choose_uid` elif src/feature -G $SCRATCH_DEV ; then - type=g ; eval `_choose_gid` + type=g; eval `_choose_gid` else _notrun "No quota support at mount time" fi @@ -99,21 +97,37 @@ fi _file_as_id $SCRATCH_MNT/foo $id $type $dbsize 220 sync +# Irix uses filesystem name and Linux uses device of filesystem +if [ $HOSTOS = "Linux" ]; then + QUOTA_FS=$SCRATCH_DEV +else + QUOTA_FS=$SCRATCH_MNT +fi + # set limit at 1001 (1k) blocks -setquota -$type $id 1001 1001 10 10 $SCRATCH_DEV +bsoft=1001 +bhard=1001 +isoft=10 +ihard=10 +_setquota -$type $id $bsoft $bhard $isoft $ihard $QUOTA_FS -# cross check blks, softblks, hardblks <-> quota, xfs_db -quota -$type $id | tee -a $seq.full | perl -ne ' - if (m[^\s*'$SCRATCH_DEV'\s+(\d+)\s+(\d+)\s+(\d+)] || +_filter_quota() +{ + perl -ne ' + if (m[^\s*'$QUOTA_FS'\s+(\d+)\s+(\d+)\s+(\d+)] || ($next == 1 && m,^\s+(\d+)\s+(\d+)\s+(\d+),)) { print "used_blocks=", $1, "\n"; print "soft_blocks=", $2, "\n"; print "hard_blocks=", $3, "\n"; $next = 0; } - elsif (m[^\s*'$SCRATCH_DEV']) { # devfs (long) names + elsif (m[^\s*'$QUOTA_FS']) { # devfs (long) names $next = 1; - }' | LC_COLLATE=POSIX sort >$tmp.quota + }' | LC_COLLATE=POSIX sort +} + +# cross check blks, softblks, hardblks <-> quota, xfs_db +_quota -$type $id | tee -a $seq.full | _filter_quota >$tmp.quota echo ===quota output >> $seq.full cat $tmp.quota >> $seq.full @@ -141,8 +155,6 @@ echo Comparing out of quota and xfs_db diff $tmp.quota $tmp.xfs_db [ $? -eq 0 ] && echo OK. -export -n MOUNT_OPTIONS - # success, all done status=0 exit @@ -60,7 +60,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 # real QA test starts here _supported_fs xfs -_supported_os Linux +_supported_os Linux IRIX cp /dev/null $seq.full chmod ugo+rwx $seq.full @@ -114,7 +114,7 @@ _exercise() } _scratch_mkfs_xfs $SCRATCH_DEV >/dev/null 2>&1 -MOUNT_OPTIONS="$MOUNT_OPTIONS -ousrquota,grpquota"; export MOUNT_OPTIONS +export MOUNT_OPTIONS="-o uquota,gquota" _qmount if src/feature -G $SCRATCH_DEV ; then : @@ -123,19 +123,19 @@ else fi umount $SCRATCH_MNT 2>/dev/null -MOUNT_OPTIONS=""; export MOUNT_OPTIONS +export MOUNT_OPTIONS="" echo "*** Default mount options" _exercise -MOUNT_OPTIONS="-o usrquota"; export MOUNT_OPTIONS +export MOUNT_OPTIONS="-o uquota" echo "*** User quota mount option" _exercise -MOUNT_OPTIONS="-o grpquota"; export MOUNT_OPTIONS +export MOUNT_OPTIONS="-o gquota" echo "*** Group quota mount option" _exercise -MOUNT_OPTIONS="-o usrquota,grpquota"; export MOUNT_OPTIONS +export MOUNT_OPTIONS="-o uquota,gquota" echo "*** User and Group quota mount options" _exercise diff --git a/common.quota b/common.quota index ca9253f9..ca6daefa 100644 --- a/common.quota +++ b/common.quota @@ -69,10 +69,16 @@ _file_as_id() _notrun "broken type in call to _file_as_id in test $seq" fi - perl <<EOF >/dev/null 2>&1 + perl <<EOF >>$seq.full 2>&1 \$| = 1; $magik = $2; - exec "dd if=/dev/zero of=$1 bs=$4 count=$5"; + if ($5 == 0) { + print "touch $1"; + exec "touch $1"; + } else { + print "dd if=/dev/zero of=$1 bs=$4 count=$5"; + exec "dd if=/dev/zero of=$1 bs=$4 count=$5"; + } EOF # for debugging the above euid change, try... [need write in cwd] # exec "dd if=/dev/zero of=$1 bs=$4 count=$5 >>$seq.full 2>&1"; @@ -90,12 +96,32 @@ _choose_gid() /etc/group } +# +# filter to get the guts out +# and make linux and irix similar +# _filter_repquota() { - head -$1 | perl -ne " - s/^(\w+)\s+([-|+])/[NAME] \2/g; - s($SCRATCH_DEV)([DEVICE])g; - print" + tee -a $seq.full | $AWK_PROG ' + /File limits/ { + gotit = 1 + } + gotit==1 { + sub(/Disk/, "Block") + gsub(/timeleft/, "grace") + gsub(/[.]0 /,"") + sub(/- /, "* ") + sub(/[+] /, "* ") + gsub(/1week/,"7days") + gsub(/NOT STARTED/,"") + gsub(/[ \t]+/, " ") + if ($0 ~ / [-+]/) + $1 = "name" + if ($0 !~ /^$/) + print + next + } + ' | sed -e '/-----------------/d' } _qmount() @@ -106,5 +132,63 @@ _qmount() [ -x /usr/sbin/quot ] && quot $SCRATCH_MNT >>$seq.full 2>&1 } +#----------------------------------------------------------------------------------- +# +# wrappers for Linux/IRIX differences +# +_setquota() +{ + _opt_type=$1 + _id=$2 + _bsoft=$3 + _bhard=$4 + _isoft=$5 + _ihard=$6 + _fs=$7 + + [ $# -eq 7 ] || _fail "_setquota failed with wrong # args: $*" + + if [ $HOSTOS = "Linux" ]; then + echo "setquota $_opt_type $_id $_bsoft $_bhard $_isoft $_ihard $_fs" >>$seq.full + setquota $_opt_type $_id $_bsoft $_bhard $_isoft $_ihard $_fs + else + # IRIX + if [ $_opt_type = "-u" ]; then + _opt_type="" + id_param="uid" + else + id_param="gid" + fi + echo "/usr/etc/edquota $_opt_type -f $_fs -l $id_param=$_id,bsoft=$_bsoft,bhard=$_bhard,isoft=$_isoft,ihard=$_ihard" >>$seq.full + /usr/etc/edquota $_opt_type -f $_fs -l $id_param=$_id,bsoft=$_bsoft,bhard=$_bhard,isoft=$_isoft,ihard=$_ihard + fi +} + +_quota() +{ + echo "quota $*" >>$seq.full + if [ $HOSTOS = "Linux" ]; then + quota $* + else + # clear -u + args=`echo $*|sed -e 's/-u//'` + quota -v $args + fi +} + +_repquota() +{ + echo "repquota $*" >>$seq.full + if [ $HOSTOS = "Linux" ]; then + repquota $* + else + # clear -u + args=`echo $*|sed -e 's/-u//'` + repquota -v $args + fi +} + +#----------------------------------------------------------------------------------- + # make sure this script returns success /bin/true |