Double [[ in postinstall.sh

Issue #893 resolved
Bit Bucker created an issue

Hi!

I just tried to install V 1.3.4 but I ran into some issues with the postinstall utility.

First output after starting "make postinstall" was

util/postinstall.sh: 76: util/postinstall.sh: [[: not found

Therefore I had a look in the source code an found this in line 76:

 if [[ $(whoami) != "$user" ]];

Shouldn't this be something like

 if [ $(whoami) != "$user" ];

There are more double [[ xxx ]] within the script.

piler service does not start and the www files aren't copied either.

Thanks for reading.

bit

Comments (10)

  1. Janos SUTO repo owner

    You are right. in conditions are bash specific. The only trouble is that the top level Makefile calls @sh and not @bash to run the postinstall script. Try the following fix in the top level Makefile, then run make postinstall again:

    diff --git a/Makefile b/Makefile
    index 0c1d9e1..7ea5ef9 100644
    --- a/Makefile
    +++ b/Makefile
    @@ -120,7 +120,7 @@ key:
            dd if=/dev/urandom bs=56 count=1 of=piler.key
    
     postinstall:
    -       @sh util/postinstall.sh $(RUNNING_USER) $(RUNNING_GROUP) $(sysconfdir) $(localstatedir) $(libexecdir)
    +       @bash util/postinstall.sh $(RUNNING_USER) $(RUNNING_GROUP) $(sysconfdir) $(localstatedir) $(libexecdir)
    
  2. Bit Bucker reporter

    THX for your fast reply Janos. Changing "sh" to "bash" helped.

    But after installation I found two other issues.

    postinstall asks for the sphinx.conf path

    Please enter the path of sphinx.conf [/usr/local/etc/piler/sphinx.conf] /etc/sphinxsearch/sphinx.conf
    

    But after installation the path in "/etc/init.d/rc.searchd" was set to "/usr/local/etc/piler/sphinx.conf" anyway. I changed it manually to "/etc/sphinxsearch/sphinx.conf" and after this change searchd started.

    After install issue Nr. 2: On https://bitbucket.org/jsuto/piler/issues/890/how-to-update you wrote:

    There are some minor changes to the piler cron jobs;
    
    added 2 new:
    
    */5 * * * * /usr/bin/find /var/piler/error -type f|wc -l > /var/piler/stat/error
    3 * * * * /usr/local/libexec/piler/watch_sphinx_main_index.sh
    
    and removed the attachment indexing since it might cause issues for large attachment tables.
    

    But postinstall just made the old ones.

    piler crontab:
    ### PILERSTART
    5,35 * * * * /usr/local/libexec/piler/indexer.delta.sh
    30   2 * * * /usr/local/libexec/piler/indexer.main.sh
    15,45 * * * * /usr/local/libexec/piler/indexer.attachment.sh
    */15 * * * * /usr/bin/indexer --quiet tag1 --rotate --config /usr/local/etc/piler/sphinx.conf
    */15 * * * * /usr/bin/indexer --quiet note1 --rotate --config /usr/local/etc/piler/sphinx.conf
    30   6 * * * /usr/bin/php /usr/local/libexec/piler/generate_stats.php --webui /var/piler/www >/dev/null
    */5 * * * * /usr/bin/find /var/piler/www/tmp -type f -name i.\* -exec rm -f {} \;
    ### PILEREND
    

    Should I also change this manually?

    bit.

  3. Janos SUTO repo owner

    Thanks for noticing it. I've fixed the postinstall script not to ask for the sphinx.conf path, because it's ${sysconfdir}/piler/sphinx.conf. So I think you should revert your changes in rc.searchd. I've also added the error file counting to the cron entries. I think you didn't use the last master.tar.gz file.

    So I suggest you not to fix it manually, instead get the last master.tar.gz (I've just updated it), and try running configure (with proper parameters), make, make install, and then make postinstall. Let me know how it goes.

  4. Bit Bucker reporter

    Sorry I was offline over easter and this week I had to do some work for my clients. You know that ;-)

    I'll be back asap.

    bit.

  5. Bit Bucker reporter

    Thanks for your patience.

    Actually I wanted to update my version 1.3.1. But the changes in the database and the cronjobs & scripts where very confusing,

    Therefore I decided to start all over again and removed the previous installation.

    I downloaded the actual master branch (Version 1.3.4 build 994) and the installation worked flawless.

    So far so good. Thanks for your support!

    bit.

  6. Log in to comment