Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 246715 Details for
Bug 336723
baselayout-1_12 (rev. 3163): we cannot rely on stat (associated with #291916)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
functions.sh-is_mounted-is_clean.patch
functions.sh-is_mounted-is_clean.patch (text/plain), 1.84 KB, created by
Amadeusz Żołnowski (RETIRED)
on 2010-09-10 14:34:06 UTC
(
hide
)
Description:
functions.sh-is_mounted-is_clean.patch
Filename:
MIME Type:
Creator:
Amadeusz Żołnowski (RETIRED)
Created:
2010-09-10 14:34:06 UTC
Size:
1.84 KB
patch
obsolete
>Index: branches/baselayout-1_12/sbin/functions.sh >=================================================================== >--- branches/baselayout-1_12/sbin/functions.sh (revision 3174) >+++ branches/baselayout-1_12/sbin/functions.sh (working copy) >@@ -784,6 +784,55 @@ > echo "${result# *}" > } > >+# bool is_clean(dir) >+# >+# Returns 0 if given directory has no files or has only dot-prefixed files. >+# >+# EXAMPLE: if is_clean /proc; then ... >+is_clean() { >+ for f in $1/*; do >+ [[ -e $f || -L $f ]] && return 1 >+ done >+ return 0 >+} >+ >+# bool is_mounted(mount point, device) >+# >+# 'device' is optional. >+# >+# If no 'device' is specified, returns 0 if 'mount point' is really a mount >+# point or 1 if it's not. >+# >+# If 'device' is specified returns 0 if the exact 'device' is mounted under >+# 'mount point'. The check is done in /proc/mounts (for /proc there's check >+# for existence of /proc/mounts). Otherwise returns 2. >+# >+# EXAMPLE: if is_mounted /dev/pts devpts; then ... >+is_mounted() { >+ local mnt_point="$1" dev="$2" >+ >+ mountpoint -q "${mnt_point}" || return 1 >+ >+ # Check if under $mnt_point really $dev is mounted >+ if [[ ${dev} ]]; then >+ if [[ ${dev} =~ ^/?proc$ ]]; then >+ [[ -f /proc/mounts ]] || { >+ eerror "Something else than 'procfs' is mounted under '/proc'!" >+ return 2 >+ } >+ else >+ [[ -f /proc/mounts ]] || eerror "No '/proc/mounts'. '/proc' have to be mounted!" >+ >+ while read; do >+ [[ ${REPLY} =~ ^/?${dev}\ .*${mnt_point}\ ]] && return 0 >+ done < /proc/mounts >+ >+ eerror "Another device is mounted under '${mnt_point}' where '${dev}' was expected!" >+ return 2 >+ fi >+ fi >+} >+ > ############################################################################## > # # > # This should be the last code in here, please add all functions above!! #
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 336723
:
246715
|
246716
|
247871
|
248375
|
248377