[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: Mounting an USB flask stick by-label
From: Alexander Griesser <alexander.griesser () lkh-vil ! or ! at>
Date: 2009-02-16 12:26:23
Message-ID: 49995B6F.3070607 () lkh-vil ! or ! at
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Pedro Aguilar wrote:
> Hi,
>
> I have an embbeded device with an initramfs with busybox inside it. We
> want to use this initramfs basically for updating the real filesystem that
> resides in an USB flash stick.
>
> There could be several USB flash sticks connected to the target and we
> need to mount the one with our filesystem.
> We could differentiate our USB stick from the others by its label (mount
> -L), so I would like to know if there is a way with mdev to recognize an
> USB stick by-label or any other way (the serial id is not useful because
> each target has a different USB stick).
I'm using code like this for this purpose:
i=0
while [ "$i" != "10" ]; do
LXTC_BOOT=$(blkid | awk -F: '/LABEL="LXTC_BOOT"/ { print $1 }')
if [ "$LXTC_BOOT" = "" ]; then
sleep 1
i=$((i + 1))
echo -n "."
continue
else
echo "found ($LXTC_BOOT)".
break
fi
done
The label of my filesystem is "LXTC_BOOT", so by simply replacing this
label you will have the name of the blockdevice in the variable
"LXTC_BOOT" then.
The reason why I'm running through a 10 second time loop here is because
USB devices take some time to settle down and if the filesystem you're
looking for is on a USB drive (CD, stick, floppy, ...) the first
invocation will probably not find it immediately.
ciao,
- --
Alexander Griesser (Netzwerkadministration)
E-Mail: alexander.griesser@lkh-vil.or.at | Web: http://www.lkh-vil.or.at
KABEG LKH Villach | Nikolaigasse 43 | 9500 Villach
Tel.: +43 4242 208 3061 | Fax.: +43 4242 208 971 2061
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkmZW28ACgkQ66HVD6KUm1pa2QCgjheNhOXgNdJl6I18uufsMzg5
mkkAniQpm5nfvAZH2+fcivctT9B540Gq
=JzI/
-----END PGP SIGNATURE-----
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic