Add invite.ics attachment (fix #2)

```mail```-Aufruf und Zeitplanung ist nicht getestet
pull/4/head
Ludwig Behm 2 years ago committed by Philipp Matthias Schäfer
parent 2fd20b18f6
commit 5ad9de1c6d
  1. 30
      invite.ics
  2. 30
      invite.sh
  3. 2
      plenums_invite.service

@ -0,0 +1,30 @@
BEGIN:VCALENDAR
PRODID:-//KrautSpace Jena//KrautSpace Einladescript//DE
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:#DTSTART#
DTEND:#DTEND#
DTSTAMP:#DTSTAMP#
UID:#DTSTAMP#@kraut.space
SUMMARY:#SUMMARY#
DESCRIPTION:Wir treffen uns um 20 Uhr im virtuellen Raum unter:
\n\nhttps://blue.kabi.tk/b/hac-nuf-fp4
\n\nFür Vorbereitung und Protokoll gibt es wieder ein Pad,
bitte tragt schon mal Themen ein, die Ihr gern besprechen würdet:
\n\nhttps://vereinte.verwirrung.institute/p/ksplenum-#URLDATE#
\n\n\nGgf. muss das Pad erst noch vorbereitet werden,
die Vorlage mit Anleitung findet Ihr hier:
\n\nhttps://vereinte.verwirrung.institute/p/ksplenum-template
LOCATION:#LOCATION#
ORGANIZER;CN=KrautSpace Jena;
SENT-BY="MAILTO:#FROM#"
:mailto:#REPLY_TO#
SEQUENCE:0
STATUS:CONFIRMED
CLASS:PUBLIC
CATEGORIES:MEETING
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR

@ -4,18 +4,17 @@
from="office@krautspace.de"
to=("hackspace-jena@lstsrv.org" "krautspace-announce@lstsrv.org")
replyto="hackspace-jena@lstsrv.org"
subject="Einladung zum Plenum"
location_url="https://blue.kabi.tk/b/hac-nuf-fp4"
body_file=email_text # Use PROSEDATE for dd.mm.YYYY and URLDATE for YYYmmdd
## Find next Thursday
day_of_week=$(date +%u)
next_thursday_offset=$(( ( ( 7 - $day_of_week ) + 4 ) % 7 ))
date_fmt () { date -u -d "$2 next Thu" $1; }
## Check if next Thursday is the first of a month
if (( $(date -d "+$next_thursday_offset days" +%_d) > 7 )); then
if (( $(date_fmt +%_d) > 7 )); then
echo "Invitation should be sent at most a week in advance."
echo "Exiting without sending an inviation..."
exit
@ -23,10 +22,25 @@ fi
## Send invitation
prose_date=$(date -d "+$next_thursday_offset days" +%d.%m.%Y)
url_date=$(date -d "+$next_thursday_offset days" +%Y%m%d)
prose_date=$(date_fmt +%d.%m.%Y)
url_date=$(date_fmt +%Y%m%d)
script_path=$(readlink -f "$0")
source_directory=$(dirname "$script_path")
cat "$source_directory/$body_file" | sed -e "s/PROSEDATE/$prose_date/g" | sed -e "s/URLDATE/$url_date/g" | mail -s "$subject" -r "$from" "${to[@]}"
sed -e "s/#DTSTART#/$(date_fmt +%Y%m%dT%H%M%SZ "TZ=\"Europe/Berlin\" 20:00")/" \
-e "s/#DTEND#/$(date_fmt +%Y%m%dT%H%M%SZ "TZ=\"Europe/Berlin\" 21:00")/" \
-e "s/#DTSTAMP#/$(date -u +%Y%m%dT%H%M%SZ)/" \
-e "s/#SUMMARY#/KrautSpace Plenum/" \
-e "s/#LOCATION#/${location}/" \
-e "s/#FROM#/${from}/g" \
-e "s/#REPLY_TO#/${replyto}/g" \
-e "s/#URLDATE#/${url_date}/g" \
invite.ics > /tmp/invite.ics
sed -e "s/PROSEDATE/$prose_date/g" \
-e "s/URLDATE/$url_date/g" \
"$source_directory/$body_file" | mail -s "$subject" -r "$from" -a /tmp/invite.ics "${to[@]}"
ret=$?
rm -f /tmp/invite.ics
exit $ret

@ -4,3 +4,5 @@ Description=Send invitation to Hackspace's Plenum
[Service]
Type=oneshot
ExecStart=/opt/plenums_invite/invite.sh
PrivateTmp=yes

Loading…
Cancel
Save