Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / sbin / | server ip : 104.21.89.46 your ip : 172.69.17.122 H O M E |
Filename | /usr/sbin/update-usbids |
Size | 1.05 kb |
Permission | rwxr-xr-x |
Owner | root : root |
Create time | 27-Apr-2025 09:51 |
Last modified | 09-Apr-2014 05:12 |
Last accessed | 05-Jul-2025 15:48 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
#!/bin/sh
# see also update-pciids.sh (fancier)
[ "$1" = "-q" ] && quiet="true" || quiet="false"
set -e
SRC="http://www.linux-usb.org/usb.ids"
DEST=/var/lib/usbutils/usb.ids
# if usb.ids is read-only (because the filesystem is read-only),
# then just skip this whole process.
if ! touch ${DEST} >&2 >/dev/null ; then
${quiet} || echo "${DEST} is read-only, exiting."
exit 0
fi
if which wget >/dev/null 2>&1 ; then
DL="wget -O $DEST.new $SRC"
${quiet} && DL="$DL -q"
elif which lynx >/dev/null 2>&1 ; then
DL="eval lynx -source $SRC >$DEST.new"
else
echo >&2 "update-usbids: cannot find wget nor lynx"
exit 1
fi
if ! $DL ; then
echo >&2 "update-usbids: download failed"
rm -f $DEST.new
exit 1
fi
if ! grep >/dev/null "^C " $DEST.new ; then
echo >&2 "update-usbids: missing class info, probably truncated file"
exit 1
fi
if [ -f $DEST ] ; then
mv $DEST $DEST.old
# --reference is supported only by chmod from GNU file, so let's ignore any errors
chmod -f --reference=$DEST.old $DEST.new 2>/dev/null || true
fi
mv $DEST.new $DEST
${quiet} || echo "Done."
# see also update-pciids.sh (fancier)
[ "$1" = "-q" ] && quiet="true" || quiet="false"
set -e
SRC="http://www.linux-usb.org/usb.ids"
DEST=/var/lib/usbutils/usb.ids
# if usb.ids is read-only (because the filesystem is read-only),
# then just skip this whole process.
if ! touch ${DEST} >&2 >/dev/null ; then
${quiet} || echo "${DEST} is read-only, exiting."
exit 0
fi
if which wget >/dev/null 2>&1 ; then
DL="wget -O $DEST.new $SRC"
${quiet} && DL="$DL -q"
elif which lynx >/dev/null 2>&1 ; then
DL="eval lynx -source $SRC >$DEST.new"
else
echo >&2 "update-usbids: cannot find wget nor lynx"
exit 1
fi
if ! $DL ; then
echo >&2 "update-usbids: download failed"
rm -f $DEST.new
exit 1
fi
if ! grep >/dev/null "^C " $DEST.new ; then
echo >&2 "update-usbids: missing class info, probably truncated file"
exit 1
fi
if [ -f $DEST ] ; then
mv $DEST $DEST.old
# --reference is supported only by chmod from GNU file, so let's ignore any errors
chmod -f --reference=$DEST.old $DEST.new 2>/dev/null || true
fi
mv $DEST.new $DEST
${quiet} || echo "Done."