|
Apache/2.2.15 (CentOS) Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64 uid=48(apache) gid=48(apache) groups=48(apache) server ip : 172.67.192.52 | your ip : 10.244.126.0 safemode OFF > / sbin / |
| Filename | /sbin/mount.tmpfs |
| Size | 1.31 kb |
| Permission | rwxr-xr-x |
| Owner | apache |
| Create time | 23-Dec-2025 17:41 |
| Last modified | 26-Jan-2018 13:11 |
| Last accessed | 26-Jan-2018 13:11 |
| Actions | edit | rename | delete | download (gzip) |
| View | text | code | image |
#! /bin/bash
#
# Copyright (C) 2009 Eric Paris <[email protected]>
# Daniel Walsh <[email protected]>
# Karel Zak <[email protected]>
#
# http://bugzilla.redhat.com/show_bug.cgi?id=476964
#
# Usage:
# /sbin/mount.tmpfs spec dir [-sfnv] [-o options]
#
case $1 in
-h|--help|-?)
echo "mount.tmpfs is a private mount(8) wrapper for tmpfs."
echo "Don't use it directly!"
exit 1
;;
esac
restricted=1
if [ $UID -eq 0 ] && [ $UID -eq $EUID ]; then
restricted=0
fi
# mount(8) in restricted mode (for non-root users) does not allow to use any
# mount options, types or so on command line. We have to call mount(8) with
# mountpoint only. All necessary options have to be defined in /etc/fstab.
#
# https://bugzilla.redhat.com/show_bug.cgi?id=615719
#
if [ $restricted -eq 1 ]; then
exec /bin/mount -i "$2"
fi
# Remount with context mount options is unsupported
# http://bugzilla.redhat.com/show_bug.cgi?id=563267
#
if ! echo "$@" | grep -q -E '\-o.*remount'; then
if ! echo "$@" | grep -q -E '(fs|def|root)?context='; then
con=$(ls --scontext -d "$2" | cut -f 1 -d ' ')
if [ -n "$con" ] && [ "$con" != "?" ] && [ "$con" != "unlabeled" ]; then
exec /bin/mount "$@" -o "rootcontext=\"$con\"" -i -t tmpfs
fi
fi
fi
exec /bin/mount "$@" -i -t tmpfs
#
# Copyright (C) 2009 Eric Paris <[email protected]>
# Daniel Walsh <[email protected]>
# Karel Zak <[email protected]>
#
# http://bugzilla.redhat.com/show_bug.cgi?id=476964
#
# Usage:
# /sbin/mount.tmpfs spec dir [-sfnv] [-o options]
#
case $1 in
-h|--help|-?)
echo "mount.tmpfs is a private mount(8) wrapper for tmpfs."
echo "Don't use it directly!"
exit 1
;;
esac
restricted=1
if [ $UID -eq 0 ] && [ $UID -eq $EUID ]; then
restricted=0
fi
# mount(8) in restricted mode (for non-root users) does not allow to use any
# mount options, types or so on command line. We have to call mount(8) with
# mountpoint only. All necessary options have to be defined in /etc/fstab.
#
# https://bugzilla.redhat.com/show_bug.cgi?id=615719
#
if [ $restricted -eq 1 ]; then
exec /bin/mount -i "$2"
fi
# Remount with context mount options is unsupported
# http://bugzilla.redhat.com/show_bug.cgi?id=563267
#
if ! echo "$@" | grep -q -E '\-o.*remount'; then
if ! echo "$@" | grep -q -E '(fs|def|root)?context='; then
con=$(ls --scontext -d "$2" | cut -f 1 -d ' ')
if [ -n "$con" ] && [ "$con" != "?" ] && [ "$con" != "unlabeled" ]; then
exec /bin/mount "$@" -o "rootcontext=\"$con\"" -i -t tmpfs
fi
fi
fi
exec /bin/mount "$@" -i -t tmpfs