Making SVN Update more easy

  • Hi,

    i would like to have a little script that will automate the update process a little more.

    [CODE]svn update
    cd bin
    if needed calling schemaupdate.php and do it.
    Could someone tell me howto pipe this correctly?
    Script should abort if there is nothing new in svn, also how to know if a db schema update is needed?
    Is it possible to add a /q option to for a silent update (forced)?

  • Moderator

    BTSync is always on the latest, automatically distributed if you want that for testing.

  • I don’t know why you need to make installing fog easier. While I understand you’re scripting it to keep up with the SVN changes, it’s not a requirement nor is it really suggested. Sometimes I make mistakes whether to the GUI, or inits, or installer itself. If there’s an issue, it could potentially leave your system mis-configured from the FOG Standpoint.

  • Hi,

    this works:
    [CODE]svn update /opt/trunk; cd /opt/trunk/bin; echo -e ‘y’ | ./[/CODE]
    but finally it needs an enter at the end and i don’t know why but…
    [CODE]What yes does is it repeatedly prints y (or the argument if given) followed by a newline to stdout.[/CODE]

    Regards X23

  • Hi,

    i would like to automate these answers as well as the schema update if needed.

    i’ve shorten that a little:
    [quote=“Junkhacker, post: 33269, member: 21583”]
    [CODE]svn update /opt/trunk

    An option could be a /q switch for the that will autostart without waiting for a “Y” and does not show the mysql press enter message as well as the notification question at the end.

    This is what i have found on the net:

    [CODE]There is a command created specifically for that case: yes

    yes | ./script

    If you want to say no (n) instead of yes (y) you can do it like this:

    yes n | ./script

    Unnecessarily detailed background information:

    What yes does is it repeatedly prints y (or the argument if given) followed by a newline to stdout. If you connect the output of yes to another command using a pipe (the vertical bar) then the y followed by newline will go to the stdin of the command.

    Most commands will read their input from stdin. Usually stdin is connected to your terminal. That means, after starting a process, what you type in the terminal will go to stdin of the process. But one of the super powers of unix is that processes don’t care where their stdin is coming from. The processes don’t see the pipe, or the terminal, they only see stdin. Notable exceptions to this rule are for example the password prompt of ssh or sudo.

    When the process on the right side of the pipe terminates the pipe will notice and will send SIGPIPE to yes which in turn will terminate itself. If you start yes without a pipe you can stop yes by sending SIGTERM using ctrl+c.

    Note that the hypothetical command invocation you gave in your question can not work because the redirection operator expects a file, not a command.

    ./script < echo ‘yyyyyyyyyyyyyy’
    bash: echo: No such file or directory

    If you happen to have a file named echo then the contents of the file echo is streamed to stdin of ./script which in turn was called with the parameter ‘yyyyyyyyyyyyyy’. Yes, the redirection operator can be given in any place of the command line. Yes, that is unnecessarily confusing.

    If you know exactly how many y your script is expecting you can do it like this:

    echo -e ‘y\ny\ny\n’ | ./script

    Using echo instead of yes you have more fine grained control of input:

    echo -e ‘y\nyes\nno\nmaybe\n’ | ./script

    Note that in some rare cases the commands do not require the newline after input, then you have to leave the newlines out:

    echo -e ‘yyy’ | ./script

    For sake of completeness you can also use an here document:

    ./script << EOF

    Or if you shell supports it an here string:

    ./script <<< "y

    Or you can create a file with one input per line:

    ./script < inputfile

    Regards X23

  • This post is deleted!
  • Developer

    ok, if you have the svn downloaded to a directory named trunk in your home folder, this should work, maybe…
    this is off the top of my head, and untested
    [CODE]cd ~/svn/trunk/
    svn update
    cd bin
    sudo ./

    you’ll still need to answer the questions though

  • Hi,

    i don’t want to cron the update script or something, i simply want to start a script that will do a svn update and install with a single command.

    No feature request for automated svn updates! 😉
    I just don’t know how to thread all this commands into a script.

    Regards X23

  • Developer

    i don’t think that updates to the developers pre-release version of fog is something you’ll honestly want to automate. things can get broken at a moment’s notice in the trunk because a lot of it is yet to be tested.