summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO16
-rw-r--r--PKGBUILD55
-rw-r--r--copying.txt1
-rwxr-xr-xidos-packages-update.sh75
4 files changed, 147 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..684d0ef3f9eb
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,16 @@
+pkgbase = idos-package-updater-script
+ pkgdesc = Bash script which automates the process of updating installed IDOS timetable browser related packages by reinstalling and thus fetching the newest version.
+ pkgver = 20160706
+ pkgrel = 2
+ epoch = 0
+ arch = any
+ groups = idos-timetable
+ license = custom
+ depends = yaourt
+ source = idos-packages-update.sh
+ source = copying.txt
+ sha256sums = c7b82eb0e686a20ffe51dc3544f2fe4c3d8f892c714ac3a7b5c7dcc7376140d2
+ sha256sums = c3cbff25307e905545788f5c74cc137d79706c60549092f2a37919b93cf55ee3
+
+pkgname = idos-package-updater-script
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..eb42a483348d
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,55 @@
+# Maintainer: dreieck
+
+_pkgname=idos-package-updater-script
+pkgname="${_pkgname}"
+epoch=0
+pkgver=20160706
+pkgrel=2
+pkgdesc="Bash script which automates the process of updating installed IDOS timetable browser related packages by reinstalling and thus fetching the newest version."
+arch=('any')
+license=('custom')
+
+groups=(
+ "idos-timetable"
+ )
+
+depends=(
+ "yaourt"
+)
+
+makedepends=()
+
+optdepends=()
+
+provides=()
+
+conflicts=()
+
+replaces=()
+
+
+source=(
+ "idos-packages-update.sh"
+ "copying.txt"
+)
+
+sha256sums=(
+ "c7b82eb0e686a20ffe51dc3544f2fe4c3d8f892c714ac3a7b5c7dcc7376140d2"
+ "c3cbff25307e905545788f5c74cc137d79706c60549092f2a37919b93cf55ee3"
+)
+
+
+package() {
+ _instdirbase='/opt/idos-timetable'
+ _instdir="${pkgdir}/${_instdirbase}"
+ _licdirbase="/usr/share/licenses/${pkgname}"
+ _licdir="${pkgdir}/${_licdirbase}"
+ _execdirbase='/usr/bin'
+ _execdir="${pkgdir}/${_execdirbase}"
+
+ install -v -D -m755 "${srcdir}/idos-packages-update.sh" "${_instdir}/idos-packages-update.sh"
+ install -v -D -m644 "${srcdir}/copying.txt" "${_licdir}/copying.txt"
+ install -v -d -m755 "${_execdir}"
+
+ ln -sv "${_instdirbase}/idos-packages-update.sh" "${_execdir}/"
+}
diff --git a/copying.txt b/copying.txt
new file mode 100644
index 000000000000..1a731621ccfc
--- /dev/null
+++ b/copying.txt
@@ -0,0 +1 @@
+This software is put in the public domain by it's author.
diff --git a/idos-packages-update.sh b/idos-packages-update.sh
new file mode 100755
index 000000000000..d41703ad0779
--- /dev/null
+++ b/idos-packages-update.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+
+##
+#
+# Version: 2016-07-06
+#
+##
+
+##
+#
+# This script re-installs packages related to the IDOS timetable information system, to update them when an update is available.
+# Since most packages are getting update upstream without any change in download URL, the packages are maintained in a similar way
+# as version control system based packages (e.g. ${pkgname}-git-style, though not on a version control system the extension "-latest"
+# is used). Thus, the version number of the packages in the AUR is purely cosmetic and reflects the current version from the time of
+# the last submit to the AUR. Newer versions may be there, and so this script simply installs the latest version. The locally
+# installed package will have the correct version number.
+#
+##
+
+##
+#
+# This script depends on:
+# * bash
+# * yaourt
+# * basic utilities: grep, sort, uniq.
+# (Instead of grep, comm also can be used, by swapping the comment in front of the respective lines).
+#
+##
+
+
+### Abort on error:
+set -e
+
+
+### Packages with these strings in their names are beeing re-installed by this script:
+idos_pkgs_strings=(
+ 'idos-'
+ 'ttf-timetable'
+)
+
+
+### Those variables will hold, line by line, the packages available for install and the one installed:
+avail=''
+installed=''
+
+for pkg_string in "${idos_pkgs_strings[@]}"; do
+ ### Get packages available for installation. The "echo ''" is there to get a newline added if new content is following.
+ avail+="$(echo ''; yaourt -S -q -s "${pkg_string}")"
+ ### Get packages which are installed. The "echo ''" is there to get a newline added if new content is following.
+ installed+="$(echo ''; yaourt -Q -q -s "${pkg_string}"; echo "")"
+done
+
+
+### Sort and unify and remove blank lines:
+avail="$(echo "${avail}" | sort | uniq | grep -E .)"
+installed="$(echo "${installed}" | sort | uniq | grep -E .)"
+
+### Get packages which are installed and available for installation at the same time:
+#installed_and_available="$(comm -1 -2 <(echo "${installed}" | sort) <(echo "${avail}" | sort))" # comm would do the job, on sorted files. grep also works on unsorted files.
+installed_and_available="$(echo "${avail}" | grep -F -x "${installed}" | sort | uniq)"
+
+
+### Print some information:
+_reinstall_marker="(x)"
+echo "Installed IDOS-related packages. Packages marked with ${_reinstall_marker} can and will be reinstalled."
+echo ""
+echo "${installed}" | while read pkg; do
+ if echo "${avail}" | grep -q -F -x "${pkg}"; then echo -n " ${_reinstall_marker} "; else echo -n " "; fi
+ echo "${pkg}"
+done
+echo ""
+
+
+### Reinstall installed and available packages:
+yaourt -S --noconfirm ${installed_and_available}