2 # Source this file at the beginning of a test that works
3 # only when run as root or as non-root.
5 case "$PRIV_CHECK_ARG" in
6 require-root) who='as root';;
7 require-non-root) who='by an unprivileged user';;
8 *) echo "Usage: PRIV_CHECK_ARG={require-root|require-non-root} . priv-check"\
12 priv_check_temp=priv-check.$$
13 touch $priv_check_temp || framework_failure=1
14 chmod a-w $priv_check_temp || framework_failure=1
16 (echo foo >> $priv_check_temp) >/dev/null 2>&1
19 case $PRIV_CHECK_ARG:$overwrite_status in
21 require-root:*) give_msg=yes ;;
22 require-non-root:0) give_msg=yes ;;
23 require-non-root:*) ;;
26 test $give_msg = yes && {
28 ***************************
30 $0: This test is being skipped, since it works only
32 ***************************
34 rm -f $priv_check_temp
38 rm -f $priv_check_temp