Fedora Linux Support Community & Resources Center
  #1  
Old 5th October 2004, 06:00 PM
satimis Offline
Registered User
 
Join Date: Jul 2004
Posts: 1,386
Seeking advice on script

Hi folks,

I have following script saved to /usr/sbin/make_iso_file

1)
Code:
function make_iso_file ()
{
    # initialize the following loop
    # we're going to build the args to mkisofs, set it to the empty string
    mkisofs_args="-R -o Image.iso -J -hide-rr-moved Document=/home/satimis/Document Photo=/home/satimis/Photo"
    # and set the paths variable to all the remaining command-line arguments
    paths="$@"
    # and now iterate through all paths given on the command-line
    for path in $paths
    do
        # for each path given, add the appropriate graft-point to mkisofs's arguments
        mkisofs_args="${mkisofs_args} ${path##*/}=${path}"
    done

    # and now call mkisofs
    mkisofs $mkisofs_args
}

2)
My goal is to create an ISO image applying following command line

# mkisofs -R -o Image.iso -J -hide-rr-moved Document=/path/to/Document Photo=/path/to/Photo"

from following directories;
Document=/path/to/Document
Photo=/path/to/Photo

plus argument for adding further directories with variated path, such as

dir-A=/path/to/dir-A
dir-B=/path/to/dir-B
etc.

which are added during executing the file "make_iso_file"

3)
# chmod +x /usr/sbin/make_iso_file

4)
# /usr/sbin/make_iso_file
/usr/sbin/make_iso_file: line 15: unexpected EOF while looking for matching `''
/usr/sbin/make_iso_file: line 22: syntax error: unexpected end of file

Kindly advise how to fix the problem. TIA

B.R.
satimis
Reply With Quote
  #2  
Old 6th October 2004, 04:51 AM
crackers's Avatar
crackers Offline
Retired Community Manager
 
Join Date: Feb 2004
Location: Seattle, WA, USA
Age: 56
Posts: 3,423
If that's the entire contents of the script file, then, no, it's not going to work. There's two issues at first glance:

1) The first line of the script needs to be
Code:
#!/bin/sh
2) You've only written a function - there's nothing in what you posted that executes that function.

I don't know if that's the issue, though, but it's at least a starting point...
__________________
Linux User #28251 (April '93)
Professional Java Geek :cool:
Reply With Quote
  #3  
Old 11th October 2004, 12:08 PM
satimis Offline
Registered User
 
Join Date: Jul 2004
Posts: 1,386
Hi crackers,

Tks for your advice. Now I re-arrange the scipt as follow and save it /home/satimis/mkiso_new;

[satimis@localhost satimis]$ cat mkiso_new

Code:
#!/bin/sh

ISO_FILE=/home/satimis/To_burn/Image.iso

mkisofs_args="-R -o ${ISO_FILE} -l -hide-rr-moved \
Document=/home/satimis/Document \
Photo=/home/satimis/Photo \
Working=/home/satimis/Working"

#  set the paths variable to all the remaining command-line arguments
paths="$@"

echo "Remaining arguments ${paths}"

# iterate through all paths given on the command-line

for path in $paths
    do
        if [ -d $path ] ; then
            echo "Adding ${path}"
        else
            echo "Dir ${path} doesn't exist"
            exit 1
        fi

        # for each path given, add the appropriate graft-point to mkisofs's arguments
        mkisofs_args="${mkisofs_args} ${path##*/}=${path}"

    done

# and now call mkisofs
1)
# sh -vx ./mkiso_new
Code:
#!/bin/sh

ISO_FILE=/home/satimis/To_burn/Image.iso
+ ISO_FILE=/home/satimis/To_burn/Image.iso

mkisofs_args="-R -o ${ISO_FILE} -l -hide-rr-moved \
Document=/home/satimis/Document \
Photo=/home/satimis/Photo \
Working=/home/satimis/Working"
+ mkisofs_args=-R -o /home/satimis/To_burn/Image.iso -l -hide-rr-moved Document=/home/satimis/Document Photo=/home/satimis/Photo Working=/home/satimis/Working

#  set the paths variable to all the remaining command-line arguments
paths="$@"
+ paths=

echo "Remaining arguments ${paths}"
+ echo 'Remaining arguments '
Remaining arguments

# iterate through all paths given on the command-line

for path in $paths
    do
        if [ -d $path ] ; then
            echo "Adding ${path}"
        else
            echo "Dir ${path} doesn't exist"
            exit 1
        fi

        # for each path given, add the appropriate graft-point to mkisofs's arguments
        mkisofs_args="${mkisofs_args} ${path##*/}=${path}"

    done

# and now call mkisofs
2)
[root@localhost satimis]# ./mkiso_new /home/satimis/Working
Remaining arguments /home/satimis/Working
Adding /home/satimis/Working

[root@localhost satimis]# ls /home/satimis/To_burn/
Image.iso

[root@localhost satimis]# mount -t iso9660 /home/satimis/To_burn/Image.iso -o loop /mnt/floppy

Files can be read.

[root@localhost satimis]# umount /mnt/floppy


3)
[root@localhost satimis]# rm /home/satimis/To_burn/Image.iso


[root@localhost satimis]# ./mkiso_new /home/satimis/Working

[root@localhost satimis]# ./mkiso_new /home/satimis/Document
/homesatimis/Photo
/home/satimis/Working

[root@localhost satimis]# ./mkiso_new /home/satimis/Document/
/homesatimis/Photo/
/home/satimis/Working/

None of them can create Image.iso

Remark:

Code:
[root@localhost satimis]# ./mkiso_new /home/satimis/Working
Remaining arguments /home/satimis/Working
Adding /home/satimis/Working

etc.  indicated.
I can't find out the cause.


4)
With following command, Image.iso can be creaded

# mkisofs -R -o /home/satimis/To_burn/Image.iso -l -graft-point -hide-rr-moved /Document/=/home/satimis/Document/ /Photo/=/home/satimis/Photo/ /Working/=/home/satimis/Working/
......
Total translation table size: 0
Total rockridge attributes bytes: 735885
Total directory bytes: 1953792
Path table size(bytes): 14456
Max brk space used 5e2000
138979 extents written (271 MB)

Image.iso created on /home/satimis/To_burn

Could you please shed me some light. TIA

B.R.
satimis
Reply With Quote
  #4  
Old 11th October 2004, 05:13 PM
satimis Offline
Registered User
 
Join Date: Jul 2004
Posts: 1,386
Hi folks,

Further to my last posting, following script works without problem

[satimis@localhost satimis]$ cat mkiso_01.iso
Code:
#!/bin/sh

ISO_FILE=/home/satimis/To_burn/Image.iso

mkisofs -R -o ${ISO_FILE} -l -graft-point -hide-rr-moved \
/Document/=/home/satimis/Document/ \
/Photo/=/home/satimis/Photo/ \
/Working/=/home/satimis/Working/
[satimis@localhost satimis]$ ./mkiso_01.iso
Code:
INFO:   UTF-8 character encoding detected by locale settings.
        Assuming UTF-8 encoded filenames on source filesystem,
        use -input-charset to override.
.......
.........
Total translation table size: 0
Total rockridge attributes bytes: 736242
Total directory bytes: 1953792
Path table size(bytes): 14456
Max brk space used 5e2000
138985 extents written (271 MB)
[satimis@localhost satimis]$ ls /home/satimis/To_burn/
Image.iso

An Image.iso was created under /home/satimis/To_burn/


Now the remaining works are;

1) How to make /Working/=/home/satimis/Working/ variable, keeping the other 2 directories permanent.

i.e.
/Working/=/home/satimis/Working/ plus
/dir-AAA/=/path/to/dir-AAA/
/dir-BBB/=/path/to/dir-BBB/
etc. can be added as optional. Or they can be ignored without added.

2) How to make "Image_01.iso" changed.

i.e. "01" can be changed to read as "02 or 03 or 04, etc."

TIA

B.R.
satimis
Reply With Quote
  #5  
Old 11th October 2004, 07:13 PM
tashirosgt Offline
Registered User
 
Join Date: Aug 2004
Posts: 3,857
The way I read your non-working script, it never executes the mkisofs command. It just builds the arguments to it. Did omit a line when you pasted in the message composition window?
__________________
"Never let the task you are trying to accomplish distract you from the study of computers."
Reply With Quote
  #6  
Old 12th October 2004, 03:22 AM
satimis Offline
Registered User
 
Join Date: Jul 2004
Posts: 1,386
Quote:
Originally Posted by tashirosgt
The way I read your non-working script, it never executes the mkisofs command. It just builds the arguments to it. Did omit a line when you pasted in the message composition window?
Hi tashirosgt,

Tks for your response.

I got the first script from a folk (say, folk-A) on another forum as follow but it did not work;
Code:
function make_iso_file ()
{
    # initialize the following loop
    # we're going to build the args to mkisofs, set it to the empty string
    mkisofs_args="-R -o Image.iso -J -hide-rr-moved Document=/home/satimis/Document Photo=/home/satimis/Photo"
    # and set the paths variable to all the remaining command-line arguments
    paths="$@"
    # and now iterate through all paths given on the command-line
    for path in $paths
    do
        # for each path given, add the appropriate graft-point to mkisofs's arguments
        mkisofs_args="${mkisofs_args} ${path##*/}=${path}"
    done

    # and now call mkisofs
    mkisofs $mkisofs_args
}
Another folk (say, folk-B) came and rearraged it as follow;
Code:
code:cat mkiso_satamis.txt                                                                                                               
#!/bin/sh

make_iso_file () {

    mkisofs_args="-R -o Image.iso -J -hide-rr-moved Document=/home/satimis/Document Photo=/home/satimis/Photo"

    #  set the paths variable to all the remaining command-line arguments
    paths="$@"
    echo "Remaining arguments ${paths}"

    # iterate through all paths given on the command-line
    for path in $paths
        do
            # for each path given, add the appropriate graft-point to mkisofs's arguments
            mkisofs_args="${mkisofs_args} ${path##*/}=${path}"
        done

    # and now call mkisofs
    echo "mkisofs $mkisofs_args"
}

make_iso_file  /home/j65nko/pic/rWedding /home/j65nko/pic/Birthday
I adjusted the 2nd script to suit my case. But unfortunately it still did not work. Then folk-B adjusted his scipt as follow;
Code:
#!/bin/sh

mkisofs_args="-R -o Image.iso -J -hide-rr-moved \
Document=/home/satimis/Document \
Photo=/home/satimis/Photo"

#  set the paths variable to all the remaining command-line arguments
paths="$@"

echo "Remaining arguments ${paths}"

# iterate through all paths given on the command-line

for path in $paths
    do
        if [ -d $path ] ; then 
            echo "Adding ${path}"
        else
            echo "Dir ${path} doesn't exist"
            exit 1
        fi

        # for each path given, add the appropriate graft-point to mkisofs's arguments
        mkisofs_args="${mkisofs_args} ${path##*/}=${path}"

    done

# and now call mkisofs

mkisofs ${mkisofs_args}
Sorry I omitted the last line "mkisofs ${mkisofs_args}"
But it still can't work. I tried it several times with different syntax without result.

# ./mkiso_new /home/satimis/Document
Quote:
........
mkisofs: Error: '/home/satimis/Document/Reference/LinuxPartitionHowTo-1/www.linu xplanet.com/linuxplanet/tutorials/3174/1/index.html' and '/home/satimis/Document /HardDrive_Partitioning_Moving_etc/LinuxPartitionHowTo-1/www.linuxplanet.com/lin uxplanet/tutorials/3174/1/index.html' have the same Rock Ridge name 'index.html' .
mkisofs: Error: '/home/satimis/Document/Reference/LinuxPartitionHowTo-1/www.linu xplanet.com/linuxplanet/tutorials/3174/1/index.html' and '/home/satimis/Document /HardDrive_Partitioning_Moving_etc/LinuxPartitionHowTo-1/www.linuxplanet.com/lin uxplanet/tutorials/3174/1/index.html' have the same Rock Ridge name 'index.html' .
mkisofs: Unable to sort directory /home/satimis/Document/HardDrive_Partitioning_ Moving_etc/LinuxPartitionHowTo-1/www.linuxplanet.com/linuxplanet/tutorials/3174/ 1
# ./mkiso_new /home/satimis/Document/
Code:
Remaining arguments /home/satimis/Document/
Adding /home/satimis/Document/
INFO:   UTF-8 character encoding detected by locale settings.
        Assuming UTF-8 encoded filenames on source filesystem,
        use -input-charset to override.
mkisofs: No such file or directory. Invalid node - =/home/satimis/Document/
Finally I created another script as listed on my last posting. It works for me. I repeat my script as follow;
Code:
#!/bin/sh

ISO_FILE=/home/satimis/To_burn/Image.iso

mkisofs -R -o ${ISO_FILE} -l -graft-point -hide-rr-moved \
/Document/=/home/satimis/Document/ \
/Photo/=/home/satimis/Photo/ \
/Working/=/home/satimis/Working/
Now what I'm trying to add are as follows;

1) How to make /Working/=/home/satimis/Working/ variable, keeping the other 2 directories
/Document/=/home/satimis/Document/
/Photo/=/home/satimis/Photo/
permanent.

i.e.
/Working/=/home/satimis/Working/ plus if needed
/dir-AAA/=/path/to/dir-AAA/
/dir-BBB/=/path/to/dir-BBB/
etc. can be added as optional. Or they can be ignored without added.

2) How to make "Image_01.iso" changed.

i.e. "01" can be changed to read as "02 or 03 or 04, etc."

TIA

B.R.
satimis
Reply With Quote
  #7  
Old 12th October 2004, 06:17 PM
tashirosgt Offline
Registered User
 
Join Date: Aug 2004
Posts: 3,857
It's going to be too confusing to talk about several scripts at once. What I notice about the "folk B adjusted his .." script is that you did not specify the option -graft-points to mkisofs (its "-graft-points" not "graft-point"). But you were trying to specify them in the arguments to mkisofs. What happens if you fix that?
__________________
"Never let the task you are trying to accomplish distract you from the study of computers."
Reply With Quote
  #8  
Old 26th October 2004, 01:17 PM
mugga's Avatar
mugga Offline
Registered User
 
Join Date: Sep 2004
Posts: 32
I don't know if this is a help, but I have created a couple of scripts called "makeISO" & "burnISO" that I use to create ISO images and then burn them...they are at my site here: http://mwynwood.com/bw/?module=portfolio

Hope they help...
__________________
Marcus Wynwood
www.mwynwood.com
Judge a man by his questions, not his answers – and don’t forget to add to peoples reputations!
If Windows sucked, it would be good for something ;)
Reply With Quote
Reply

Tags
advice, script, seeking

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Seeking advice on configuration satimis Hardware & Laptops 4 16th April 2009 09:16 PM
Seeking advice on HP printer satimis Hardware & Laptops 9 20th July 2007 03:51 PM
Nvidia, sli and fc6 :) seeking advice NEVERTRUSTPEAS Hardware & Laptops 9 9th April 2007 02:52 PM
Seeking advice on upgrading from FC3 to FC5 kwwall EOL (End Of Life) Versions 4 28th May 2006 06:10 PM
New to Linux seeking advice kolichina_s_s Programming & Packaging 2 13th April 2006 02:24 PM


Current GMT-time: 19:19 (Wednesday, 19-06-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat