|
Lines 218-223
systemd_enable_service() {
Link Here
|
| 218 |
dosym ../"${service}" "${ud}"/"${target}".wants/"${destname}" |
218 |
dosym ../"${service}" "${ud}"/"${target}".wants/"${destname}" |
| 219 |
} |
219 |
} |
| 220 |
|
220 |
|
|
|
221 |
# @FUNCTION: systemd_enable_ntpunit |
| 222 |
# @USAGE: <NN-name> <service>... |
| 223 |
# @DESCRIPTION: |
| 224 |
# Add an NTP service provider to the list of implementations |
| 225 |
# in timedated. <NN-name> defines the newly-created ntp-units.d priority |
| 226 |
# and name, while the remaining arguments list service units that will |
| 227 |
# be added to that file. |
| 228 |
# |
| 229 |
# Uses doins, thus it is fatal in EAPI 4 and non-fatal in earlier |
| 230 |
# EAPIs. |
| 231 |
# |
| 232 |
# Doc: http://www.freedesktop.org/wiki/Software/systemd/timedated/ |
| 233 |
systemd_enable_ntpunit() { |
| 234 |
debug-print-function ${FUNCNAME} "${@}" |
| 235 |
if [[ ${#} -lt 2 ]]; then |
| 236 |
die "Usage: systemd_enable_ntpunit <NN-name> <service>..." |
| 237 |
fi |
| 238 |
|
| 239 |
local ntpunit_name=${1} |
| 240 |
local services=( "${@:2}" ) |
| 241 |
|
| 242 |
if [[ ${ntpunit_name} != [0-9][0-9]-* ]]; then |
| 243 |
die "ntpunit.d file must be named NN-name where NN are digits." |
| 244 |
elif [[ ${ntpunit_name} == *.list ]]; then |
| 245 |
die "The .list suffix is appended implicitly to ntpunit.d name." |
| 246 |
fi |
| 247 |
|
| 248 |
local unitdir=$(systemd_get_unitdir) |
| 249 |
local s |
| 250 |
for s in "${services[@]}"; do |
| 251 |
if [[ ! -f "${D}${unitdir}/${s}" ]]; then |
| 252 |
die "ntp-units.d provider ${s} not installed (yet?) in \${D}." |
| 253 |
fi |
| 254 |
echo "${s}" >> "${T}"/${ntpunit_name}.list |
| 255 |
done |
| 256 |
|
| 257 |
( |
| 258 |
insinto "$(_systemd_get_utildir)"/ntp-units.d |
| 259 |
doins "${T}"/${ntpunit_name}.list |
| 260 |
) |
| 261 |
local ret=${?} |
| 262 |
|
| 263 |
rm "${T}"/${ntpunit_name}.list || die |
| 264 |
|
| 265 |
return ${ret} |
| 266 |
} |
| 267 |
|
| 221 |
# @FUNCTION: systemd_with_unitdir |
268 |
# @FUNCTION: systemd_with_unitdir |
| 222 |
# @USAGE: [<configure-option-name>] |
269 |
# @USAGE: [<configure-option-name>] |
| 223 |
# @DESCRIPTION: |
270 |
# @DESCRIPTION: |
| 224 |
- |
|
|