Link to home
Start Free TrialLog in
Avatar of BGMi
BGMi

asked on

Create a .run archive installer

Hi experts !

  I would like to create a .run archive/installer to distribute a software that I've created.  I want something similare to the nVidia installer, which have an easy to use command-line interface.  My software is to be installed on server, so no fancy GUI, just pure command-line.  I need to check for some package on the server, to check dependency in other words.  Also, I want it to be a one-file installer, so the administrator have to copy/execute one file that will do all the job.  Don't want a .tar.bz2 archive ... something more "professional".

Thanks you very much for your help !
Have a nice day !
Xor
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BGMi
BGMi

ASKER

Ok ! Nice solution ! So I create an archive, edit it as a text file, create my script at the top, and then, once the execution is completed, I make it remove the script part ... or I also re-create the archive from the code I suppose ?  That way, I don't modify my script and is still valid after I ran it.  Thanks a lot for the idea !

Do you know if that the method the nVidia installer use ?  Or is there another way around ?  I'll wait a little bit before accepting your answer ... but for now, your solution seem very nice !

Thanks a lot !
Xor
> .. So I create an archive, edit it as a text file,  create my script at the top, ..
that'll be difficult (depends on your editor:)
I'd first write the script, then do:
  cat your.tar.bz >> script

> Do you know i
no, I don't


> .. or I also re-create the archive from the code I suppose ?
hmm, not sure what you mean.
Example:
  lets say your script all i n all (comments etc. but without the .tar.bz2) has exactly 42 line, then you extract the binary tar part
in that script like follows:
  sed -e '1,42 d' $0 | tar jxf -

so the sample of the script looks like:

#! /bin/sh
# line 2
# .. your script code
sed -e '1,42 d' $0 | tar jxf -
# .. more script code
# next line is nr. 42
exit

Avatar of BGMi

ASKER

Ok ! Nice ! I'll try it this weekend if I have time ! Thanks a lot !

For the "... or I also re-create the archive from the code I suppose ?" part, what I meant was the, for example, if I stock the binary value of the archive in a variable, and the, in the script, do something like:
echo $varTarBinaryValue > temp.tar.bz2

Can I create an archive that way ?  I know I can do something similair with other languages ... but in bash ... never tried !

Thanks for your help !
Xor
> Can I create an archive that way ?
no 'cause a script most likely cannot handle binary data itself
except your data has only valid characters or you manage to escape them proper, better forget abouit it.
Avatar of BGMi

ASKER

Yeah ! That's true !  I did it once ... but via a MySQL database with a "binary" type field ... so that's why it worked with PHP/MySQL !

Thanks a lot for you help !
Have nice day !
Xor