summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Konarev2022-07-01 12:09:11 +0300
committerAlexander Konarev2022-07-01 12:09:11 +0300
commitbe0ba34f88f7a725d0e16a2cc01858d221f5cade (patch)
treeabc89d834e36f90190829d343e6ba1a29dcbb3a6
parent953084323daada5695a1ac7cd3d45bfc3dd921dc (diff)
downloadaur-be0ba34f88f7a725d0e16a2cc01858d221f5cade.tar.gz
minor modifications
-rw-r--r--.SRCINFO7
-rwxr-xr-xPKGBUILD31
-rw-r--r--download.py52
3 files changed, 44 insertions, 46 deletions
diff --git a/.SRCINFO b/.SRCINFO
index c9457d4b0718..21fe41fe9648 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,10 +1,9 @@
pkgbase = aksusbd-bin
pkgdesc = Sentinel AKSUSB daemon supporting Sentinel HASP, HASP HL, HASP4 and Hardlock keys.
- pkgver = 8.41
- pkgrel = 3
+ pkgver = 8.43
+ pkgrel = 1
url = https://supportportal.thalesgroup.com
install = package.install
- arch = i686
arch = x86_64
license = custom
makedepends = libarchive
@@ -20,6 +19,6 @@ pkgbase = aksusbd-bin
source = 0001-patch.patch
source = download.py
sha256sums = 6fcb6c4fcba1d01c1b3e68258e95297c323b2cbe8ee75c0a14ac0e9006926312
- sha256sums = 955d038821b7deee240f98713b39d6aa8aae12b86b8a4cb8d2005e8e22b9cd79
+ sha256sums = b3984568b7b9a30601882cc8994c978fa408f380d29f00b802e6344610b4ea4e
pkgname = aksusbd-bin
diff --git a/PKGBUILD b/PKGBUILD
index 6c4eb979d4d2..9a9288d297a8 100755
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,21 +2,18 @@
# Maintainer: Alexander Konarev (avkonarev) <AVKonarev@gmail.com>
pkgname=aksusbd-bin
-pkgver=8.41
-pkgrel=3
+pkgver=8.43
+pkgrel=1
pkgdesc="Sentinel AKSUSB daemon supporting Sentinel HASP, HASP HL, HASP4 and Hardlock keys."
arch=('i686' 'x86_64')
url="https://supportportal.thalesgroup.com"
license=('custom')
-
-_pkgname=aksusbd
-_ldk_filename="Sentinel_LDK_Linux_Run-time_Installer_script"
-
+arch=('x86_64')
source=(
"0001-patch.patch"
"download.py")
sha256sums=('6fcb6c4fcba1d01c1b3e68258e95297c323b2cbe8ee75c0a14ac0e9006926312'
- '955d038821b7deee240f98713b39d6aa8aae12b86b8a4cb8d2005e8e22b9cd79')
+ 'b3984568b7b9a30601882cc8994c978fa408f380d29f00b802e6344610b4ea4e')
makedepends=('libarchive'
'python'
'python-pip'
@@ -35,26 +32,22 @@ pkgver() {
}
prepare(){
- cd $srcdir
+ cd $srcdir
python -m venv venv
source venv/bin/activate
pip install selenium
python download.py
-
_nver=$(cat version.txt| cut -d' ' -f 1)
_nrel=$(cat version.txt| cut -d' ' -f 2)
- tar -xvzf ${_ldk_filename}/aksusbd-${_nver}.${_nrel}.tar.gz
-
- bsdtar -xvf ${_pkgname}-${_nver}.${_nrel}/pkg/${_pkgname}-${_nver}-${_nrel}.${CARCH}.rpm
-
+
+ tar -xvzf aksusbd-${_nver}.${_nrel}.tar.gz
+ bsdtar -xvf aksusbd-${_nver}.${_nrel}/pkg/aksusbd-${_nver}-${_nrel}.${CARCH}.rpm
patch -p1 < 0001-patch.patch
}
package() {
cd $srcdir
- if [ "${CARCH}" == "x86_64" ]; then
- arch_suffix=_${CARCH}
- fi
+ arch_suffix=_${CARCH}
# Binaries:
install -dm755 ${pkgdir}/usr/bin
@@ -70,8 +63,8 @@ package() {
install -m644 var/hasplm/init/hasplmd${arch_suffix}.service ${pkgdir}/usr/lib/systemd/system/hasplmd.service
# Readme.html:
- install -dm755 ${pkgdir}/usr/share/${_pkgname}/Readme
- cp -R ${_ldk_filename}/Readme_HTML5/* ${pkgdir}/usr/share/${_pkgname}/Readme/
- chmod -R 644 ${pkgdir}/usr/share/${_pkgname}/Readme/*
+ install -dm755 ${pkgdir}/usr/share/aksusbd/Readme
+ cp -R Readme_HTML5/* ${pkgdir}/usr/share/aksusbd/Readme/
+ chmod -R 644 ${pkgdir}/usr/share/aksusbd/Readme/*
}
diff --git a/download.py b/download.py
index 3d2cd7a0232d..82fe585c76f7 100644
--- a/download.py
+++ b/download.py
@@ -11,48 +11,51 @@ from selenium.webdriver.support.ui import WebDriverWait
def humansize(nbytes):
- suffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']
+ suffixes = ["B", "KB", "MB", "GB", "TB", "PB"]
i = 0
- while nbytes >= 1024 and i < len(suffixes)-1:
- nbytes /= 1024.
+ while nbytes >= 1024 and i < len(suffixes) - 1:
+ nbytes /= 1024.0
i += 1
- f = ('%.2f' % nbytes).rstrip('0').rstrip('.')
- return '%s %s' % (f, suffixes[i])
+ f = ("%.2f" % nbytes).rstrip("0").rstrip(".")
+ return "%s %s" % (f, suffixes[i])
def message(msg):
_bar = "\u2588"
- sys.stdout.write(_bar+"\r"+msg)
- # sys.stdout.flush()
-
-
-_ldk_filename = "Sentinel_LDK_Linux_Run-time_Installer_script.tar.gz"
+ sys.stdout.write(_bar + "\r" + msg)
def wait_downloading():
timeout_start = 60
- timeout_download = 60*5
- target_path = Path(_ldk_filename)
+ timeout_download = 60 * 5
+
+ def tar_exist():
+ return (
+ lst_files[0]
+ if (lst_files := list(Path(".").glob("*.tar.gz"))) and lst_files[0].stat().st_size > 0
+ else None
+ )
- if not (target_path.exists() and target_path.stat().st_size > 0):
- while not list(Path('.').glob('*.part')) and timeout_start:
+ if not (tar_name := tar_exist()):
+ while not list(Path(".").glob("*.part")) and timeout_start:
message(f"waiting for download to start {timeout_start} sec.")
sleep(1)
timeout_start -= 1
- if not list(Path('.').glob('*.part')):
+ if not list(Path(".").glob("*.part")):
raise Exception("Download failed")
- while (tmp_files := list(Path('.').glob('*.part'))) and timeout_download:
+ while (tmp_files := list(Path(".").glob("*.part"))) and timeout_download:
filesize = os.path.getsize(tmp_files[0])
message(f"Downloading file: {humansize(filesize)} wait {timeout_download} sec.")
sleep(1)
timeout_download -= 1
- if not (target_path.exists() and target_path.stat().st_size > 0):
+ if not (tar_name := tar_exist()):
raise Exception("Download failed")
message("Downloading complete\n")
+ return tar_name
options = webdriver.FirefoxOptions()
@@ -60,8 +63,8 @@ options.headless = True
options.set_preference("browser.download.folderList", 2)
options.set_preference("browser.download.manager.showWhenStarting", False)
options.set_preference("browser.download.dir", os.getcwd())
-options.set_preference(
- "browser.helperApps.neverAsk.saveToDisk", "application/octet-stream")
+options.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/octet-stream")
+
try:
print("Selenium start..")
@@ -69,7 +72,8 @@ try:
print("Searching url..")
browser.get(
- 'https://supportportal.gemalto.com/csm?id=kb_article_view&sysparm_article=KB0018315#')
+ "https://supportportal.gemalto.com/csm?id=kb_article_view&sysparm_article=KB0018315#"
+ )
wait = WebDriverWait(browser, 10)
element = wait.until(EC.element_to_be_clickable((By.LINK_TEXT, "DOW0003342")))
@@ -77,18 +81,20 @@ try:
element = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, ".btn-success")))
element.click()
- wait_downloading()
+ _ldk_filename = wait_downloading()
except Exception as error:
print(error)
sys.exit(1)
finally:
browser.quit()
-os.system(f"tar -xvzf {_ldk_filename}")
+match = None
+os.system(f"tar --strip-components=1 -xvzf {_ldk_filename}")
for root, dirs, files in os.walk(os.getcwd()):
for file in files:
if match := re.match(r"aksusbd-(\d+\.\d+)\.(\d+)", file):
_vers, _rel = match.groups()
os.system(f'echo "{_vers} {_rel}">version.txt')
sys.exit(0)
-sys.exit(1)
+if not match:
+ sys.exit(1)