systemd-cron-next/configure
2015-07-28 20:52:43 +03:00

238 lines
4.8 KiB
Bash
Executable File

#!/bin/sh
prefix='/usr/local'
bindir='$(prefix)/bin'
confdir='$(prefix)/etc'
datadir='$(prefix)/share'
libdir='$(prefix)/lib'
statedir='/var/spool/cron'
mandir='$(datadir)/man'
docdir='$(datadir)/doc/$(package)'
unitdir='$(libdir)/systemd/system'
runparts='/usr/bin/run-parts'
enable_setgid=no
# 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
stale_stamps='$(libdir)/$(package)/remove_stale_stamps'
# systemd ≥ 217
enable_minutely=no
enable_quarterly=no
enable_semi_annually=no
ARGS=$(getopt -n "$(basename "${0}")" -o '' -l '
prefix:,
bindir:,
confdir:,
datadir:,
libdir:,
statedir:,
mandir:,
docdir:,
unitdir:,
runparts:,
stale-stamps:,
enable-boot::,
enable-minutely::,
enable-hourly::,
enable-daily::,
enable-weekly::,
enable-monthly::,
enable-quarterly::,
enable-semi_annually::,
enable-yearly::,
enable-persistent::,
enable-setgid::,
' -- "${@}")
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;;
'--stale-stamps')
stale_stamps="${2}"
shift 2;;
'--enable-boot')
set_enable_flag boot ${2}
shift 2;;
'--enable-minutely')
set_enable_flag minutely ${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-quarterly')
set_enable_flag quarterly ${2}
shift 2;;
'--enable-semi_annually')
set_enable_flag semi_annually ${2}
shift 2;;
'--enable-yearly')
set_enable_flag yearly ${2}
shift 2;;
'--enable-persistent')
set_enable_flag persistent ${2}
shift 2;;
'--enable-setgid')
set_enable_flag setgid ${2}
shift 2;;
'--')
shift
break;;
esac
done
if [ ${enable_boot} = 'yes' ]; then
schedules="${schedules} boot"
else
schedules_not="${schedules_not} boot"
fi
if [ ${enable_minutely} = 'yes' ]; then
schedules="${schedules} minutely"
else
schedules_not="${schedules_not} minutely"
fi
if [ ${enable_hourly} = 'yes' ]; then
schedules="${schedules} hourly"
else
schedules_not="${schedules_not} hourly"
fi
if [ ${enable_daily} = 'yes' ]; then
schedules="${schedules} daily"
else
schedules_not="${schedules_not} daily"
fi
if [ ${enable_weekly} = 'yes' ]; then
schedules="${schedules} weekly"
else
schedules_not="${schedules_not} weekly"
fi
if [ ${enable_monthly} = 'yes' ]; then
schedules="${schedules} monthly"
else
schedules_not="${schedules_not} monthly"
fi
if [ ${enable_quarterly} = 'yes' ]; then
schedules="${schedules} quarterly"
else
schedules_not="${schedules_not} quarterly"
fi
if [ ${enable_semi_annually} = 'yes' ]; then
schedules="${schedules} semi-annually"
else
schedules_not="${schedules_not} semi-annually"
fi
if [ ${enable_yearly} = 'yes' ]; then
schedules="${schedules} yearly"
else
schedules_not="${schedules_not} yearly"
fi
echo '# Generated by ./configure' > Makefile
sed "
s|@schedules@|${schedules}|g
s|@schedules_not@|${schedules_not}|g
s|@enable_persistent@|${enable_persistent}|g
s|@enable_setgid@|${enable_setgid}|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
s|@stale_stamps@|${stale_stamps}|g
" Makefile.in >> Makefile