Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 7th, 2013  |  syntax: Bash  |  size: 1.96 KB  |  views: 62  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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.  
  17.                 # Writefs to rootfs.gz
  18.                 if [ -z $1 ]; then
  19.                         COMPRESSION=none
  20.                 else
  21.                         COMPRESSION=$1
  22.                 fi
  23.                 # Start info
  24.                 echo ""
  25.                 echo -e "\033[1mWrite filesystem\033[0m
  26. ===============================================================================
  27. The command archfs will write all the current filesystem into a suitable cpio
  28. archive.
  29.  
  30. Archive compression: $COMPRESSION"
  31.                 echo ""
  32. # Create list of files
  33.                 find /bin /etc /init /sbin /var /lib /lib64 /root /usr >/tmp/list
  34.  
  35.                 for dir in /boot /dev /home /proc /sys /tmp /mnt /mnt/* /run
  36.                 do
  37.                         echo $dir >>/tmp/list
  38.                 done
  39.                
  40.        
  41.                 # Generate initramfs with specified compression
  42.                 if [ "$COMPRESSION" = "xz" ]; then
  43.                         echo -n "Creating archfs.xz with xz compression... "
  44.                         cat /tmp/list | cpio -o -H newc | xz > /archfs.xz
  45.  
  46.                 elif [ "$COMPRESSION" = "gzip" ]; then
  47.                         echo -n "Creating archfs.gz with gzip compression... "
  48.                         cat /tmp/list | cpio -o -H newc | gzip -9 > /archfs.gz
  49.                
  50.                 elif [ "$COMPRESSION" = "lzo" ]; then
  51.                         echo -n "Creating archfs.lzo with lzo compression... "
  52.                         cat /tmp/list | cpio -o -H newc | lzop -1 > /archfs.lzo
  53.  
  54.                 else
  55.                         echo -n "Creating archfs.img without compression... "
  56.                         cat /tmp/list | cpio -o -H newc > /archfs.img
  57.                 fi
  58.  
  59.  
  60.                 # Get initramfs size
  61.                 size=`du -sh /archfs.* | cut -f 1`
  62.  
  63.        
  64.                 echo "==============================================================================="
  65.                 echo "Root filesystem size: $size"
  66.                 echo ""
  67.                 echo -en "----\nENTER to continue..."; read i
  68.  
  69. exit 0