1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
set -eu
# Run from the unpacked source directory; only convert synthetic fixtures.
perl -c initify.pl
perl -c cronify.pl
work=$(mktemp -d)
trap 'rm -rf "$work"' 0
cat > "$work/example.service" <<'UNIT'
[Unit]
Description=Fixture service
[Service]
Type=simple
ExecStart=/usr/bin/example --foreground
PIDFile=/run/example.pid
UNIT
perl initify.pl --name fixture "$work/example.service"
grep -Fx '#!/sbin/openrc-run' "$work/example"
grep -Fx 'command=/usr/bin/example' "$work/example"
grep -Fx 'command_args="--foreground"' "$work/example"
grep -Fx 'pidfile=/run/example.pid' "$work/example"
grep -Fx 'name="fixture"' "$work/example"
sh -n "$work/example"
printf '[Timer]\nOnCalendar=daily\n' > "$work/example.timer"
[ "$(perl cronify.pl "$work/example.timer" | tr -d '[:space:]')" = '@daily' ]