Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (2) </ [1] 2 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: ISO image maker< Next Oldest | Next Newest >
Zucca Offline





Group: Members
Posts: 524
Joined: Feb. 2006
Posted: Mar. 06 2008,01:36 QUOTE

First I just thought to add an alias, but then I found myself scripting...

In case anyone finds this useful... Does it work on DSL?
Code Sample
#!/bin/bash

# Bash script for making CD-images out of files and/or directories easily.
# Burned images should work with old CD drives as well with new ones
# and with many OS:es too.
# May not work if you specify multiple files/directories to add... But should.;)

# Copyright Zucca. Licence: public domain.

if [ -z "$1" ]
then
   echo "Nothing to do. --help for help." >&2
   exit 1
fi

case $1 in
   --help)
       echo -e "USAGE: `basename $0` [-bz] <imgfile> <contents for ISO image>\n -bz makes image compressed."
       echo "If \"imgfile\" is -, then output will be directed to stdout."
       ;;
   *)
   
   if [ -z "$2" ]
   then
       echo "Missing arguments." >&2
       exit 1
   elif which mkisofs &> /dev/null
   then
       
       MKISOFSOPTS="-JR -file-mode 0444 -dir-mode 0555"
       
       case $1 in
           -bz)
               # Zipping
               
               BZIPCOMMAND="bzip2 -vzc9"
               
               if [ -z "$3" ]
               then
                   echo "Missing arguments." >&2
                   exit 1
               elif ! which bzip2 &> /dev/null
               then
                   echo "bzip2 isn't in your \$PATH or isn't installed. Do not use -bz option" >&2
                   exit 1
               elif [ "$2" != "-" ]
               then
                   DESTFILE="$2"
                   shift
                   shift
                   # To file
                   mkisofs $MKISOFSOPTS $@ | $BZIPCOMMAND > $DESTFILE
               else
                   # To stdout
                   shift
                   shift
                   mkisofs $MKISOFSOPTS $@ | $BZIPCOMMAND
               fi
           ;;
           *)
               # No zipping
               DESTFILE="$1"
               shift
               case $DESTFILE in
                   -)
                       # To stdout
                       mkisofs $MKISOFSOPTS $@
                   ;;
                   *)
                       # To file
                       mkisofs $MKISOFSOPTS -o $DESTFILE $@
                   ;;
               esac
           ;;
       esac
   else
       echo "mkisofs isn't in your \$PATH or isn't installed." >&2
       exit 1
   fi
esac


I'd add a size limit there if I knew the precise size of 650Mb CD. Anyone know this?
Or any other suggestions?


--------------
Do you have it? - http://dy.fi/mak
Back to top
Profile PM WEB ICQ MSN 
Zucca Offline





Group: Members
Posts: 524
Joined: Feb. 2006
Posted: Mar. 06 2008,11:58 QUOTE

I found a quite good page about the actual size of CD.

Here's in short:
Quote
Spelled out simply:


 21 minutes ==  94,500 sectors == 184.6MB CD-ROM == 212.0MB CD-DA
 63 minutes == 283,500 sectors == 553.7MB CD-ROM == 635.9MB CD-DA
 74 minutes == 333,000 sectors == 650.3MB CD-ROM == 746.9MB CD-DA
 80 minutes == 360,000 sectors == 703.1MB CD-ROM == 807.4MB CD-DA
 90 minutes == 405,000 sectors == 791.0MB CD-ROM == 908.4MB CD-DA
 99 minutes == 445,500 sectors == 870.1MB CD-ROM == 999.3MB CD-DA


--------------
Do you have it? - http://dy.fi/mak
Back to top
Profile PM WEB ICQ MSN 
^thehatsrule^ Offline





Group: Members
Posts: 3275
Joined: July 2006
Posted: Mar. 06 2008,14:40 QUOTE

What about DVDs then?

You can also use single quotes so that you don't have to escape certain characters on your output strings.

Any reason for making this a bash-specific script?
Back to top
Profile PM 
Zucca Offline





Group: Members
Posts: 524
Joined: Feb. 2006
Posted: Mar. 06 2008,16:55 QUOTE

Quote (^thehatsrule^ @ Mar. 06 2008,11:40)
What about DVDs then?

You can also use single quotes so that you don't have to escape certain characters on your output strings.

Any reason for making this a bash-specific script?

I could add DVD image creating too.
Anyway. I designed this script primary for myself. Later I decided to share this.

Bash is common and I don't know much perl or any other language suitable for this. Well... I could do this with php, but then there would be php depency. ;P


--------------
Do you have it? - http://dy.fi/mak
Back to top
Profile PM WEB ICQ MSN 
curaga Offline





Group: Members
Posts: 2163
Joined: Feb. 2007
Posted: Mar. 06 2008,17:13 QUOTE

I guess hats meant it has some bash-specific syntax, so it might or might not work with ash, dash, lash, etc. other shells. Though bash is a standard component, so you're likely to find it on any linux system.

--------------
There's no such thing as life. Those mean little jocks invented it ;)
-
Windows is not a virus. A virus does something!
Back to top
Profile PM 
5 replies since Mar. 06 2008,01:36 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (2) </ [1] 2 >/
reply to topic new topic new poll
Quick Reply: ISO image maker

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code