systemd-cron-next/configure
2015-12-10 21:31:05 +03:00

205 lines
4.0 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'
# 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
# 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:,
enable-boot::,
enable-minutely::,
enable-hourly::,
enable-daily::,
enable-weekly::,
enable-monthly::,
enable-quarterly::,
enable-semi_annually::,
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-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;;
'--')
shift
break;;
esac
done
if [ ${enable_boot} = 'yes' ]; then
schedules="${schedules} sched-boot"
fi
if [ ${enable_minutely} = 'yes' ]; then
schedules="${schedules} sched-minutely"
fi
if [ ${enable_hourly} = 'yes' ]; then
schedules="${schedules} sched-hourly"
fi
if [ ${enable_daily} = 'yes' ]; then
schedules="${schedules} sched-daily"
fi
if [ ${enable_weekly} = 'yes' ]; then
schedules="${schedules} sched-weekly"
fi
if [ ${enable_monthly} = 'yes' ]; then
schedules="${schedules} sched-monthly"
fi
if [ ${enable_quarterly} = 'yes' ]; then
schedules="${schedules} sched-quarterly"
fi
if [ ${enable_semi_annually} = 'yes' ]; then
schedules="${schedules} sched-semi-annually"
fi
if [ ${enable_yearly} = 'yes' ]; then
schedules="${schedules} sched-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