Changeset b611b6c


Ignore:
Timestamp:
01/10/14 09:09:10 (8 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
b5fd988
Parents:
e8d79fa
Message:

Update to the PBI startup routine

  • Speed up the startup time of PBIs by about 50%
  • Make sure user-mounted media / dirs are available in the container
  • Cleanup how we umount the container, parse the actual mounted list
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-sh/pbi-manager/pbime/pbimount

    ra7429d5 rb611b6c  
    4040 
    4141mount_dirs() { 
     42 
     43   # Check some of the common items to mount into the PBI container 
    4244   is_mounted "${pDir}/virtbase" || $NULLFS / "${pDir}/virtbase" 
    4345   is_mounted "${pDir}/virtbase/dev" || mount -t devfs devfs "${pDir}/virtbase/dev" 
     
    4547   is_mounted "${pDir}/virtbase/var/run" || $NULLFS ${pDir}/run "${pDir}/virtbase/var/run" 
    4648   is_mounted "${pDir}/virtbase/compat/linux" || $NULLFS ${1}/linux "${pDir}/virtbase/compat/linux" 
     49 
     50   # Sort out the items to mount into the PBI container 
     51   for i in `mount | grep -e "(zfs" -e "(smbfs" -e "(nfs" -e "(ufs" -e "(msdos" -e "(ntfs" | grep -e "on /" | grep -v "/usr/jails" | grep -v "/usr/pbi" | grep -v "/usr/local" | awk '{print $3}'` 
     52   do 
     53     if [ "$i" = "/" ] ; then continue ; fi 
     54     is_mounted "${pDir}/virtbase${i}" || $NULLFS ${i} "${pDir}/virtbase${i}" 
     55   done 
     56 
     57   # Mount any system-wide fonts / cursors / icons into the PBI container 
    4758   if [ -d "${pDir}/virtbase/usr/local/etc/fonts" ] ; then 
    4859      is_mounted "${pDir}/virtbase/usr/local/etc/fonts" || $NULLFS /usr/local/etc/fonts "${pDir}/virtbase/usr/local/etc/fonts" 
     
    5465      is_mounted "${pDir}/virtbase/usr/local/lib/X11/icons" || $NULLFS /usr/local/lib/X11/icons "${pDir}/virtbase/usr/local/lib/X11/icons" 
    5566   fi 
    56    is_mounted "${pDir}/virtbase/tmp" || $NULLFS /tmp "${pDir}/virtbase/tmp" 
    57    is_mounted "${pDir}/virtbase/usr/home" || $NULLFS /usr/home "${pDir}/virtbase/usr/home" 
    5867 
    59    # Check if we need to mount linprocfs 
     68   # Check if we need to mount linprocfs in the PBI container 
    6069   if [ -d "${pDir}/virtbase/compat/linux/proc" ] ; then 
    6170      is_mounted "${pDir}/virtbase/compat/linux/proc" || mount -t linprocfs linproc "${pDir}/virtbase/compat/linux/proc" 
    6271   fi 
    63  
    64    for i in `ls -d /usr/home/* 2>/dev/null` 
    65    do 
    66       is_mounted "${i}"  
    67       if [ $? -eq 0 ] ;then 
    68          is_mounted "${pDir}/virtbase${i}" || $NULLFS ${i} "${pDir}/virtbase${i}" 
    69       fi 
    70  
    71    done 
    7272 
    7373   sync 
     
    8282   cp /usr/pbi/.ldconfig "${pDir}/virtbase/var/run/ldconfig" 
    8383   chroot "${pDir}/virtbase" /var/run/ldconfig start >/dev/null 2>/dev/null 
    84    sleep 1 
     84   sleep 0.2 
    8585   sync 
    8686} 
    8787 
    8888umount_pbidir() { 
    89    is_mounted "${pDir}/virtbase/usr/local/etc/fonts" && umount ${pDir}/virtbase/usr/local/etc/fonts 
    90    is_mounted "${pDir}/virtbase/usr/local/etc" && umount ${pDir}/virtbase/usr/local/etc 
    91    is_mounted "${pDir}/virtbase/usr/local/lib/X11/fonts" && umount ${pDir}/virtbase/usr/local/lib/X11/fonts 
    92    is_mounted "${pDir}/virtbase/usr/local/lib/X11/icons" && umount ${pDir}/virtbase/usr/local/lib/X11/icons 
    93    is_mounted "${pDir}/virtbase/usr/local" && umount ${pDir}/virtbase/usr/local 
    94    is_mounted "${pDir}/virtbase/tmp" && umount ${pDir}/virtbase/tmp 
    95    is_mounted "${pDir}/virtbase/dev" && umount ${pDir}/virtbase/dev 
    96    is_mounted "${pDir}/virtbase/var/run" && umount ${pDir}/virtbase/var/run 
    97    is_mounted "${pDir}/virtbase/compat/linux/proc" && umount ${pDir}/virtbase/compat/linux/proc 
    98    is_mounted "${pDir}/virtbase/compat/linux" && umount ${pDir}/virtbase/compat/linux 
    99    for i in `ls -d ${pDir}/virtbase/usr/home/* 2>/dev/null` 
     89   for i in `mount | grep "on ${pDir}" | tail -r | awk '{print $3}'` 
    10090   do 
    101       is_mounted "${i}" && umount ${i} 
     91     echo "Unmounting ${i}" 
     92     umount -f ${i} 
     93     sleep 0.1 
    10294   done 
    103    is_mounted "${pDir}/virtbase/usr/home" && umount ${pDir}/virtbase/usr/home 
    104    is_mounted "${pDir}/virtbase" && umount ${pDir}/virtbase 
    10595} 
    10696 
     
    129119check_pbidir "${2}" 
    130120mount_dirs "${2}" 
    131 mount_dirs "${2}" 
Note: See TracChangeset for help on using the changeset viewer.