Magellan Linux

Diff of /trunk/installer-simple/functions/hwdetection.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2407 by niro, Tue Jan 7 13:24:37 2014 UTC revision 2408 by niro, Tue Jan 7 13:25:22 2014 UTC
# Line 315  EOF Line 315  EOF
315   ${chroot} mkinitrd -f ${initrd} ${kernel}   ${chroot} mkinitrd -f ${initrd} ${kernel}
316  }  }
317    
318    is_mounted()
319    {
320     local item
321     local mount
322     local method
323     method="$1"
324     item="$2"
325    
326     [ -e /proc/mounts ] || return 1
327    
328     case ${method} in
329     --location) mount="$(grep "[[:space:]]${item}[[:space:]]" /proc/mounts | cut -d ' ' -f2)" ;;
330     --device) mount="$(grep "^${item}[[:space:]]" /proc/mounts | cut -d ' ' -f1)" ;;
331     --filesystem) mount="$(grep "[[:space:]]${item}[[:space:]]" /proc/mounts | cut -d ' ' -f3)" ;;
332     *) echo "unknown method '${method}'"; return 1 ;;
333     esac
334     [[ ${mount} != ${item} ]] && return 1
335    
336     return 0
337    }
338    
339  chrooted()  chrooted()
340  {  {
341   local cmd="$@"   local cmd="$@"
342    
343   mount -t sysfs sysfs ${INSTALL_ROOT}/sys   is_mounted --location ${INSTALLROOT}/sys || mount -t sysfs sysfs ${INSTALLROOT}/sys
344   mount -t proc proc ${INSTALL_ROOT}/proc   is_mounted --location ${INSTALLROOT}/proc || mount -t proc proc ${INSTALLROOT}/proc
345   mount -o bind /dev ${INSTALL_ROOT}/dev   is_mounted --location ${INSTALLROOT}/dev || mount -o bind /dev ${INSTALLROOT}/dev
346    
347   chroot ${INSTALL_ROOT} ${cmd}   chroot ${INSTALLROOT} ${cmd}
348    
349   umount ${INSTALL_ROOT}/dev   is_mounted --location ${INSTALLROOT}/dev && umount ${INSTALLROOT}/dev
350   umount ${INSTALL_ROOT}/proc   is_mounted --location ${INSTALLROOT}/proc && umount ${INSTALLROOT}/proc
351   umount ${INSTALL_ROOT}/sys   is_mounted --location ${INSTALLROOT}/sys && umount ${INSTALLROOT}/sys
352  }  }

Legend:
Removed from v.2407  
changed lines
  Added in v.2408