forked from opening-hours/opening_hours.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PH_SH_batch_exporter.sh
executable file
·64 lines (57 loc) · 2.07 KB
/
PH_SH_batch_exporter.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
## @license AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>
## @author Copyright (C) 2015-2017 Robin Schneider <[email protected]>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Public License as
## published by the Free Software Foundation, version 3 of the
## License.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU Affero General Public License for more details.
##
## You should have received a copy of the GNU Affero General Public License
## along with this program. If not, see <https://www.gnu.org/licenses/>.
## Script for generating PH/SH files for https://github.com/anschuetz/linuxmuster
script_url="https://github.com/opening-hours/opening_hours.js/blob/master/PH_SH_batch_exporter.sh"
print_header()
{
echo "# This file was generated by the script ${script_url}."
echo "# Do not edit this file manually ;-)"
echo "#"
echo "# Diese Datei wurde durch das Skript ${script_url} erzeugt."
echo "# Nicht von Hand editieren ;-)"
}
gen_sh() {
local state="${1}"
local from="${2}"
local to="${3}"
local filepath="ferien_${state}.conf"
echo "Generating $filepath …"
./PH_SH_exporter.js /tmp/PH_SH_export.list --from "$from" --to "$to" --school-holidays --state "$state" --omit-date-hyphens
(
print_header
cat /tmp/PH_SH_export.list
) > "$filepath"
}
for state in by be bb hb hh he mv ni nw rp sn
do
gen_sh "$state" "2017" "2023"
done
# Only defined until 2019, lazy …
for state in bw st
do
gen_sh "$state" "2017" "2019"
done
for state in bw by be bb hb hh he mv ni nw rp sn st sl sh th
do
filepath="feiertage_${state}.conf"
echo "Generating $filepath …"
./PH_SH_exporter.js /tmp/PH_SH_export.list --from "2017" --to 2042 --public-holidays --state $state --omit-date-hyphens
(
print_header
cat /tmp/PH_SH_export.list
) > $filepath
done