summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO10
-rw-r--r--PKGBUILD9
-rw-r--r--tridupdate.py114
-rw-r--r--update-trid-defs.sh2
4 files changed, 10 insertions, 125 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a0ce1a2d7cc7..70559647973f 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,25 +1,23 @@
-# Generated by mksrcinfo v8
-# Wed Sep 21 16:25:43 UTC 2016
pkgbase = trid
pkgdesc = An utility designed to identify file types from their binary signatures
pkgver = 2.24
- pkgrel = 2
+ pkgrel = 3
url = http://mark0.net/soft-trid-e.html
install = trid.install
arch = i686
arch = x86_64
license = CUSTOM
- depends = python2
+ depends = python
source = trid.sh
source = update-trid-defs.sh
source = update-trid-defs.service
source = update-trid-defs.timer
source = triupdate-1.00.zip::http://mark0.net/download/tridupdate.zip
md5sums = fe447a9fb6da5591ad72bf17e77084ae
- md5sums = 6ef06da62edde6c84c9473f7a62969e6
+ md5sums = 3d7ab5a0cb8a52fa1cfd965267356191
md5sums = 3acd810a05f49c9dc586e964aea90146
md5sums = 2ea012671b50e0761cbc4bbec820952e
- md5sums = 341ca17bfdd30ff6b23db373d82f5dcc
+ md5sums = 9e775c9b773499cd9d7b4712800968af
source_i686 = trid-2.24-i686.zip::http://mark0.net/download/trid_linux.zip
md5sums_i686 = e250feae78ac8e5a5523d044669bba96
source_x86_64 = trid-2.24-x86_64.zip::http://mark0.net/download/trid_linux_64.zip
diff --git a/PKGBUILD b/PKGBUILD
index 8633c14cb539..e9cf8b18ec2d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,12 +3,12 @@
pkgname=trid
pkgver=2.24
-pkgrel=2
+pkgrel=3
pkgdesc="An utility designed to identify file types from their binary signatures"
arch=('i686' 'x86_64')
url="http://mark0.net/soft-trid-e.html"
license=('CUSTOM')
-depends=('python2')
+depends=('python')
install=trid.install
source=(trid.sh
@@ -19,11 +19,12 @@ source=(trid.sh
source_i686=(trid-${pkgver}-i686.zip::http://mark0.net/download/trid_linux.zip)
source_x86_64=(trid-${pkgver}-x86_64.zip::http://mark0.net/download/trid_linux_64.zip)
+
md5sums=('fe447a9fb6da5591ad72bf17e77084ae'
- '6ef06da62edde6c84c9473f7a62969e6'
+ '3d7ab5a0cb8a52fa1cfd965267356191'
'3acd810a05f49c9dc586e964aea90146'
'2ea012671b50e0761cbc4bbec820952e'
- '341ca17bfdd30ff6b23db373d82f5dcc')
+ '9e775c9b773499cd9d7b4712800968af')
md5sums_i686=('e250feae78ac8e5a5523d044669bba96')
md5sums_x86_64=('75078cdd077c71b89cc1956525a09649')
diff --git a/tridupdate.py b/tridupdate.py
deleted file mode 100644
index a90bf58dfe0c..000000000000
--- a/tridupdate.py
+++ /dev/null
@@ -1,114 +0,0 @@
-#-------------------------------------------------------------------------------
-# Name: tridupdate.py
-# Purpose: TrID's definitions package updater
-#
-# Author: Marco Pontello
-#
-# Created: 20/05/2012
-# Copyright: (c) Mark 2012
-# Licence: public domain
-#-------------------------------------------------------------------------------
-#!/usr/bin/env python
-
-import os
-import sys
-import hashlib
-import argparse
-import urllib
-import zipfile
-import tempfile
-
-PROGRAM_VER = "1.00"
-
-
-def errexit(mess, errlev=1):
- """Display an error and exit."""
- print "%s: error: %s" % (os.path.split(sys.argv[0])[1], mess)
- sys.exit(errlev)
-
-
-def chunked(file, chunk_size):
- """Helper function to read files in chunks."""
- return iter(lambda: file.read(chunk_size), '')
-
-
-def MD5digest(filename=None, data=None):
- """Return an MD5 digest for a file or a string."""
- h = hashlib.md5()
- if filename:
- f = open(filename, "rb")
- for data in chunked(f, 1024*1024):
- h.update(data)
- f.close()
- elif data:
- h.update(data)
- return h.hexdigest()
-
-
-def trdget(url_defs):
- """Download & unzip a new TrID defs package"""
- f = tempfile.TemporaryFile()
- u = urllib.urlopen(url_defs)
- for data in chunked(u, 1024*8):
- f.write(data)
- print "\r%dKB" % (f.tell() / 1024),
- print "\r",
- z = zipfile.ZipFile(f)
- trd = z.read("triddefs.trd")
- z.close()
- f.close()
- return trd
-
-
-def get_cmdline():
- """Evaluate command line parameters, usage & help."""
- parser = argparse.ArgumentParser(
- description="TrID's definitions updater",
- formatter_class=argparse.ArgumentDefaultsHelpFormatter,
- prefix_chars='-/+',
- version = "TrIDUpdate v%s - (C) 2012 M.Pontello" % PROGRAM_VER)
- parser.add_argument("filename", action="store", nargs='?',
- help = "TRD package filename.", default="triddefs.trd")
- res = parser.parse_args()
- return res
-
-
-def main():
- res = get_cmdline()
- trdfilename = res.filename
-
- url_MD5 = "http://mark0.net/download/triddefs.trd.md5"
- url_defs = "http://mark0.net/download/triddefs.zip"
-
- if os.path.exists(trdfilename):
- curdigest = MD5digest(filename=trdfilename)
- print "MD5: %s" % (curdigest)
- else:
- curdigest = 0
- print "File %s not found" % (trdfilename)
-
- print "Checking last version online..."
- f = urllib.urlopen(url_MD5)
- newdigest = f.read()
- f.close()
- print "MD5: %s" % (newdigest)
-
- if curdigest == newdigest:
- print "Current defs are up-to-date."
- sys.exit(0)
-
- print "Downloading new defs..."
- trdpack = trdget(url_defs)
-
- print "Checking defs integrity..."
- if MD5digest(data=trdpack) == newdigest:
- f = open(trdfilename, "wb")
- f.write(trdpack)
- f.close()
- print "OK."
- else:
- errexit("Digest don't match. Retry!")
-
-
-if __name__ == '__main__':
- main()
diff --git a/update-trid-defs.sh b/update-trid-defs.sh
index 66b9c39bba15..496d9f4dc9b9 100644
--- a/update-trid-defs.sh
+++ b/update-trid-defs.sh
@@ -8,6 +8,6 @@ fi
_PWD=$(pwd)
cd /var/lib/trid/
-python2 /usr/share/trid/tridupdate.py
+python /usr/share/trid/tridupdate.py
cd ${_PWD}