[systemd-devel] Add ARCH parameter to /etc/os-release
Lennart Poettering
lennart at poettering.net
Wed Apr 17 11:19:59 PDT 2013
On Mon, 08.04.13 22:09, Askar Safin (safinaskar at mail.ru) wrote:
>
> >I'm not sure what problem the proposal is trying to solve. Maybe it'd
> >be clearer if that was provided.
> I want to know what is the arches of the systems on my computer. I. e. I want to do the following:
>
> for DISK in /dev/sd*; do
> mount "$DISK" /mnt
> source /mnt/etc/os-release
> echo "Arch of $DISK is $ARCH"
> done
>
> And I want to use this $ARCH to do "setarch", i. e.:
> mount /dev/some-dev /mnt
> source /mnt/etc/os-release
> setarch "$ARCH" chroot /mnt
> So, this /mnt system will see "uname -m" output which is meaningful for the system.
My suggestion would be to write a little tool that does the equivalent
to this:
readelf -h /usr/lib*/libdl*.so | grep Machine | cut -c38- | uniq
This will list you the architectures for which you have dynamic loaders
installed. Since the dynamic loaders are hardcoded in all dynamic ELF
binaries this list will tell you binaries of which archs you can execute
on your system.
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list