Bug#339482: patch to fix dpkg usage in glibc when /usr isnt mounted yet
higuita wrote:
> Hi
>
> tested in debian mips, works fine in my machines
>
> replaced all (but one already commented) dpkg call with plain and old
> if tests
>
> in the end, checking if the machine is running the correct architecture
> is hard to check and should be extremely rare, so i tweak it up and
> comment it
>
> thanks
> --
> Naturally the common people don't want war... but after all it is the
> leaders of a country who determine the policy, and it is always a
> simple matter to drag the people along, whether it is a democracy, or
> a fascist dictatorship, or a parliament, or a communist dictatorship.
> Voice or no voice, the people can always be brought to the bidding of
> the leaders. That is easy. All you have to do is tell them they are
> being attacked, and denounce the pacifists for lack of patriotism and
> exposing the country to danger. It works the same in every country.
> -- Hermann Goering, Nazi and war criminal, 1883-1946
> --- glibc.sh 2006-01-03 02:39:45.000000000 +0000
> +++ glibc-new.sh 2006-01-03 03:25:40.000000000 +0000
> @@ -11,6 +11,19 @@
> # This script is existed for detecting depreciated kernel version to
> # check glibc incompatibility.
>
> +
> +a=0;
> +for i in `uname -r | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\(.*\)/\1 \2 \3 \4/'`; do
> + ver[$a]=$i
> + a=$((a+1))
> +done
> +
> +K_MAJOR=${ver[0]}
> +K_MINOR=${ver[1]}
> +K_REV=${ver[2]}
> +K_EXTRA=${ver[3]}
> +
> +
> if [ "`uname -s`" = Linux ]; then
> # glibc kernel version check: KERNEL_VERSION_CHECK
> exit_check () {
> @@ -20,8 +33,7 @@
>
> # Test to make sure z < 255, in x.y.z-n form of kernel version
> # Also make sure we don't trip on x.y.zFOO-n form
> - #kernel_rev=$(uname -r | tr -- - . | cut -d. -f3 | tr -d '[:alpha:]')
> - kernel_rev=$(uname -r | sed 's/\([0-9]*\.[0-9]*\.\)\([0-9]*\)\(.*\)/\2/')
> + kernel_rev=$K_REV
> if [ "$kernel_rev" -ge 255 ]
> then
> echo WARNING: Your kernel version indicates a revision number
> @@ -36,7 +48,6 @@
>
> # sanity checking for the appropriate kernel on each architecture.
> realarch=`uname -m`
64bit mips/mipsel kernel will print mips64 here...
[snip]
> @@ -130,11 +157,14 @@
> fi
> fi
>
> - if [ "$realarch" = mips ] \
> - && [ "`dpkg --print-architecture`" = mips ]
> - then
> + if [ "$realarch" = mips ] ; then
... but here only mips is checked for, not mips64.
> +# removed, /var, /proc and /usr may not be mounted
> +# && [ "`dpkg --print-architecture`" = mips ] ; then
> # MIPS (but not mipsel) require a kernel update for the msq fixes.
... and this tightens the check unnecessarily for mipsel.
Unfortunately I don't know an easier method to check the userland
endianess than file $SHELL, which also needs /usr. debian-installer
developed "archdetect" for finding out the debian (sub-) architecture,
but this is only a .udeb, not installable on a normal system.
Thiemo
Reply to: