alternatives: initial feature
This feature allows you to set alternatives [1]. For example, like this: @$(call add,ALTERNATIVES,/usr/bin/xvt:/usr/bin/xterm) Also, in the config itself, targets for setting alternatives may already be predefined. For example, use/alternatives/xvt/% allows you to specify arbitrary alternatives for xvt: use/alternatives/xvt/xterm, use/alternatives/xvt/mate-terminal, etc. However, an alternative must be available. 1. https://www.altlinux.org/Alternatives
This commit is contained in:
parent
388c0fbbf5
commit
2f0cf575ec
@ -54,6 +54,8 @@ include::../features.in/README[]
|
||||
|
||||
include::../features.in/00example/README[]
|
||||
|
||||
include::../features.in/alternatives/README[]
|
||||
|
||||
include::../features.in/apt-conf/README[]
|
||||
|
||||
include::../features.in/armh-mcom02/README[]
|
||||
|
13
features.in/alternatives/README
Normal file
13
features.in/alternatives/README
Normal file
@ -0,0 +1,13 @@
|
||||
=== features.in/alternatives ===
|
||||
|
||||
Данная фича позволяет задавать альтернативы [1].
|
||||
Например, так:
|
||||
|
||||
@$(call add,ALTERNATIVES,/usr/bin/xvt:/usr/bin/xterm)
|
||||
|
||||
Также в самом конфиге могут быть уже преопределены цели для установки альтернатив.
|
||||
Например, use/alternatives/xvt/% позволяет задавать произвольные альтернативы для xvt:
|
||||
use/alternatives/xvt/xterm, use/alternatives/xvt/mate-terminal и т.д.
|
||||
При этом альтернатива должна быть доступна.
|
||||
|
||||
1. https://www.altlinux.org/Alternatives
|
6
features.in/alternatives/config.mk
Normal file
6
features.in/alternatives/config.mk
Normal file
@ -0,0 +1,6 @@
|
||||
use/alternatives:
|
||||
@$(call add_feature)
|
||||
@$(call xport,ALTERNATIVES)
|
||||
|
||||
use/alternatives/xvt/%: use/alternatives
|
||||
@$(call add,ALTERNATIVES,/usr/bin/xvt:/usr/bin/$*)
|
10
features.in/alternatives/rootfs/image-scripts.d/99-alternatives
Executable file
10
features.in/alternatives/rootfs/image-scripts.d/99-alternatives
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh -efu
|
||||
|
||||
[ -n "$GLOBAL_ALTERNATIVES" ] || exit 0
|
||||
for alternative in $GLOBAL_ALTERNATIVES; do
|
||||
candidate="${alternative#*:}"
|
||||
alternative="${alternative%:*}"
|
||||
alternatives-manual "$alternative" "$candidate"
|
||||
done
|
||||
|
||||
alternatives-update
|
Loading…
Reference in New Issue
Block a user