summaryrefslogtreecommitdiff
path: root/app-admin/hddtemp/files/update-hddtemp.db
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-admin/hddtemp/files/update-hddtemp.db
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'app-admin/hddtemp/files/update-hddtemp.db')
-rw-r--r--app-admin/hddtemp/files/update-hddtemp.db33
1 files changed, 33 insertions, 0 deletions
diff --git a/app-admin/hddtemp/files/update-hddtemp.db b/app-admin/hddtemp/files/update-hddtemp.db
new file mode 100644
index 000000000000..bc29b3ec0caa
--- /dev/null
+++ b/app-admin/hddtemp/files/update-hddtemp.db
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+update_db() {
+ local src=$1
+ local dst=$2
+
+ while read line ; do
+ if [[ -z $(echo "${line}" | sed -re 's/(^#.*|^\w*$)//') ]]; then
+ echo "${line}" >> "${dst}"
+ fi
+
+ id=$(echo "${line}" | grep -o '"[^"]*"')
+
+ grep "${id}" "${dst}" 2>&1 >/dev/null || echo "${line}" >> "${dst}"
+ done < "${src}"
+}
+
+die() {
+ echo "$*"
+ exit 1
+}
+
+cd /usr/share/hddtemp
+wget http://download.savannah.nongnu.org/releases/hddtemp/hddtemp.db -O hddtemp.db -q || die "Failed to download new hddtemp.db file"
+
+# Try to get the Gentoo HDD DB from WebCVS. If that fails, just use the Gentoo HDD database
+# that was installed by the ebuild.
+if wget https://gitweb.gentoo.org/repo/gentoo.git/plain/app-admin/hddtemp/files/hddgentoo.db -O hddtmp.db -q; then
+ mv -f hddtmp.db hddgentoo.db
+fi
+
+update_db "hddgentoo.db" "hddtemp.db"
+