Create a .run archive installer

Posted on 2006-05-04
Last Modified: 2010-04-21
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 !
Question by:BGMi
    LVL 51

    Accepted Solution

    the general method would be towrite a shell script which does all your checks and finally installs your .tar.bz2
    This .tar.bz2 could be part of the shell script, the script will simply remove itself from the script which then leaves the dada for the original .tar.bz2

    Author Comment

    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 !
    LVL 51

    Expert Comment

    > .. 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 >> 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.
      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


    Author Comment

    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 !
    LVL 51

    Expert Comment

    > 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.

    Author Comment

    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 !

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
    The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now