File: configure

package info (click to toggle)
systemd-cron 1.3.1%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 176 kB
  • ctags: 35
  • sloc: python: 290; makefile: 155; sh: 146
file content (175 lines) | stat: -rwxr-xr-x 3,368 bytes parent folder | download
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/bin/sh

prefix='/usr/local'
bindir='$(prefix)/bin'
confdir='$(prefix)/etc'
datadir='$(prefix)/share'
libdir='$(prefix)/lib'
statedir='$(prefix)/var/spool/cron'
mandir='$(datadir)/man'
docdir='$(datadir)/doc/$(package)'
unitdir='$(libdir)/systemd/system'
runparts='/usr/bin/run-parts'

# systemd ≥ 197
enable_boot=yes
enable_hourly=yes
enable_daily=yes
enable_weekly=yes
enable_monthly=yes

# systemd ≥ 209
enable_yearly=no

# systemd ≥ 212
enable_persistent=no

ARGS=$(getopt -n "$(basename "${0}")" -o '' -l '
prefix:,
bindir:,
confdir:,
datadir:,
libdir:,
statedir:,
mandir:,
docdir:,
unitdir:,
runparts:,
enable-boot::,
enable-hourly::,
enable-daily::,
enable-weekly::,
enable-monthly::,
enable-yearly::,
enable-persistent::,
' -- "${@}")

if [ $? -ne 0 ]; then
    exit 1
fi

set_enable_flag()
{
    if [ -z ${2} ]; then
        eval "enable_${1}=yes"
    elif [ ${2} = 'yes' ] || [ ${2} = 'no' ]; then
        eval "enable_${1}=${2}"
    else
        echo "ERROR: Unkown value for enable-${1}: '${2}'. Expected 'yes' or 'no'."
    fi
}

eval set -- "${ARGS}"
while true;
do
    case "${1}" in
        '--prefix')
            prefix="${2}"
            shift 2;;

        '--bindir')
            bindir="${2}"
            shift 2;;

        '--confdir')
            confdir="${2}"
            shift 2;;

        '--datadir')
            datadir="${2}"
            shift 2;;

        '--libdir')
            libdir="${2}"
            shift 2;;

        '--statedir')
            statedir="${2}"
            shift 2;;

        '--mandir')
            mandir="${2}"
            shift 2;;

        '--docdir')
            docdir="${2}"
            shift 2;;

        '--unitdir')
            unitdir="${2}"
            shift 2;;

        '--runparts')
            runparts="${2}"
            shift 2;;

        '--enable-boot')
            set_enable_flag boot ${2}
            shift 2;;

        '--enable-hourly')
            set_enable_flag hourly ${2}
            shift 2;;

        '--enable-daily')
            set_enable_flag daily ${2}
            shift 2;;

        '--enable-weekly')
            set_enable_flag weekly ${2}
            shift 2;;

        '--enable-monthly')
            set_enable_flag monthly ${2}
            shift 2;;

        '--enable-yearly')
            set_enable_flag yearly ${2}
            shift 2;;

        '--enable-persistent')
            set_enable_flag persistent ${2}
            shift 2;;

        '--')
            shift
            break;;
    esac
done

if [ ${enable_boot} = 'yes' ]; then
    schedules="${schedules} boot"
fi

if [ ${enable_hourly} = 'yes' ]; then
    schedules="${schedules} hourly"
fi
if [ ${enable_daily} = 'yes' ]; then
    schedules="${schedules} daily"
fi
if [ ${enable_weekly} = 'yes' ]; then
    schedules="${schedules} weekly"
fi
if [ ${enable_monthly} = 'yes' ]; then
    schedules="${schedules} monthly"
fi
if [ ${enable_yearly} = 'yes' ]; then
    schedules="${schedules} yearly"
fi

echo '# Generated by ./configure' > Makefile
sed "
s|@schedules@|${schedules}|g
s|@enable_persistent@|${enable_persistent}|g
s|@prefix@|${prefix}|g
s|@bindir@|${bindir}|g
s|@confdir@|${confdir}|g
s|@datadir@|${datadir}|g
s|@libdir@|${libdir}|g
s|@statedir@|${statedir}|g
s|@mandir@|${mandir}|g
s|@docdir@|${docdir}|g
s|@unitdir@|${unitdir}|g
s|@runparts@|${runparts}|g
" Makefile.in >> Makefile