Advertisement
lukves-sk

Script for Slax

Aug 6th, 2019
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.03 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. TMP=/tmp/tmpfs$$
  4. CHANGES=$TMP/changes
  5. UNION=$TMP/union
  6. BUNDLES=/run/initramfs/memory/bundles/
  7. INSTALL="$1"
  8. [ -n "$INSTALL" ] || exit
  9.  
  10.  
  11. mkdir -p $TMP
  12. mount -t tmpfs tmpfs $TMP
  13. mkdir -p $CHANGES
  14. mkdir -p $UNION
  15.  
  16. mount -t aufs -o xino=$TMP/.xino,trunc_xino,br=$CHANGES aufs $UNION
  17. # I don't use chromium so filter it out.
  18. \ls -1d $BUNDLES[0-1]* | grep -v chromium | while read MOD; do
  19. mount -o remount,add:1:$BUNDLES/$(basename $MOD)=ro aufs $UNION
  20. done
  21.  
  22. for d in boot dev proc sys tmp media mnt run; do
  23.    mkdir -p $UNION/$d
  24. done
  25.  
  26. chmod ugo+rwx $UNION/tmp
  27.  
  28. mount --bind /dev $UNION/dev
  29. mount --bind /proc $UNION/proc
  30. mount --bind /sys $UNION/sys
  31.  
  32. echo "apt-get update; apt-get install --yes $INSTALL" >$UNION/doit
  33. chmod ugo+x $UNION/doit
  34. cp /etc/resolv.conf $UNION/etc/
  35. chroot $UNION /doit
  36.  
  37. umount $UNION/sys
  38. umount $UNION/proc
  39. umount $UNION/dev
  40. rm $CHANGES/doit
  41. rmdir $CHANGES/* 2>/dev/null
  42. savechanges /"$INSTALL".sb $CHANGES
  43.  
  44. umount $UNION
  45. umount $TMP
  46. rmdir $TMP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement