mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
shutils.in: Add get_fs_mount_point() function
Allow getting the mount point of a given filesystem. This is useful to detect the location of e.g. tracefs
This commit is contained in:
parent
fffa040792
commit
00a5bcb377
@ -10,6 +10,8 @@ SED=${SED:-$BUSYBOX sed}
|
|||||||
CAT=${CAT:-$BUSYBOX cat}
|
CAT=${CAT:-$BUSYBOX cat}
|
||||||
AWK=${AWK:-$BUSYBOX awk}
|
AWK=${AWK:-$BUSYBOX awk}
|
||||||
PS=${PS:-$BUSYBOX ps}
|
PS=${PS:-$BUSYBOX ps}
|
||||||
|
MOUNT=${MOUNT:-$BUSYBOX mount}
|
||||||
|
PRINTF=${PRINTF:-$BUSYBOX printf}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# CPUFrequency Utility Functions
|
# CPUFrequency Utility Functions
|
||||||
@ -319,6 +321,16 @@ get_android_system_id() {
|
|||||||
echo "$hardware/$kernel/$filesystem"
|
echo "$hardware/$kernel/$filesystem"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_fs_mount_point() {
|
||||||
|
local path=$(LC_ALL=C $MOUNT -t "$1" | $SED -n "s/$1 on \(.*\) type $1 .*/\1/p;q")
|
||||||
|
if [ "$path" == "" ]; then
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
$PRINTF "%s" "$path"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Main Function Dispatcher
|
# Main Function Dispatcher
|
||||||
################################################################################
|
################################################################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user