1 |
Michał Górny wrote: |
2 |
> +systemd_install_serviced() { |
3 |
> + debug-print-function ${FUNCNAME} "${@}" |
4 |
> + |
5 |
> + local src=${1} |
6 |
> + local service=${2} |
7 |
> + |
8 |
> + if [[ ! ${service} ]]; then |
9 |
> + [[ ${src} == *.conf ]] || die "Source file needs .conf suffix" |
10 |
|
11 |
I would hoist this check to before the if. |
12 |
|
13 |
> + service=${src##*/} |
14 |
> + service=${service%.conf} |
15 |
> + fi |
16 |
> + # avoid potentially common mistake |
17 |
> + [[ ${service} != *.d ]] || die "Service must not have .d suffix" |
18 |
|
19 |
Double-negative reads badly: |
20 |
|
21 |
[[ $service = *.d ]] && die "$FUNCNAME: Service must not have .d suffix" |
22 |
|
23 |
> Nope. 'insinto' sets INSDESTTREE. Due to lack of proper scoping |
24 |
> support in bash, we need to localize this variable to restore previous |
25 |
> 'insinto' scope after leaving the function. |
26 |
|
27 |
Actually the only reason you are able to do that, is *because* bash has proper |
28 |
scoping support. |
29 |
|
30 |
-- |
31 |
#friendly-coders -- We're friendly, but we're not /that/ friendly ;-) |