first packaging for ArchLinux

master 0.1
Y 2020-02-09 17:36:10 +01:00
parent 0cbc841eb8
commit 3d2cdf5649
6 changed files with 70 additions and 28 deletions

28
PKGBUILD Normal file
View File

@ -0,0 +1,28 @@
# Maintainer: Yves G. <theYinYeti@yalis.fr>
pkgname=epsi2ical
pkgver=0.1
pkgrel=1
pkgdesc="Create an ICS file based on EPSIs web calendar"
arch=('any')
url="https://yalis.fr/git/yves/epsi2ics"
license=('GPL3')
source=("git+https://yalis.fr/git/yves/epsi2ics#tag=${pkgver}")
sha1sums=('SKIP')
optdepends=(
'smtp-forwarder: notify of calendar changes using `sendmail`'
)
package() {
cd "${srcdir}/epsi2ics"
mkdir -p "${pkgdir}/usr/bin"
cp epsiEDTtoICS.sh "${pkgdir}/usr/bin/epsi2ical"
chmod 755 "${pkgdir}/usr/bin/epsi2ical"
mkdir -p "${pkgdir}/usr/lib/systemd/system"
cp epsi2ical-{full,patch}@.{service,timer} "${pkgdir}/usr/lib/systemd/system/"
mkdir -p "${pkgdir}/usr/share/doc/${pkgname}"
cp README.adoc "${pkgdir}/usr/share/doc/${pkgname}/"
}

View File

@ -1,6 +1,6 @@
/////
# The epsi2ics project produces an ICS file from an EPSI school-year calendar.
# Copyright © 2019 Y. Gablin, under the GPL-3.0-or-later license.
# Copyright © 20192020 Y. Gablin, under the GPL-3.0-or-later license.
# Full licensing information in the LICENSE file, or gnu.org/licences/gpl-3.0.txt if the file is missing.
/////
@ -58,6 +58,7 @@ END:VEVENT
```
The script generates these entries starting from the middle of the past summer, until the middle of the next summer.
However, a “patch” mode is available, that updates a given number of weeks, starting from the current one.
The source “XHTML” is definitely not XML, and hardly HTML at that, so the script does not use any XML tooling, and does its best to have the right data in the right format.
If you encounter a bug, do not hesitate to create a ticket `;-)`
@ -65,42 +66,19 @@ If you encounter a bug, do not hesitate to create a ticket `;-)`
== Requirements
Very few requirements: bash, GNU awk, GNU date, sed, tr, and curl, usually on Linux. This probably also works on MacOS-X, Cygwin, Git-bash, WSL, and so on.
Optionally, `sendmail` can be used to notify of calendar changes, and `systemd` can automate the process.
The current locale must be an UTF-8 locale.
== Usage
The first parameter to the script is the student login name (firstname.lastname). The second parameter is the ICS file to write; standard output is used if no path is provided, or if the chosen location is not writeable.
See the header of the script for parameters: the student login name (firstname.lastname); the ICS file to write; email addresses to notify, etc.
Optionally, a systemd service can be written:
```systemd
# /etc/systemd/system/epsi2ics.service
[Unit]
Description=Create an ICS file based on EPSIs web calendar
[Service]
Type=oneshot
ExecStart=/path/to/epsiEDTtoICS.sh YOUR.LOGIN /srv/http/calendar.ics
```
and a systemd timer can update the calendar weekly:
```systemd
# /etc/systemd/system/epsi2ics.timer
[Unit]
Description=Run epsi2ics weekly
[Timer]
OnCalendar=weekly
[Install]
WantedBy=timers.target
```
systemd unit-files and packaging are provided for ArchLinux.
[literal.small]
.....
# The epsi2ics project produces an ICS file from an EPSI school-year calendar.
# Copyright © 2019 Y. Gablin, under the GPL-3.0-or-later license.
# Copyright © 20192020 Y. Gablin, under the GPL-3.0-or-later license.
# Full licensing information in the LICENSE file, or gnu.org/licences/gpl-3.0.txt if the file is missing.
.....

10
epsi2ical-full@.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Create an ICS file based on EPSIs web calendar for %I
[Service]
Type=oneshot
# EXPECTED ENVIRONMENT:
#Environment="ICS_PATH=/path/to/target.ics" "EXTRA_OPT=extra options (-m notify@example.org)"
ExecStart=/usr/bin/epsi2ical -j -u "%I" -c "${ICS_PATH}" ${EXTRA_OPT}

8
epsi2ical-full@.timer Normal file
View File

@ -0,0 +1,8 @@
[Unit]
Description=Run epsi2ical-full weekly for %I
[Timer]
OnCalendar=Fri 19:00
[Install]
WantedBy=timers.target

10
epsi2ical-patch@.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Patch an ICS file based on EPSIs web calendar for %I
[Service]
Type=oneshot
# EXPECTED ENVIRONMENT:
#Environment="ICS_PATH=/path/to/target.ics" "WEEK_COUNT=how many weeks to update" "EXTRA_OPT=extra options (-m notify@example.org)"
ExecStart=/usr/bin/epsi2ical -j -u "%I" -p "${ICS_PATH}" -w "${WEEK_COUNT}" ${EXTRA_OPT}

8
epsi2ical-patch@.timer Normal file
View File

@ -0,0 +1,8 @@
[Unit]
Description=Run epsi2ical-patch daily for %I
[Timer]
OnCalendar=Mon..Thu 19:00
[Install]
WantedBy=timers.target