s243a

mount_rootfs (tazpup64 buildkit pre-alpha)

Feb 26th, 2019
124
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. curdir=`pwd`
  3. unmount_vfs(){
  4.  umount -l $curdir/slitaz-rootfs/dev 2>/dev/null
  5.  umount -l $curdir/slitaz-rootfs/sys 2>/dev/null
  6.  umount -l $curdir/slitaz-rootfs/proc 2>/dev/null
  7.  umount /mnt/wktaz 2>/dev/null
  8.  umount /mnt/wksfs 2>/dev/null
  9. }  
  10.  
  11. trap unmount_vfs EXIT
  12. trap unmount_vfs SIGKILL
  13. trap unmount_vfs SIGTERM
  14. xinteractive=1
  15. echo "PUPMODE='2'" > $curdir/slitaz-rootfs$prefix/etc/rc.d/PUPSTATE
  16. mkdir -p $curdir/slitaz-rootfs/proc;
  17. mkdir -p $curdir/slitaz-rootfs/sys
  18.  
  19. mount -o rbind /proc $curdir/slitaz-rootfs/proc
  20. mount -t sysfs none $curdir/slitaz-rootfs/sys
  21. if [ $xinteractive -eq 1 ]; then
  22.  echo "Removing block device files..."
  23.  #rm -rf $curdir/slitaz-rootfs/dev/*
  24.  #mount bind -t devtmpfs none $curdir/slitaz-rootfs/dev
  25.  mount -o rbind /dev $curdir/slitaz-rootfs/dev
  26.  cp -f /etc/resolv.conf $curdir/slitaz-rootfs/etc/resolv.conf
  27. fi
  28.  
  29. chroot $curdir/slitaz-rootfs /bin/bash
  30.  
  31.  
  32. if [ "$(mount | grep "$curdir/slitaz-rootfs/dev")" != "" ]; then
  33.  umount -l $curdir/slitaz-rootfs/dev
  34. fi 
  35.  
  36. if [ "$(mount | grep "$curdir/slitaz-rootfs/sys")" != "" ]; then
  37.  umount -l $curdir/slitaz-rootfs/sys
  38. fi 
  39. if [ "$(mount | grep "$curdir/slitaz-rootfs/proc")" != "" ]; then
  40.  umount -l $curdir/slitaz-rootfs/proc
  41. fi
RAW Paste Data