diff --git a/doc/mkimage-profiles.asciidoc b/doc/mkimage-profiles.asciidoc index 43b622a1..12f65d85 100644 --- a/doc/mkimage-profiles.asciidoc +++ b/doc/mkimage-profiles.asciidoc @@ -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[] diff --git a/features.in/alternatives/README b/features.in/alternatives/README new file mode 100644 index 00000000..c0ce72b9 --- /dev/null +++ b/features.in/alternatives/README @@ -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 diff --git a/features.in/alternatives/config.mk b/features.in/alternatives/config.mk new file mode 100644 index 00000000..e65456b7 --- /dev/null +++ b/features.in/alternatives/config.mk @@ -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/$*) diff --git a/features.in/alternatives/rootfs/image-scripts.d/99-alternatives b/features.in/alternatives/rootfs/image-scripts.d/99-alternatives new file mode 100755 index 00000000..c8747aaf --- /dev/null +++ b/features.in/alternatives/rootfs/image-scripts.d/99-alternatives @@ -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