build error

Markoetie

Verified User
Joined
Aug 19, 2008
Messages
41
Hi,

When running the build script I get the following error:

~# ./build
There is wrong default PHP in /usr/local/directadmin/custombuild/options.conf set.

I've tried the following things:
1. remove the options.conf and run ./build to make the default configuration file.
2. edit the build script

starting from line 309 - #Which PHP is the default one?
changed
Code:
echo "There is wrong default PHP in ${OPTIONS_CONF} set."
to
Code:
echo "There is wrong default PHP in ${OPTIONS_CONF} set: ${DEFPHP}"

which returned
There is wrong default PHP in /usr/local/directadmin/custombuild/options.conf set: 5

3. remove the custombuild directory and run the custombuild.sh script in the /scripts directory

Does anyone have an idea whats wrong here?
 
Last edited:
Which OS Distribution are you running? Does it match your license?

Which version of custombuild are you running?

Jeff
 
Hello,

This is the related chunk of code to trigger that error (as you've discovered)
Code:
#Which PHP is the default one?
if [ "${DEFPHP}" = "4" ]; then
        ADDITPHP=5
elif [ "${DEFPHP}" = "5" ]; then
        ADDITPHP=4
else
        echo "There is wrong default PHP in ${OPTIONS_CONF} set."
        exit 1
fi
which.. I'm not seeing any issues with at first glance.

Try adding quotes are your addition to see if there are any blank spaces in the DEFPHP variable.. which would cause the check to fail, eg: "5" vs "5 ".
Code:
echo "There is wrong default PHP in ${OPTIONS_CONF} set: [b]'${DEFPHP}'[/b]"
past that, I'm not too sure. If you'd like us to check your system for you, send us your info:
https://www.directadmin.com/clients/safesubmit.php

John
 
I've taken a look at your box, and my only conclusion is that there is a bug in the version of bash you're using (or something is very odd going on).

I created a test script, test.sh
Code:
#!/bin/sh

get_val()
{
        #grep -m1 "^${1}" val.txt | cut -d= -f2
        grep -m1 "^${1}=" val.txt | cut -d= -f2
}

VAL="`get_val default_php`"
echo "VAL is read in as '$VAL'";

if [ "$VAL" = "5" ]; then
        echo "VAL is '5'";
else
        echo "VAL is not '5'";
fi

exit 0;
which is a mini version of what's going on with the build script.
I have a val.txt file in the same directory with the data
Code:
default_php=5
nothing=
The version that works removes the = character in the grep.
The version that doesn't work is with the = character in the grep
The catch is that we need the = character to determine where the end of the variable name is, so we cannot remove it.
(The two different methods are in the get_val function, one is commented out)

What I found odd, is that when I replaced:
Code:
if [ "$VAL" = "5" ]; then
with
Code:
if [ "$VAL" -eq 5 ]; then
which is the same logical check, just with integers instead of strings, then the script threw the error:
Code:
srv04:~# ./test.sh
VAL is read in as '5'
./test.sh: line 12: [: 5: integer expression expected
VAL is not '5'
which tells us that bash has decided that 5 is not an integer.. hence my reason to believe there is a bug with bash. (if anyone knows how to force a 'type' upon variables in shell scripting, let me know)

The version of bash being used (/bin/sh -> bash) is
Code:
srv04:~# bash --version
GNU bash, version 3.2.39(1)-release (i486-pc-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
so my only suggestion might be to try a different version of bash.

Unless I'm missing some very basic rules with shell coding with regards to the use of = in the grep, (which is possible.. but would be weird), it doesn't look like this is a bug related to any of the scripts or services we've installed.

John
 
Alright then, I just installed Bash 4.1.0(1)-release and ran the (standard) build script again, the error still remains :(

This is one bitchy issue :/. I wonder why build is the only script where I am experiencing this with
 
Last edited:
Maybe Markoetie you can try an older version, it could be possible the problem still exists in the newer version.
 
Back
Top