blob: f049c22dccd8bd87566f0d6db75f7983d5ed06f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
--- update-usbids.sh
+++ update-usbids.sh
@@ -2,12 +2,22 @@
# see also update-pciids.sh (fancier)
+[ "$1" = "-q" ] && quiet="true" || quiet="false"
+
set -e
SRC="http://www.linux-usb.org/usb.ids"
DEST=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 ; then
DL="wget -O $DEST.new $SRC"
+ ${quiet} && DL="$DL -q"
elif which lynx >/dev/null ; then
DL="eval lynx -source $SRC >$DEST.new"
else
@@ -33,4 +43,4 @@
fi
mv $DEST.new $DEST
-echo "Done."
+${quiet} || echo "Done."
|