Pierre Labastie wrote: > Le 13/03/2012 20:14, Bruce Dubbs a ecrit: >> - if [ "$2" == "lib" ]; then >> - file=$(PATH=/lib:/usr/lib type -p $1) >> + if [ "$2" = "lib" ]; then >> + file=$(find /lib /usr/lib -maxdepth 1 -name $1 | head -n 1) >> else >> - file=$(type -p $1) >> + file=$(find /bin /usr/bin /sbin /usr/sbin -maxdepth 1 -name $1 | >> head -n 1) >> fi >> >> This segment is in a script that explicitly has #!/bin/bash as the >> shell, so "==" is quite as valid as "=". Also the `type` command is a >> bash builtin. The changes do the same thing as the current code but >> with a different style. I don't think changes are needed. > Sorry for the ==. There was no need to change that. OTOH, > type -p $1 returns nothing if $1 is an alias. This happened to > me because I have > > |alias ls='ls --color=auto' > in /etc/bashrc. Then of course, `copy ls bin' does not do what it is supposed > to do. There are certainly better ways > to correct that, but it should be corrected. > |
Hmm, I have a similar alias "ls='LC_ALL=C ls --color=auto'" but didn't see an error. I'll investigate. >> -binfiles="sh cat cp dd killall ls lsmod mkdir mknod mount " >> +binfiles="bash cat cp dd killall ls mkdir mknod mount" >> >> +ln -s bash $WDIR/bin/sh >> >> sh is needed in the case where the user has /bin/sh linked to something >> other than bash. We could do a test and either add the other file or >> create a symlink to bash. > agreed. Maybe: > > binfiles="cat cp dd killall ls mkdir mknod mount" > > if [ -h /bin/sh ]; then > binfiles="$binfiles $(readlink /bin/sh)" > ln -s $(readlink /bin/sh) $WDIR/bin/sh > fi We still need an else and we need to cover the case where the file is not in /bin (neither is normal, but we jsut need to cover all possibilities. >> -sbinfiles="udevadm udevd modprobe blkid switch_root mdadm" >> +sbinfiles="udevadm modprobe blkid switch_root" >> >> +# Add mdadm if present >> +if [ -x /sbin/mdadm ] ; then sbinfiles="$sbinfiles mdadm"; fi >> + >> +# Add udevd if present in /sbin (newer versions of udev have it in >> +# /lib/udev) >> +if [ -x /sbin/udevd ] ; then sbinfiles="$sbinfiles udevd"; fi >> >> OK, but what about the case when udevd is in /lib/udev/? >> We also need to make sure that we get all the libraries that >> udevd needs (e.g. libblkid.so.1). > The whole /lib/udev hierarchy is copied to the initramfs later. > But I forgot about the libraries, you are right. > Maybe something like : > > if [ -x /sbin/udevd ] ; then sbinfiles="$sbinfiles udevd" > else ldd /lib/udev/udevd | sed "s/\t//" | cut -d " " -f1>> $unsorted; fi That looks about right. > >> -# Create a temporrary working directory >> +# Create a temporary working directory >> >> OK, typo. >> >> - ln -s lvm $WDIR/sbin/lvchange >> - ln -s lvm $WDIR/sbin/lvchange >> >> We could do that or change these to other lv commands: lvrename, >> lvextend, etc. These are only here if the boot fails and drops back to >> the shell within the initramfs. > agreed. >> # Install libraries >> >> I'd prefer to fix this with: >> >> sort $unsorted | uniq | while read library ; do >> if [ "$library" == "linux-vdso.so.1" ] || >> [ "$library" == "linux-gate.so.1" ]; then >> continue >> fi >> >> copy $library lib >> done > agreed. > As I told in the report. The initramfs is created, but it does not work. > Sorry no time to investigate further tonight. No problem. Good discussion. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
