Skip to contentSkip to conversation

use lib function dir_ismounted in convertfs module

PATCH Superseded Dave Young 1 participant 1 message Sep 17, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Dave Young

author
#0 lore raw

PATCH 3/3 use lib function dir_ismounted in convertfs module

convertfs module use a private function of ismounted(), this is duplicate of the one in dracut-lib.sh.

Change to use global dir_ismounted

---
 modules.d/30convertfs/convertfs.sh |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
modules.d/30convertfs/convertfs.sh +3 -8
@@ -9,6 +9,8 @@ if [[ ! -d "$ROOT" ]]; then
     exit 1
 fi
 
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+
 if [[ "$ROOT" -ef / ]]; then
     echo "Can't convert the running system."
     echo "Please boot with 'rd.convertfs' on the kernel command line,"
@@ -73,13 +75,6 @@ if [[ ! -e "$testfile" ]]; then
 fi
 rm -f "$testfile"
 
-ismounted() {
-    while read a m a; do
-        [[ "$m" = "$1" ]] && return 0
-    done < /proc/mounts
-    return 1
-}
-
 # clean up after ourselves no matter how we die.
 cleanup() {
     echo "Something failed. Move back to the original state"
@@ -98,7 +93,7 @@ cleanup() {
 trap 'ret=$?; [[ $ret -ne 0 ]] && cleanup;exit $ret;' EXIT
 trap 'exit 1;' SIGINT
 
-ismounted "$ROOT/usr" || CP_HARDLINK="-l"
+dir_ismounted "$ROOT/usr" || CP_HARDLINK="-l"
 
 set -e