Fw: iso vfs for mc

Adam Byrtek / alpha alpha at student.uci.agh.edu.pl
Tue Apr 29 14:08:14 UTC 2003


----- Forwarded message from Dmitry Borodaenko <d.borodaenko at sam-solutions.net> -----

Date: Tue, 29 Apr 2003 12:50:30 +0300
From: Dmitry Borodaenko <d.borodaenko at sam-solutions.net>
To: Adam Byrtek / alpha <alpha at student.uci.agh.edu.pl>
Cc: Michael Shigorin <mike at osdn.org.ua>
Subject: iso vfs for mc

Hello Adam!

Attached is extfs script for entering iso images from mc without having
to loop-mount them. I assume that its author, Michael Shigorin, has no
objections against including it under mc's GPL license ;-)

-- 
Dmitry Borodaenko

#! /bin/sh

# ISO9660 VFS for MC by Michael Shigorin <mike at altlinux.org>   April 2003
# based on lslR by Tomas Novak <tnovak at ipex.cz>   April 2000
# -- look there for additional parsing comments if needed

# tested to comply with isoinfo 2.0's output

test_iso () {
    for i in '-J -R' '-J' '-R'; do
	ISOINFO="isoinfo $i"
	$ISOINFO "$1" >/dev/null 2>&1 && break
    done
}

mcisofs_list () {
case "$1" in
  *.bz2) MYCAT="bzip2 -dc";;
  *.gz)  MYCAT="gzip -dc";;
  *.z)   MYCAT="gzip -dc";;
  *.Z)   MYCAT="gzip -dc";;
  *)     MYCAT="cat";;
esac

$ISOINFO -l -i "$1" | gawk '
BEGIN {
  dir="";
  # Pattern to match 8 first fields.
  rx = "[^ 	]+[ 	]+";
  rx = "^" rx rx rx rx rx rx rx rx;
  irx = "^. *[0-9]+.  ";
}
/^$/ { next }
/^d---------/ { next }
/^Directory listing of [^ 	].*$/ {
  dir=substr($0, 23);
  next;
}
{ $11 != "" } {
  name=$0
  sub(rx, "", name)
  attr=substr($0, 1, length($0)-length(name))
  # strip inodes and extra dir entries; fix perms
  sub(irx, "", name)
  sub("^----------   0    0    0", "-r--r--r--   1 root root", attr)
  sub(" $", "", name)
  # skip . and ..
  if (name ~ /^\.\.?/) next;
  printf "%s%s%s\n", attr, dir, name
}' 
}

mcisofs_copyout () {
	$ISOINFO -i "$1" -x "/$2" > "$3" 
}

export LC_ALL="C"

case "$1" in
  list) test_iso "$2"; mcisofs_list "$2"; exit 0;;
  copyout) test_iso "$2"; mcisofs_copyout "$2" "$3" "$4"; exit 0;;
esac
exit 1


----- End forwarded message -----

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha               alpha at debian.org
 (_|||_)| |(_|   :  http://krakow.linux.org.pl/        pgp 0xB25952C0
     |           



More information about the mc-devel mailing list