Advertisement
Guest User

archfs

a guest
Oct 12th, 2012
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # Archfs - entirely copied from part of the Tazusb utility supplied with
  4. # SLiTaz GNU Linux - with some cosmetic changes.
  5. #
  6. #
  7. ### Tazusb - SliTaz LiveUSB
  8. ###
  9. ### Tazusb is an utility to generate, configure and manipulate SliTaz LiveUSB
  10. ### bootable media and/or USB /home partition, such as flash keys, SD card or
  11. ### USB harddisk.
  12. ###
  13. ### Authors : Christophe Lincoln (Pankso) <pankso@slitaz.org>
  14. ### Andrew Miller (Spode) <spode@spodesabode.com>
  15. #
  16. COMMAND=$1
  17.  
  18. case $COMMAND in
  19. writefs)
  20. # Writefs to rootfs.gz
  21. if [ -z $2 ]; then
  22. COMPRESSION=none
  23. else
  24. COMPRESSION=$2
  25. fi
  26. # Start info
  27. echo ""
  28. echo -e "\033[1mWrite filesystem\033[0m
  29. ===============================================================================
  30. The command writefs will write all the current filesystem into a suitable cpio
  31. archive (rootfs.gz) usable on a bootable LiveUSB media.
  32.  
  33. Archive compression: $COMPRESSION"
  34. echo ""
  35. # Create list of files
  36. find /bin /etc /init /sbin /var /lib /lib64 /root /usr >/tmp/list
  37.  
  38. for dir in /boot /dev /home /proc /sys /tmp /mnt /media /run
  39. do
  40. echo $dir >>/tmp/list
  41. done
  42.  
  43.  
  44. # Generate initramfs with specified compression
  45. if [ "$COMPRESSION" = "lzma" ]; then
  46. echo -n "Creating archfs.gz with lzma compression... "
  47. cat /tmp/list | cpio -o -H newc | lzma > /archfs.gz
  48.  
  49. elif [ "$COMPRESSION" = "gzip" ]; then
  50. echo -n "Creating archfs.gz with gzip compression... "
  51. cat /tmp/list | cpio -o -H newc | gzip -9 > /archfs.gz
  52.  
  53. else
  54. echo -n "Creating archfs.gz without compression... "
  55. cat /tmp/list | cpio -o -H newc > /archfs.gz
  56. fi
  57.  
  58.  
  59. # Get initramfs size
  60. size=`du -sh /archfs.gz | cut -f 1`
  61.  
  62.  
  63. echo "==============================================================================="
  64. echo "Root filesystem size: $size"
  65. echo ""
  66. echo -en "----\nENTER to continue..."; read i
  67. ;;
  68. esac
  69.  
  70. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement