customBuild and Debian 6.0

snk

Verified User
Joined
Dec 19, 2007
Messages
95
Hello.

In Debian Squeeze (Debian 6.0) system shell changed from bash to dash.
CustomBuild have many "echo -e" instances that isn't work in squeeze, because 'echo' in dash-shell doesn't have '-e' option.

As result '-e' passed to output:

Code:
# ./build 
 +--------------------------------------------------------+
 |            DirectAdmin WebServices Installer           |
 |     Written by Martynas Bendorius and DirectAdmin      |
 |                   Version: 1.1.21                      |
 +--------------------------------------------------------+


s3:/usr/local/directadmin/custombuild# ./build  set_fastest_quiet
[B][COLOR="Red"]-e [/COLOR][/B]File already exists: servers.txt
MD5 Checksum on servers.txt passed.
files6.directadmin.com
Changed downloadserver option from files6.directadmin.com to files6.directadmin.com


s3:/usr/local/directadmin/custombuild# ./build update
--2011-03-01 15:25:48--  http://files6.directadmin.com/services/custombuild/1.1/custombuild.tar.gz
.... skipped....
extracting custombuild.tar.gz for 1.1 ...
.... skipped....
[B][COLOR="#ff0000"]-e[/COLOR] [/B]File already exists: servers.txt
MD5 Checksum on servers.txt passed.
[B][COLOR="#ff0000"]-e[/COLOR] [/B]File already exists: httpd-2.2.17.tar.gz
MD5 Checksum on httpd-2.2.17.tar.gz passed.
[B][COLOR="#ff0000"]-e[/COLOR] [/B]File already exists: httpd_2
[B][COLOR="#ff0000"]-e [/COLOR][/B]File already exists: httpd_2_freebsd
[B][COLOR="#ff0000"]-e[/COLOR] [/B]File already exists: httpd_2_debian
.....

Yes, i can change dash shell back to bash, but i think better to fix custombuild script.

to DirectAdmin Support:
this is also happen with any cron-job, that DirectAdmin make.
I mean '-e' passed to output

Regards.
 
Last edited:
chsh -s /bin/bash root
Sure ! If you have 1 server. :)

but actually, it doesn't help much - not only root need change shell. User 'diradmin' and other users, who have ssh account and want to use cronjobs need to change their shell.

will you do this on 50+ DA servers ?
 
Hmm... First, the chsh shell change for root wouldn't have any effect since the build script uses #!/bin/sh as the shebang line, something very common in all scripts. But if /bin/sh -> dash, that's were the issue comes in. It has nothing to do with the shell root is using.

It's not hard for us to do something like:
Code:
ln -sf bash /bin/sh
I'd just be very hesitant, in case /bin/bash doesn't actually work or exist. With enough checks, it could be possible to swap it.. the question is, does the risk of killing the system justify the minor cosmetic change. I'd say it might be "yes", but we'll take feedback on this.

Another option would be if we simply check to see if /bin/sh -> dash is set, and if so, have a variable for "-e" become "" in that case.

After googling around, the reason they changed /bin/sh to be dash is for bootup performance. They acknowledge that bash is more feature rich (supports -e) but is slower since it's about 9x the size of dash. A smaller file means quicker reads.. and faster boots. How often do we in the web hosting world reboot our boxes? Not too often.

We could even have a setup.sh check, ask the client if he wants the switch to take place, and only do so with permission.

Input welcome.

---------------


After some quick poking around, I notice that if you call the echo binary, it overrides the built-in echo command that dash has.. thus the simplest solution is to use the full path to echo, so dash doesn't have it's way.
Code:
root@debian6-64:~# echo $SHELL
/bin/bash
root@debian6-64:~# dash
# echo -e "hi"
-e hi
# /bin/echo -e "hi"
hi
#
John
 
Hello,

I've added a fix into the build scripts, both 1.1 and 1.2.
Any calls to "echo -e" are replaced with "$ECHO -e", where $ECHO is set to "echo" for all OS's, except debian, which gets ECHO=/bin/echo.

FreeBSD is the opposite from Debian, in that it cannot use the full path (/bin/echo) or the "-e" error shows up. But the built-in echo command for FreeBSD does support -e, thus it's backwards.

In any case, I've done some testing on all 3 OS's, and the problem seems to be gone.

John
 
Change The Default Shell

/bin/sh is a symlink to /bin/dash, however we need /bin/bash, not /bin/dash. Therefore we do this:

dpkg-reconfigure dash

Use dash as the default system shell (/bin/sh)? <-- No
 
Back
Top