Debian Codegraph @

ctdb/tests/UNIT/eventscripts/stubs/df

raw
1 #!/bin/sh
2
3 usage()
4 {
5 echo "usage: df [-kP] [<mount-point>]"
6 exit 1
7 }
8
9 if [ "$1" = "-kP" ]; then
10 shift
11 fi
12
13 case "$1" in
14 -*) usage ;;
15 esac
16
17 fs="${1:-/}"
18
19 # Anything starting with CTDB_DBDIR_BASE gets canonicalised to
20 # CTDB_DBDIR_BASE. This helps with the setting of defaults for the
21 # filesystem checks.
22 if [ "${fs#"${CTDB_DBDIR_BASE}"}" != "$fs" ]; then
23 fs="$CTDB_DBDIR_BASE"
24 fi
25
26 # A default, for tests that don't initialise this...
27 if [ -z "$FAKE_FS_USE" ]; then
28 FAKE_FS_USE=10
29 fi
30
31 echo "Filesystem 1024-blocks Used Available Capacity Mounted on"
32
33 blocks="1000000"
34 used=$((blocks * FAKE_FS_USE / 100))
35 available=$((blocks - used))
36
37 printf "%-36s %10d %10d %10d %10d%% %s\n" \
38 "/dev/sda1" "$blocks" "$used" "$available" "$FAKE_FS_USE" "$fs"