wok-current rev 943
xarchive: add misc fs support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Jun 24 16:09:58 2008 +0000 (2008-06-24) |
parents | 19e156dfc1af |
children | f862339df6c5 |
files | xarchive/stuff/slitaz-wrap.sh |
line diff
1.1 --- a/xarchive/stuff/slitaz-wrap.sh Tue Jun 24 15:43:13 2008 +0000 1.2 +++ b/xarchive/stuff/slitaz-wrap.sh Tue Jun 24 16:09:58 2008 +0000 1.3 @@ -35,6 +35,8 @@ 1.4 ISO_EXTS="iso" 1.5 SQUASHFS_EXTS="sqfs squashfs" 1.6 CROMFS_EXTS="cromfs" 1.7 +FS_EXTS="ext2 ext3 dos fat vfat fd fs loop" 1.8 +CLOOP_EXTS="cloop" 1.9 1.10 # Setup awk program 1.11 AWK_PROGS="mawk gawk awk" 1.12 @@ -210,6 +212,12 @@ 1.13 { 1.14 tmpfs="$(mktemp -d -t fstmp.XXXXXX)" 1.15 umnt="umount -d" 1.16 + case " $CLOOP_EXTS " in 1.17 + \ $1\ ) mount -o loop=/dev/cloop,ro "$archive" $tmpfs;; 1.18 + esac 1.19 + case " $FS_EXTS " in 1.20 + \ $1\ ) mount -o loop,rw "$archive" $tmpfs;; 1.21 + esac 1.22 case " $ISO_EXTS " in 1.23 \ $1\ ) mount -o loop,ro -t iso9660 "$archive" $tmpfs;; 1.24 esac 1.25 @@ -236,6 +244,10 @@ 1.26 shift; 1.27 done 1.28 fi;; 1.29 + add) tar cf - "$@" | ( cd $tmpfs ; tar xf - );; 1.30 + remove) while [ -n "$3" ]; do 1.31 + rm -rf $tmpfs/$3 1.32 + done;; 1.33 esac 1.34 $umnt $tmpfs 1.35 rmdir $tmpfs 1.36 @@ -246,7 +258,7 @@ 1.37 -i) # info: output supported extentions for progs that exist 1.38 for ext in $TAR_EXTS $GZIP_EXTS $BZIP2_EXTS $COMPRESS_EXTS $LZMA_EXTS \ 1.39 $CPIO_EXTS $CPIOGZ_EXTS $ZIP_EXTS $DEB_EXTS $RPM_EXTS \ 1.40 - $TAZPKG_EXTS $ISO_EXTS; do 1.41 + $TAZPKG_EXTS $ISO_EXTS $FS_EXTS; do 1.42 printf "%s;" $ext 1.43 if [ "$ext" = "zip" -a ! "$(which zip)" ]; then 1.44 echo warning: zip not found, extract only >/dev/stderr 1.45 @@ -259,6 +271,10 @@ 1.46 [ -x /bin/cromfs-driver ] && for ext in $CROMFS_EXTS; do 1.47 printf "%s;" $ext 1.48 done 1.49 + [ -d /lib/modules/$(uname -r)/kernel/drivers/block/cloop.ko ] && \ 1.50 + for ext in $CLOOP_EXTS; do 1.51 + printf "%s;" $ext 1.52 + done 1.53 printf "\n" 1.54 exit 1.55 ;; 1.56 @@ -486,7 +502,7 @@ 1.57 fi 1.58 done 1.59 1.60 - for ext in $ISO_EXTS $SQUASHFS_EXTS $CROMFS_EXTS; do 1.61 + for ext in $ISO_EXTS $SQUASHFS_EXTS $CROMFS_EXTS $CLOOP_EXTS $FS_EXTS; do 1.62 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then 1.63 loop_fs $ext stat 1.64 exit 1.65 @@ -497,6 +513,12 @@ 1.66 1.67 -a) # add to archive passed files 1.68 update_tar_cpio add_file "$@" 1.69 + for ext in $FS_EXTS; do 1.70 + if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then 1.71 + loop_fs $ext add "$@" 1.72 + exit 0 1.73 + fi 1.74 + done 1.75 which zip >/dev/null && for ext in $ZIP_EXTS; do 1.76 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then 1.77 # we only want to add the file's basename, not 1.78 @@ -528,6 +550,12 @@ 1.79 1.80 -r) # remove: from archive passed files 1.81 update_tar_cpio remove_file "$@" 1.82 + for ext in $FS_EXTS; do 1.83 + if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then 1.84 + loop_fs $ext remove "$@" 1.85 + exit 0 1.86 + fi 1.87 + done 1.88 which zip >/dev/null && for ext in $ZIP_EXTS; do 1.89 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then 1.90 zip -d "$archive" "$@" 1.91 @@ -608,7 +636,7 @@ 1.92 exit $status 1.93 fi 1.94 done 1.95 - for ext in $ISO_EXTS $SQUASHFS_EXTS $CROMFS_EXTS; do 1.96 + for ext in $ISO_EXTS $SQUASHFS_EXTS $CROMFS_EXTS $CLOOP_EXTS $FS_EXTS; do 1.97 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then 1.98 loop_fs $ext copy "$@" 1.99 exit 0