List Info

Thread: About a remaining shell hack.




About a remaining shell hack.
country flaguser name
Spain
2007-02-16 17:02:26
Hi, 

Now in the Makefile we have this hack to bring to make a
working shell when 
entering to the chroot:


#
# The convoluted piece of code below is necessary to provide
'make' with a 
valid shell in the
# chroot environment. (Unless someone knows a different
way)
# Manually create the /bin directory and provide link to the
/tools dir.
# Also change the original symlink creation to include
(f)orce to prevent 
failure due to
#  pre-existing links.
#
mk_CHROOT: mk_SUDO
 if
[ ! -e $(MOUNT_PT)/bin ]; then 
   mkdir $(MOUNT_PT)/bin; 
   cd $(MOUNT_PT)/bin && 
   ln -sf /tools/bin/bash bash; ln -sf bash sh; 
   sudo chown -R 0:0 $(MOUNT_PT)/bin; 
 fi;
 sudo sed -e 's|^ln -sv |ln -svf |' -i
$(CMDSDIR)/chapter06/*-createfiles
 $(call echo_CHROOT_request)
 (
sudo $(CHROOT1) "cd $(SCRIPT_ROOT) && make
CHROOT")
 touch $



After the current SHELL change, I think that that hack maybe
could be replaced 
by:

ifeq ($(shell ls /bin/bash),/bin/bash)
  SHELL = /bin/bash
else
  SHELL = /tools/bin/bash
endif

or something more simple, if someone can find a better way.

What do you think?


-- 
Manuel Canales Esparcia
Usuario de LFS nº2886:       http://www.linuxfroms
cratch.org
LFS en castellano: http://www.escomp
oslinux.org/lfs-es http://www.lfs-es.info
TLDP-ES:                           http://es.tldp.org
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page

Re: About a remaining shell hack.
user name
2007-02-16 17:24:00
On 2/16/07, M.Canales.es <macanamacana-es.com> wrote:
>
> After the current SHELL change, I think that that hack
maybe could be replaced
> by:
>
> ifeq ($(shell ls /bin/bash),/bin/bash)
>   SHELL = /bin/bash
> else
>   SHELL = /tools/bin/bash
> endif
>
> or something more simple, if someone can find a better
way.
>
> What do you think?

Good idea, but put a 2>/dev/null into the ls command so
you don't see
garbage if it's not there yet. A slightly more robust check,
but
probably not needed is

ifeq ($(shell [ -x /bin/bash ] && echo /bin/bash),
/bin/bash)

since it also checks that you can execute bash.

--
Dan
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page

Re: About a remaining shell hack.
country flaguser name
Spain
2007-02-16 17:28:48
El Sábado, 17 de Febrero de 2007 00:24, Dan Nicholson
escribió:

>
> ifeq ($(shell [ -x /bin/bash ] && echo
/bin/bash), /bin/bash)
>
> since it also checks that you can execute bash.

The -x test was my first idea, but not recall on the echo
part to do the 
comparassion, thanks.

I'm starting a build to see if ithat method works as
expected.

-- 
Manuel Canales Esparcia
Usuario de LFS nº2886:       http://www.linuxfroms
cratch.org
LFS en castellano: http://www.escomp
oslinux.org/lfs-es http://www.lfs-es.info
TLDP-ES:                           http://es.tldp.org
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page

Re: About a remaining shell hack.
country flaguser name
Spain
2007-02-16 20:17:22
El Sábado, 17 de Febrero de 2007 00:28, M.Canales.es
escribió:

> I'm starting a build to see if ithat method works as
expected.

Yeah, looks like it works.

That change implies that now progress_bar.sh is not
executable and must be run 
via "$(SHELL) progress_bar.sh", due the missing
/bin/bash in the earlier 
chroot phases.

But it allow that the chroot build scripts up to
*-creatingfiles will have 
again #!/tools/bin/bash as shebang, being more closed to the
expected book 
build environment.


-- 
Manuel Canales Esparcia
Usuario de LFS nº2886:       http://www.linuxfroms
cratch.org
LFS en castellano: http://www.escomp
oslinux.org/lfs-es http://www.lfs-es.info
TLDP-ES:                           http://es.tldp.org
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page

Re: About a remaining shell hack.
user name
2007-02-16 20:19:32
On 2/16/07, M.Canales.es <macanamacana-es.com> wrote:
> El Sábado, 17 de Febrero de 2007 00:28, M.Canales.es
escribió:
>
> > I'm starting a build to see if ithat method works
as expected.
>
> Yeah, looks like it works.
>
> That change implies that now progress_bar.sh is not
executable and must be run
> via "$(SHELL) progress_bar.sh", due the
missing /bin/bash in the earlier
> chroot phases.

Nice.

--
Dan
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page

Re: About a remaining shell hack.
country flaguser name
United Kingdom
2007-02-17 07:52:16
On Friday 16 February 2007 23:28, M.Canales.es wrote:
> El Sábado, 17 de Febrero de 2007 00:24, Dan Nicholson
escribió:
> > ifeq ($(shell [ -x /bin/bash ] && echo
/bin/bash), /bin/bash)
> >
> > since it also checks that you can execute bash.
>
> The -x test was my first idea, but not recall on the
echo part to do the
> comparassion, thanks.
>
> I'm starting a build to see if ithat method works as
expected.

I get the following:

mk_CHROOT
You are going to CHROOT into /media/hda3 lfs
a password is required
make: /bin/sh: Command not found
------------------------------------------------------------
--------------------
 Building target 062-creatingdirs
/tools/bin/bash: ./progress_bar.sh: Permission denied

 Target 062-creatingdirs OK
------------------------------------------------------------
--------------------
------------------------------------------------------------
--------------------
 Building target 063-createfiles
/tools/bin/bash: ./progress_bar.sh: Permission denied

 Target 063-createfiles OK
------------------------------------------------------------
--------------------
------------------------------------------------------------
--------------------
 Building target 064-linux-headers
/tools/bin/bash: ./progress_bar.sh: Permission denied

Is this because of the following?

$ ls -l $LFS/jhalfs/progress_bar.sh

-rw-rw-rwT 1 matthew matthew 1787 2007-02-17 
12:05 /media/hda3/jhalfs/progress_bar.sh

Regards,

Matt.
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page

Re: About a remaining shell hack.
country flaguser name
Spain
2007-02-17 08:58:09
El Sábado, 17 de Febrero de 2007 14:52, Matthew Burgess
escribió:

> mk_CHROOT
> You are going to CHROOT into /media/hda3 lfs
> a password is required
> make: /bin/sh: Command not found

This on is normal. /bin/sh don't exist in the chroot jail at
this stage of the 
build.


> /tools/bin/bash: ./progress_bar.sh: Permission denied
>
> Is this because of the following?
>
> $ ls -l $LFS/jhalfs/progress_bar.sh
>
> -rw-rw-rwT 1 matthew matthew 1787 2007-02-17
> 12:05 /media/hda3/jhalfs/progress_bar.sh

I will launch a new build now, i f there is no more hardware
problems (my 
server started to reboot by their one. After several logs
review, hardware 
maintenance and tries, and after removing one of the RAM
slots, looks like it 
is alive again, I hope :-/ )

-- 
Manuel Canales Esparcia
Usuario de LFS nº2886:       http://www.linuxfroms
cratch.org
LFS en castellano: http://www.escomp
oslinux.org/lfs-es http://www.lfs-es.info
TLDP-ES:                           http://es.tldp.org
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page

Re: About a remaining shell hack.
country flaguser name
Spain
2007-02-17 10:29:32
El Sábado, 17 de Febrero de 2007 14:52, Matthew Burgess
escribió:

>----- Building target 062-creatingdirs
> /tools/bin/bash: ./progress_bar.sh: Permission denied

Fixed. I forgot to update also the function that creates
target headers for 
chroot steps to run progress_bar.sh via $(SHEEL).

Thanks for the report.

-- 
Manuel Canales Esparcia
Usuario de LFS nº2886:       http://www.linuxfroms
cratch.org
LFS en castellano: http://www.escomp
oslinux.org/lfs-es http://www.lfs-es.info
TLDP-ES:                           http://es.tldp.org
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page

Re: About a remaining shell hack.
country flaguser name
Spain
2007-02-27 12:49:13
El Sábado, 17 de Febrero de 2007 00:02, M.Canales.es
escribió:

>
> ifeq ($(shell ls /bin/bash),/bin/bash)
>   SHELL = /bin/bash
> else
>   SHELL = /tools/bin/bash
> endif
>

After notice that that test don't work as expected when
resuming a failed 
build, due /bin/bash may has been already installed into the
chroot  at that 
point, I found a more simple solution.

In the Makefile header only 

SHELL = /bin/bash

is required to can handle host that have a /bin/sh symlink
that don't point 
to /bin/bash.

Then, to supply make with the working shell expected by the
books when 
entering to the chroot, just adding

CHROOT:  SHELL=/tools/bin/bash

do the work.

Simple, nice, and don't mess the SHELL used by make
sub-process 
 

-- 
Manuel Canales Esparcia
Usuario de LFS nº2886:       http://www.linuxfroms
cratch.org
LFS en castellano: http://www.escomp
oslinux.org/lfs-es http://www.lfs-es.info
TLDP-ES:                           http://es.tldp.org
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page

[1-9]

about | contact  Other archives ( Real Estate discussion Medical topics )