You are not logged in.

#1 2013-01-31 05:18:36

dlin
Member
From: Taipei,Taiwan
Registered: 2005-09-21
Posts: 264

Is /bin/sh must link to /usr/bin/bash?

I'm building Arch Linux on embedded system which CPU is sh4.
I found there is a problem of bash package.
It creates /bin/sh as a symbolic link to /usr/bin/bash.

But my /bin/sh is busybox.
1. I'm wonder how could I keep /bin/sh to busybox's /bin/sh? Or, it could set on pacman.conf?
2. Could my root account still use 'sh' as its shell? I wish busybox could still exist as the basement.
3. Is makepkg or yaourt based on root's shell must be bash?


Running 4 ArchLinux including sh4twbox,server,notebook,desktop. my AUR packages, old project Arch on colinux,

Offline

#2 2013-01-31 05:49:44

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 5,084

Re: Is /bin/sh must link to /usr/bin/bash?

IIRC, pacman requires bash. It doesn't have to be the login shell, but it has to exist. The login shell can be whatever you want.

Edit, let me clarify that a bit. Anything that needs bash calls bash specifically, so it doesn't matter what the root login shell is.

Last edited by Scimmia (2013-01-31 05:53:57)

Online

#3 2013-01-31 06:02:11

Allan
Developer
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,416
Website

Re: Is /bin/sh must link to /usr/bin/bash?

Many of the Arch package post_install scriptlets are written assuming bash, and pacman uses /bin/sh as its shell.   In 4.1, this will be configurable.  Makepkg uses /bin/bash.

Online

#4 2013-01-31 06:30:15

dlin
Member
From: Taipei,Taiwan
Registered: 2005-09-21
Posts: 264

Re: Is /bin/sh must link to /usr/bin/bash?

Thank you Allan,

I have this question is because /usr/bin/bash require many dynamic library and I just failed login my embedded system after upgrade bash with pacman -Udd option.
sad

Am I right of the following assumption (Sorry, I can not 100% understand your meaning, require double confirm.).

1. I can keep my root's shell as /bin/sh (it's busybox version).
2. I can config pacman to use /bin/bash for install (I've compiled brand new pacman)
3. makepkg have forced to use /bin/bash for install

BTW, I found it is required bash 4.0 (declare function)  My embedded system's original linux only provide bash 3.0.  So, it took me a while to prepare bash 4.0.

Last edited by dlin (2013-01-31 06:42:22)


Running 4 ArchLinux including sh4twbox,server,notebook,desktop. my AUR packages, old project Arch on colinux,

Offline

#5 2013-01-31 06:36:16

Allan
Developer
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,416
Website

Re: Is /bin/sh must link to /usr/bin/bash?

1 and 3 are right.  2 is only possible with the developmental version of pacman.

Online

#6 2013-01-31 06:36:21

progandy
Member
Registered: 2012-05-17
Posts: 2,151

Re: Is /bin/sh must link to /usr/bin/bash?

2. I can config pacman to use /bin/bash for install (I've compiled brand new pacman)

Since you are compiling pacman, you can simply replace /bin/sh with /usr/bin/bash in the source. And add /bin/sh to NoExtract in pacman.conf

Offline

#7 2013-02-01 21:59:39

dlin
Member
From: Taipei,Taiwan
Registered: 2005-09-21
Posts: 264

Re: Is /bin/sh must link to /usr/bin/bash?

Instead of assign /bin/bash, is it possible check do following to provide minimal dependency?

if /bin/bash exist and workable (link successful) then
  call /bin/bash.
else
  call /bin/sh
fi


Running 4 ArchLinux including sh4twbox,server,notebook,desktop. my AUR packages, old project Arch on colinux,

Offline

#8 2013-02-04 05:30:38

dlin
Member
From: Taipei,Taiwan
Registered: 2005-09-21
Posts: 264

Re: Is /bin/sh must link to /usr/bin/bash?

where to found out the code of development pacman?
I've try search /bin/sh on the current downloaded pacman 4.0.3-5 source.
And the founding can not help to modify the source to force it to use /bin/bash.
The only line mentioned about /bin/sh is in download_with_xfercommand() of src/pacman/conf.c

But, I don't think it is correct place to modify it.

pm_printf(ALPM_LOG_DEBUG, "running command: %s\n", parsedcmd);
        retval = system(parsedcmd);

I try to modify as

char buf[1024];
sprintf(buf, "/bin/bash -c %s", parsedcmd)
pm_printf(ALPM_LOG_DEBUG, "running command: %s\n", buf);
        retval = system(buf);

Last edited by dlin (2013-02-04 05:58:05)


Running 4 ArchLinux including sh4twbox,server,notebook,desktop. my AUR packages, old project Arch on colinux,

Offline

Board footer

Powered by FluxBB