dir2sfs 696 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. . /etc/DISTRO_SPECS
  3. t=`echo "$1" | sed "s/\/$//"`
  4. z=`echo "$1" | sed "s/\/$//"`
  5. if [ ! -d "$t" ];then
  6. echo "error: no valid folder specified!"
  7. exit 0
  8. fi
  9. ### if no _versionnummer in the end, get it from system
  10. check=`echo $t | sed "s/\(.*\)_[0-9][0-9][0-9]$/\1/"`
  11. #echo --- $check
  12. if [ "$check" == "$t" ];then
  13. v=$DISTRO_VERSION
  14. z="${check}_$v"
  15. fi
  16. #echo $t - $z
  17. if [ -f "$z.sfs" ];then
  18. echo "$z.sfs already exists, refusing to overwrite it!"
  19. exit 0
  20. fi
  21. mksquashfs "$t" "$z.sfs"
  22. md5sum "$z.sfs" > "$z.sfs-md5.txt"
  23. sync
  24. echo
  25. echo
  26. s=`du -m "$z.sfs" | sed "s/\s.*//"`
  27. echo "created: $z.sfs ( $s MB )"
  28. echo "created: $z.sfs-md5.txt"
  29. echo
  30. echo "...byebye..."
  31. echo