use absolute path otherwise this fails on install, see #998

This commit is contained in:
Antoine Beaupré 2006-11-28 00:49:12 +00:00
parent 4404569e2b
commit c6109e63ea
1 changed files with 17 additions and 10 deletions

View File

@ -1,12 +1,19 @@
#!/bin/sh #!/bin/sh
. /etc/alternc/local.sh . /etc/alternc/local.sh
DATA_PART=`df ${ALTERNC_LOC} 2>/dev/null | awk '/^\// { print $1 }'` AWK=/usr/bin/awk
DF=/bin/df
SED=/bin/sed
MOUNT=/bin/mount
QUOTA=/usr/bin/quota
GREP=/bin/grep
DATA_PART=`$DF ${ALTERNC_LOC} 2>/dev/null | $AWK '/^\// { print $1 }'`
# quota will give over NFS will print the partition using the full NFS name # quota will give over NFS will print the partition using the full NFS name
# (e.g. 10.0.0.1:/var/alternc) so we need to lookup first with mount # (e.g. 10.0.0.1:/var/alternc) so we need to lookup first with mount
# to convert DATA_PART if needed. # to convert DATA_PART if needed.
QUOTA_PART=`mount | sed -n -e "s,\([^ ]*\) on ${DATA_PART} type nfs.*,\1,p"` QUOTA_PART=`$MOUNT | $SED -n -e "s,\([^ ]*\) on ${DATA_PART} type nfs.*,\1,p"`
if [ -z "$QUOTA_PART" ]; then if [ -z "$QUOTA_PART" ]; then
QUOTA_PART="$DATA_PART" QUOTA_PART="$DATA_PART"
fi fi
@ -15,14 +22,14 @@ fi
# characters. *sigh* # characters. *sigh*
PART_LEN=`echo -n "$QUOTA_PART" | wc -c` PART_LEN=`echo -n "$QUOTA_PART" | wc -c`
if [ "$PART_LEN" -gt 15 ]; then if [ "$PART_LEN" -gt 15 ]; then
quota -g "$1" | $QUOTA -g "$1" |
sed -n -e "\\;${QUOTA_PART};,+1s/ *\([0-9]*\) .*/\1/p" | $SED -n -e "\\;${QUOTA_PART};,+1s/ *\([0-9]*\) .*/\1/p" |
grep -v '^$' $GREP -v '^$'
quota -g "$1" | $QUOTA -g "$1" |
sed -n -e "\\;${QUOTA_PART};,+1s/ *[0-9]* *\([0-9]*\) .*/\1/p" | $SED -n -e "\\;${QUOTA_PART};,+1s/ *[0-9]* *\([0-9]*\) .*/\1/p" |
grep -v '^$' $GREP -v '^$'
else else
quota -g "$1" | awk /${QUOTA_PART//\//\\\/}/\ {print\ '$2'} $QUOTA -g "$1" | $AWK /${QUOTA_PART//\//\\\/}/\ {print\ '$2'}
quota -g "$1" | awk /${QUOTA_PART//\//\\\/}/\ {print\ '$3'} $QUOTA -g "$1" | $AWK /${QUOTA_PART//\//\\\/}/\ {print\ '$3'}
fi fi