how to pin files to /tmp

Hi all,

Am currently working on editing a startup script that need me to copy a certain file from cdrom to /tmp (its a live cd am working on)and mount if from there to certain place..

Now i know that nothing can be stored in /tmp permanently ,however mechanism to load the file to /tmp on every boot is possible...
So i would like to know how it could be done.

Here is what i have tried (this editing that ive done is on the script that is necessary to boot properly, so there is no other script that i can code this line into ,in the pretext of making it work)
cp /.cdrom/<file> /tmp/

i included this into the script and try to boot ,but a regular cp command doesnt seem to be working...
However there are a few file that are already present on /tmp, if i can know how they were loaded ,i could use the same method..

please help

Thanks

cp ought to work, do you get any error message? Is the /.cdrom/ device available at that point (or is it a static file in the root file system)?

I do get an error message but that is difficult to comprehend because,the script is written in such a way that ,after the copy is done ,it moves on to another file the does the same to it...
then make a block devices out of both the files and then mounts it accordingly from the cdrom to /usr and /opt respectively..

but with every tweak i do,i get different errors so difficult to say also...

I tried running the script in debug mode (bash -xv <script>) the script just runs fine.
but when i cut a CD out of this file and then boot frm it ,the trouble starts..

Do you have any work around for placing a script in a tmp at boot.
even a stand alone script that does the job will do, (in which case i will just call this new script from the existing one)..
can you pls think of any such script..

Help is needed urgently!!(coz am still a student studing, and doing this out of my interest :slight_smile:

Thanks

Is the error message "cp: command not found"? Or "/.cdrom/: device not found"? Or "psychic help forums: you already know what the problem is"? Or what?

Different architectures have different start-up script arrangements. Ubuntu for example replaces the original /tmp/ with a virtual file system at some point during the boot process so it could be that your copy succeeds but the directory is shadowed later on in the boot process. What are you using for the CD image?

I know what my error is , after the boot process begins there are a few modules that are loaded correctly after that comes this part and the error goes something like this,

lofiadm:open:/tmp/&lt;something.zlib&gt; :No such file or directory
  "loopback device /dev/lofi/1 not created"

these are the 2 error outputs am getting..
the first one i get is because the cp /.cdrom/<something> /tmp
is not being succeeded

and the next one is actually a follow through that calls another function up the script that makes use of this cp statement to pass arguments to the functions to make a lofi file

Am using the live cd of belenix (these manipulations are to be done to this OS) and using solaris-79a for all these manipulations (to access the files of belneix and do changes then a putback)

consequently since the cp is not working the function that take the args are not working properly

Solaris Things: How small can you make Open Solaris - Part 1 are using gzcat to unzip something into /tmp. If you have a really small system then maybe cp is not available after all. Would still be helpful if you could post the actual error message you get from that -- the lofiadm error is apparently because you are trying to mount a file which wasn't copied because the cp didn't happen ...? Or are you really saying that cp fails completely silently?

The link you've posted is something similar to what am doing, and the error message ive sent you already are the real ones..
these were the exact messages am getting when i do the changes and cut a cd out of it and boot...

Just for your reference i'll type it the procedure pls have a look

cp /.cdrom/<somehting.zlib> /tmp
make_lofi /tmp/<something.zlib> 1
if [$? -eq 0]
then
/usr/bin/hsfs/mount -o ro /dev/lofi/1 /usr 2>/dev/msglog
else
echo "unsuccessful mount ">/dev/msglog
fi

this is what i have done so far, and its not working.The "make_lofi" thing is a function that is defined earlier in the script and "1" is taken as an agr to map the device id easily...

ive tried to change the permission of the FS from ro to rw ,didnt work.
i tried it by creating a virtual path, but to no avail...
Do you have any other work around?

Thanks

Can you wrap the cp so you see whether it's happening?

if ! test -e /.cdrom/<somehting.zlib>; then
  echo something.zlib is not there, ouch >&2
elif ! test -w /tmp
  echo /tmp is not writable, ouch >&2
elif cp /.cdrom/<something.zlib> /tmp; then
  : .. proceed as normal
else
  echo ouch, cp failed: $? >&2
fi

Also still suggest you try with cat or gzcat as a possible workaround. Did you try that?

Oh yeah, also the command; if test $? -eq 0; then ... is an abomination. The idiomatic way to do that is if command; then ...

yes i have tried that as well..
I will give your script a shot and let you know by the night

Hope it works
Thanks

There seems to be something wrong with the script ...
when i tried to incorporate the changes and then boot it, there was a file error that was reported..

what do you think could be wrong?
I'll rechek for any sytax errors but i dont think i have made any..

Pretty please, don't leave us guessing. Post the actual error message.

oh that would be difficult , am out for a seminar and i dont have a laptop to boot it and write down the error...
all systems here are thin clients
anyway i will do so as soon as i get back

Hey i think i've solved the problem,

Since the am trying to cp a file that is abut 650mb to tmp at the time of boot, perhaps the memory bits are not yet arranged properly and since its still in fragments(in the early stages of boot),i guess such a large file cannot be cp to tmp.

The error i got from your script cannot be written since it runs into lots of lines and i'll have to write it down first then transfer(no camera)..

Anyway, if you have any idea what i can do now to pin this file to /tmp pls suggest,...

Awaiting your reply
wrapster!!

You could add a df /tmp to the script to see that there is enough space for your file. If it's a RAM disk then it's quite possible that you simply run out of space.

Do you have support for compressed file systems? On Linux there's squashfs and a few others but I don't know about Solaris.

Hi,
First of all, sorry for not posting on this topic,
I had been busy lately...
Anyway you are right, its a ram disk that am dealing with...
The actual script that i am handling is within this and the modifications that am doing are affecting the ram disk itself...

Do you have any idea how to counter this...
Some help towards solving this is very much required...

Pls assist :confused:

Did you investigate those things already?

Hi,
i added df -h /tmp to make it more readable...
The results i got after the boot was over is this...(its disturbing!!!)

Filesystem size used avail capacity
/devices/ramdisk:a 64M 59M 5.0 93%

What do you have to say now???
Pls assist :confused:

That it doesn't look like you have room for much stuff there. Wasn't that what we were guessing since some four, five posts ago?

Am sorry for the disorderly post...
I tried using editors but apparently this does not support uploading from gedit or kedit!!!