summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD51
1 files changed, 30 insertions, 21 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 3ff60224654b..f065bec26efa 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -8,11 +8,11 @@ _prevyear="$(( ${_year} - 1 ))"
_pkgname="idos-timetable-data-zsr-sk-20${_year}"
pkgname="${_pkgname}-latest"
epoch=1
-pkgver=2019_5_30
+pkgver=2019_8_27
pkgrel=1
pkgdesc="20${_prevyear}/20${_year} Timetable data for the offline railway and other public transport timetable search engines by CHAPS: Slovak train data, provided by Inprop (Slovakia)."
arch=(any)
-url="http://www.inprop.sk/download.aspx"
+url="https://www.inprop.eu/Home/Downloads"
license=('custom')
groups=(
@@ -52,27 +52,40 @@ conflicts=(
"${_pkgname}"
)
-_get_download_url() {
- echo "http://www.inprop.sk/Data/Vlak${_year}Sk.exe"
+_list_sources() {
+ wget -nv -O- "${url}" | tr -d '\a' | tr '\n' '\a' | sed -E -e 's|<tr>|\n|g' -e 's|</tr>|\n|g' | grep -E '<span.*>Vlaky 2019' | sed 's|^.*href="/Home/\(DownloadFile/[^"]*\)".*$|\1|g' | head -n1 | while read _line; do
+ echo "$(basename "${_line}").exe::$(dirname "${url}")/${_line}"
+ done
}
-_source0="$(_get_download_url)"
-_target0="vlak${_year}sk.exe"
+_sources=($(_list_sources))
source=(
- "${_target0}::${_source0}"
+ "${_sources[@]}"
"license-dummy.txt"
)
+sha256sums=()
+
+for i in $(seq 1 ${#_sources[@]}); do
+ sha256sums+=('SKIP')
+done
+
sha256sums=(
- 'SKIP'
+ "${sha256sums[@]}"
"14279a732be7d04304ff3860d54e0cf8c1a8ba0a46343eaf9b7ce3a105815946"
)
pkgver() {
- _ver="$(wget -nv -O- "${url}" | grep --text -E "Data/Vlak${_year}Sk\.exe" | sed -r 's|[^0-9]([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4})[^0-9]|\n\1\n|' | grep --text -E '^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}$' | awk -F. '{print $3"_"$2"_"$1}')"
+ # Use the version of the newest updated file.
+ wget -nv -O- "${url}" | tr -d '\a' | tr '\n' '\a' | sed -E -e 's|<tr>|\n|g' -e 's|</tr>|\n|g' | grep -E '<span.*>Vlaky 2019' | sed -E 's|^.*Updated:.*<span>([0-9]+/[0-9]+/[0-9]+).*$|\1|g' | awk -F/ '{print $3"_"$1"_"$2}' | sort -Vr | head -n1
+}
- echo "${_ver}"
+prepare() {
+ cd "${srcdir}"
+ for _file in *.exe; do
+ 7z x "${_file}"
+ done
}
@@ -80,17 +93,13 @@ package() {
_instdirbase='/opt/idos-timetable'
_instdir="${pkgdir}/${_instdirbase}"
- install -d -m755 "${_instdir}"
-
- cd "${_instdir}" && {
- 7z x "${srcdir}/${_target0}"
- chmod 755 Data*
- chmod 644 Data*/*
- }
- rm -f "${_instdir}/Data1"/[vV][lL][aA][kK].[tT][tT][rR] # This one is provided by idos-timetable-data-trains-common.
- rm -f "${_instdir}/Data1"/*.[tT][tT][mM] # Don't install map data here; use a seperate package for that.
- rm -f "${_instdir}/Data1"/*.[tT][tT][pP] # Don't install tariff data here; use a seperate package for that.
-
+ install -d -m755 "${_instdir}/Data1"
+
+ cp -av "${srcdir}/Data1/Vlak${_year}Sk.tt" "${_instdir}/Data1"/
+
+ chmod 755 "${_instdir}"/Data*
+ chmod 644 "${_instdir}"/Data*/*
+
install -d -m755 "${pkgdir}/usr/share/doc/${_pkgname}"
echo "${url}" > "${pkgdir}/usr/share/doc/${_pkgname}/info.url"
chmod 644 "${pkgdir}/usr/share/doc/${_pkgname}/info.url"