From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=DYZdGI/dskVvpKkdBAVrjaJ7cYkXdykTqOW50JkSFk4=; b=X3zmXv2Vlw3bWIhZoa+LwBv/tgOKdZmwNZJ39PlfoochmeU2zOwhJ/oqzsJEl3uceY sVnEVgjQL9fAljKbPkeMtLa1Juz6yM/vDWken6qjnUY5oXMDVO39sCJGzGFoczxeaERE qPqN6f3RAZ16Gs547f9s9loynOTs47fonGwhhUdQzg4xPeQGno17eAzjJR+o3+bBmZDe rcHc5uCdKR/Wae8JN8UxiGQ5LxJik+FY3DeBC1TpkOq+zyIClxk6xf5dYOPunJ3lzzvz h8+BFrE6q4ohq8lZAOtiWOYAOuKVyd9VyRetaadiSUY47vhwXiXufPOm3zFtg/U309mk AXnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=DYZdGI/dskVvpKkdBAVrjaJ7cYkXdykTqOW50JkSFk4=; b=pw6rC7sir5M3Ieyh0as0T+a1tRgBo8c2dvAIeyZ6YEuOPRoP/iYAs8ZBHh2VkwmxSA 9DOQWF0M6H68rLH6Z8MZ9WCxiR8iZMeDYAn9x5prlzo0NCwSot3tNL+eN88Ug62/dKxs 2rnHeyL1c3m9sWaWubv2SLIsVBL6MUUeuEUuRAUuWjSQ6BjLKmicnjcPr7s7Tf2p9ZAV EYWquueIV6V/WWRxerOZS08P03dNhQ6Vn+Vk2GEe2unyj7nlNDhLpHMCGQ05sPWEgBjX mjhNL8KzGjXbFD4BTC1P7JNhVs7QLsUxpQ4YzizmlWMKo1EKFUukLNnMfGUo/WqCedUd KhUw== X-Gm-Message-State: AOAM532zR5K2NfTx3a4dTitBSLbUSB7KSDlbp8oQtD9j0hHUVEyNoSNK cBCATzgCLMQlTLZk2V0FEtb99/6ADIo= X-Google-Smtp-Source: ABdhPJzOEWVdKpBk6hh1ndgsOWQfqsKxLSXE9XB50GMwgLTITArLDaJalOCvX97tSfI6rRsLfCljKA== X-Received: by 2002:a05:6512:3409:: with SMTP id i9mr4411999lfr.664.1635269813187; Tue, 26 Oct 2021 10:36:53 -0700 (PDT) To: make-initrd@lists.altlinux.org References: <20211024171959.6D48CA5E20@lists.altlinux.org> <20211026090823.wvxgqcpz3chr47du@example.org> <20211026112428.tzdua6xsqqrinlqs@example.org> From: Leonid Krivoshein Message-ID: <23e91e0e-d4fc-fa22-bd0d-e5a2126065b6@gmail.com> Date: Tue, 26 Oct 2021 20:36:52 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20211026112428.tzdua6xsqqrinlqs@example.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: ru Subject: Re: [make-initrd] [PATCH v6 01/22] separate new feature of bootchain-core from pipeline X-BeenThere: make-initrd@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: make-initrd@lists.altlinux.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2021 17:36:57 -0000 Archived-At: List-Archive: 26.10.2021 14:24, Alexey Gladkov пишет: > On Tue, Oct 26, 2021 at 12:39:07PM +0300, Leonid Krivoshein wrote: >> Привет! >> >> >> 26.10.2021 12:08, Alexey Gladkov пишет: >>> On Sun, Oct 24, 2021 at 08:19:59PM +0300, Leonid Krivoshein wrote: >>>> Pipeline live as an add-in over bootchain-core for backward >>>> compatibility with already existing solutions. >>>> For bootchain-core it is planned to implement a number of >>>> new features to cover the tasks of bootloading the installer >>>> and live systems. >>>> >>>> Signed-off-by: Leonid Krivoshein >>>> --- >>>> features/bootchain-core/README.md | 82 +++++++++++++++++++ >>>> features/bootchain-core/config.mk | 8 ++ >>>> .../data/etc/initrd/cmdline.d/bootchain-core} | 3 +- >>>> .../data/etc/rc.d/init.d/bootchain} | 8 +- >>>> .../udev/rules.d/50-bootchain-waitdev.rules} | 2 +- >>>> .../data/lib/bootchain}/getimage | 2 +- >>>> .../data/lib/bootchain}/mountfs | 2 +- >>>> .../data/lib/bootchain}/overlayfs | 2 +- >>>> .../data/lib/bootchain}/rootfs | 2 +- >>>> .../data/lib/bootchain}/waitdev | 4 +- >>>> .../data/lib/initrd/cmdline.d/bootchain | 6 ++ >>>> .../data/lib/initrd/cmdline.d/pipeline | 2 +- >>>> .../lib/uevent/filters/bootchain-waitdev} | 4 +- >>>> .../data/sbin/bootchain-sh-functions} | 12 +-- >>>> .../data/sbin/chaind} | 22 ++--- >>>> features/bootchain-core/rules.mk | 4 + >>>> features/pipeline/config.mk | 9 +- >>>> features/pipeline/rules.mk | 6 -- >>>> 18 files changed, 134 insertions(+), 46 deletions(-) >>>> create mode 100644 features/bootchain-core/README.md >>>> create mode 100644 features/bootchain-core/config.mk >>>> rename features/{pipeline/data/etc/initrd/cmdline.d/pipeline => bootchain-core/data/etc/initrd/cmdline.d/bootchain-core} (63%) >>>> rename features/{pipeline/data/etc/rc.d/init.d/pipeline => bootchain-core/data/etc/rc.d/init.d/bootchain} (83%) >>>> rename features/{pipeline/data/etc/udev/rules.d/50-pipeline-waitdev.rules => bootchain-core/data/etc/udev/rules.d/50-bootchain-waitdev.rules} (77%) >>>> rename features/{pipeline/data/lib/pipeline => bootchain-core/data/lib/bootchain}/getimage (93%) >>>> rename features/{pipeline/data/lib/pipeline => bootchain-core/data/lib/bootchain}/mountfs (91%) >>>> rename features/{pipeline/data/lib/pipeline => bootchain-core/data/lib/bootchain}/overlayfs (95%) >>>> rename features/{pipeline/data/lib/pipeline => bootchain-core/data/lib/bootchain}/rootfs (86%) >>>> rename features/{pipeline/data/lib/pipeline => bootchain-core/data/lib/bootchain}/waitdev (83%) >>>> create mode 100755 features/bootchain-core/data/lib/initrd/cmdline.d/bootchain >>>> rename features/{pipeline => bootchain-core}/data/lib/initrd/cmdline.d/pipeline (64%) >>>> rename features/{pipeline/data/lib/uevent/filters/pipeline-waitdev => bootchain-core/data/lib/uevent/filters/bootchain-waitdev} (77%) >>>> rename features/{pipeline/data/sbin/pipeline-sh-functions => bootchain-core/data/sbin/bootchain-sh-functions} (70%) >>>> rename features/{pipeline/data/sbin/pipelined => bootchain-core/data/sbin/chaind} (78%) >>>> create mode 100644 features/bootchain-core/rules.mk >>>> >>>> diff --git a/features/bootchain-core/README.md b/features/bootchain-core/README.md >>>> new file mode 100644 >>>> index 0000000..ce2bf98 >>>> --- /dev/null >>>> +++ b/features/bootchain-core/README.md >>>> @@ -0,0 +1,82 @@ >>>> +# Feature: bootchain-core >>>> + >>>> +`bootchain-core` - it's a fork and further development the original >>>> +feature of `pipeline`. This feature allow us to consistently setup >>>> +steps-scripts one by one. For details about `pipeline` you can see >>>> +in ../features/pipeline/README.md. >>>> + >>>> +In fork process `pipeline` was divided by three parts: >>>> + >>>> +- `bootchain-core` - the main functional of feature `pipeline`, common >>>> + API and daemon. >>>> +- `bootchain-getimage` - method to networking boot from ISO-image with >>>> + the wget utility. >>>> +- `bootchain-waitdev` - method to boot from specified local media. >>>> + >>>> +The future work with `bootchain` allowed us to create a few modules. >>>> +They are expected to be upstream soon. This divide on modules allow >>>> +us to optimize fill in `initramfs` only which we are need. >>>> + >>>> +## Main components of bootchain-core >>>> + >>>> +- `/sbin/bootchain-sh-functions` - common API and evolution >>>> + of `pipeline-sh-functions`. >>>> +- `/sbin/chaind` - daemon, evolution of `pipelined`. >>>> +- `/etc/rc.d/init.d/bootchain` - sysvinit start script. >>>> + >>>> +## Reasons of making fork and rename pipeline >>>> + >>>> +- A set of `bootchain` modules was developed in order to create a >>>> + replacement in stage1 programs `propagator`, fully integrated into >>>> + the run-time `make-initrd`. In the original version, the `pipeline` >>>> + feature did not satisfy this need. At an early stage of development, >>>> + it was not yet known what functionality `bootchain` would eventually >>>> + have, how far it would go from the fork and be able to whether to be >>>> + fully compatible with it. >>>> +- For some time, the development of `bootchain` was carried out independently >>>> + of the main project `make-initrd`. To build and test bootable disks with >>>> + `make-initrd` and `bootchain` so that `bootchain` does not depend on >>>> + `make-initrd` versions, so that not intersect with the `pipeline` features >>>> + built into the `make-initrd` and so as not to interfere the author of >>>> + `make-initrd`, the `pipeline` feature had to be copied under a different >>>> + name, giving it a more appropriate name at the same time. >>>> +- The result of the completed step is not always used next. Steps-scripts >>>> + they can use the results not only of the previous one, but also of any >>>> + earlier one the completed step. So it's not a pipeline in its purest >>>> + form, but rather a chain loading steps, the sequence of actions performed. >>>> + >>>> +## External elements of the bootchain (steps-scripts) >>>> + >>>> +- `mountfs` - mounts a file or device from the result of the previous or other >>>> + specified step. >>>> +- `overlayfs` - combines one or more elements of the boot chain using overlayfs. >>>> +- `rootfs` - forces the daemon to use the result of the previous element as the >>>> + found root of stage 2. >>>> + >>>> +## Boot parameters >>>> + >>>> +- `bootchain=name1[,name2][,name3]` - defines the initial state of the boot >>>> + chains, i.e. the steps that the daemon must go through one by one. These can >>>> + be both built-in pseudo-steps and real scripts of the actions performed. The >>>> + names these steps are listed separated by commas. >>>> +- `pipeline=name1[,name2][,name3]` - alias for `bootchain=...`. >>>> +- `mountfs=target` - specifies the file or device to be mounted. >>>> +- `overlayfs=list` - defines the list of elements to combine. >>>> + >>>> +## bootchain-sh-functions API >>>> + >>>> +- check_parameter() - checks that the required parameter is not empty, otherwise >>>> + it exits via fatal(). >>>> +- get_parameter() - outputs the value of the parameter of the current step by >>>> + the index $callnum. >>>> +- resolve_target() - output the path to a file, directory or device, depending >>>> + on from the parameter. >>>> +- run() - run an external command. >>>> + >>>> +## Example >>>> + >>>> +Cmdline: root=pipeline pipeline=getimage,mountfs,overlayfs,rootfs getimage=http://ftp.altlinux.org/pub/people/mike/iso/misc/vi-20140918-i586.iso mountfs=rescue >>>> + >>>> +Following these parameters, the daemon loads the image "vi-20140918-i586.iso", >>>> +mounts it via the loop device, mounts the "rescue" file from it as squashfs of >>>> +the root system, makes it writable using overlayfs and tries to boot from it. >>>> diff --git a/features/bootchain-core/config.mk b/features/bootchain-core/config.mk >>>> new file mode 100644 >>>> index 0000000..33e66ed >>>> --- /dev/null >>>> +++ b/features/bootchain-core/config.mk >>>> @@ -0,0 +1,8 @@ >>>> +$(call feature-requires,depmod-image add-udev-rules) >>>> + >>>> +BOOTCHAIN_CORE_DATADIR = $(FEATURESDIR)/bootchain-core/data >>>> + >>>> +BOOTCHAIN_CORE_RULES = \ >>>> + *-cdrom_id.rules >>>> + >>>> +BOOTCHAIN_CORE_MODULES = isofs squashfs overlay >>>> diff --git a/features/pipeline/data/etc/initrd/cmdline.d/pipeline b/features/bootchain-core/data/etc/initrd/cmdline.d/bootchain-core >>>> similarity index 63% >>>> rename from features/pipeline/data/etc/initrd/cmdline.d/pipeline >>>> rename to features/bootchain-core/data/etc/initrd/cmdline.d/bootchain-core >>>> index 4200d57..8af3a20 100644 >>>> --- a/features/pipeline/data/etc/initrd/cmdline.d/pipeline >>>> +++ b/features/bootchain-core/data/etc/initrd/cmdline.d/bootchain-core >>>> @@ -1,4 +1,5 @@ >>>> -register_parameter string PIPELINE >>>> +register_parameter string BOOTCHAIN >>>> +register_alias BOOTCHAIN PIPELINE >>>> register_array string GETIMAGE >>>> register_array string MOUNTFS >>>> register_array string OVERLAYFS >>>> diff --git a/features/pipeline/data/etc/rc.d/init.d/pipeline b/features/bootchain-core/data/etc/rc.d/init.d/bootchain >>>> similarity index 83% >>>> rename from features/pipeline/data/etc/rc.d/init.d/pipeline >>>> rename to features/bootchain-core/data/etc/rc.d/init.d/bootchain >>>> index 89d9de5..1be6d39 100755 >>>> --- a/features/pipeline/data/etc/rc.d/init.d/pipeline >>>> +++ b/features/bootchain-core/data/etc/rc.d/init.d/bootchain >>>> @@ -1,6 +1,6 @@ >>>> #!/bin/bash >>>> ### BEGIN INIT INFO >>>> -# Provides: pipeline >>>> +# Provides: bootchain >>>> # Required-Start: uevent udev >>>> # Should-Start: >>>> # Required-Stop: >>>> @@ -13,14 +13,14 @@ >>>> . /.initrd/initenv >>>> . /etc/init.d/template >>>> -NAME=pipelined >>>> +NAME=chaind >>>> PIDFILE="/var/run/$NAME.pid" >>>> ARGS="--lockfile $LOCKFILE --pidfile $PIDFILE --name $NAME --displayname $NAME" >>>> prepare() { >>>> local dir i n >>>> - dir=/.initrd/pipeline/waitdev >>>> + dir=/.initrd/bootchain/waitdev >>>> mkdir -p -- "$dir" >>>> i=0 >>>> @@ -32,7 +32,7 @@ prepare() { >>>> start() { >>>> RETVAL=0 >>>> - if [ "${ROOT-}" = pipeline ]; then >>>> + if [ "${ROOT-}" = bootchain ] || [ "${ROOT-}" = pipeline ]; then >>>> prepare >>>> start_daemon --background $ARGS "$NAME" >>>> RETVAL=$? >>>> diff --git a/features/pipeline/data/etc/udev/rules.d/50-pipeline-waitdev.rules b/features/bootchain-core/data/etc/udev/rules.d/50-bootchain-waitdev.rules >>>> similarity index 77% >>>> rename from features/pipeline/data/etc/udev/rules.d/50-pipeline-waitdev.rules >>>> rename to features/bootchain-core/data/etc/udev/rules.d/50-bootchain-waitdev.rules >>>> index e473deb..e4b8616 100644 >>>> --- a/features/pipeline/data/etc/udev/rules.d/50-pipeline-waitdev.rules >>>> +++ b/features/bootchain-core/data/etc/udev/rules.d/50-bootchain-waitdev.rules >>>> @@ -1 +1 @@ >>>> -SUBSYSTEM=="block", ACTION!="remove", RUN+="/lib/uevent/filters/pipeline-waitdev" >>>> +SUBSYSTEM=="block", ACTION!="remove", RUN+="/lib/uevent/filters/bootchain-waitdev" >>>> diff --git a/features/pipeline/data/lib/pipeline/getimage b/features/bootchain-core/data/lib/bootchain/getimage >>>> similarity index 93% >>>> rename from features/pipeline/data/lib/pipeline/getimage >>>> rename to features/bootchain-core/data/lib/bootchain/getimage >>>> index 409ad14..1f141ac 100755 >>>> --- a/features/pipeline/data/lib/pipeline/getimage >>>> +++ b/features/bootchain-core/data/lib/bootchain/getimage >>>> @@ -1,6 +1,6 @@ >>>> #!/bin/bash -efu >>>> -. pipeline-sh-functions >>>> +. bootchain-sh-functions >>>> check_parameter GETIMAGE >>>> url="$(get_parameter GETIMAGE)" >>>> diff --git a/features/pipeline/data/lib/pipeline/mountfs b/features/bootchain-core/data/lib/bootchain/mountfs >>>> similarity index 91% >>>> rename from features/pipeline/data/lib/pipeline/mountfs >>>> rename to features/bootchain-core/data/lib/bootchain/mountfs >>>> index d15ae91..45ffa68 100755 >>>> --- a/features/pipeline/data/lib/pipeline/mountfs >>>> +++ b/features/bootchain-core/data/lib/bootchain/mountfs >>>> @@ -1,6 +1,6 @@ >>>> #!/bin/bash -efu >>>> -. pipeline-sh-functions >>>> +. bootchain-sh-functions >>>> check_parameter MOUNTFS >>>> param="$(get_parameter MOUNTFS)" >>>> diff --git a/features/pipeline/data/lib/pipeline/overlayfs b/features/bootchain-core/data/lib/bootchain/overlayfs >>>> similarity index 95% >>>> rename from features/pipeline/data/lib/pipeline/overlayfs >>>> rename to features/bootchain-core/data/lib/bootchain/overlayfs >>>> index 23b869b..58261cc 100755 >>>> --- a/features/pipeline/data/lib/pipeline/overlayfs >>>> +++ b/features/bootchain-core/data/lib/bootchain/overlayfs >>>> @@ -1,6 +1,6 @@ >>>> #!/bin/bash -efu >>>> -. pipeline-sh-functions >>>> +. bootchain-sh-functions >>>> target="$(get_parameter OVERLAYFS)" >>>> diff --git a/features/pipeline/data/lib/pipeline/rootfs b/features/bootchain-core/data/lib/bootchain/rootfs >>>> similarity index 86% >>>> rename from features/pipeline/data/lib/pipeline/rootfs >>>> rename to features/bootchain-core/data/lib/bootchain/rootfs >>>> index e4b2ca9..6ac64a6 100755 >>>> --- a/features/pipeline/data/lib/pipeline/rootfs >>>> +++ b/features/bootchain-core/data/lib/bootchain/rootfs >>>> @@ -1,6 +1,6 @@ >>>> #!/bin/bash -efu >>>> -. pipeline-sh-functions >>>> +. bootchain-sh-functions >>>> [ -n "$prevdir" ] || >>>> fatal "no previous step to use as rootfs" >>>> diff --git a/features/pipeline/data/lib/pipeline/waitdev b/features/bootchain-core/data/lib/bootchain/waitdev >>>> similarity index 83% >>>> rename from features/pipeline/data/lib/pipeline/waitdev >>>> rename to features/bootchain-core/data/lib/bootchain/waitdev >>>> index f818cc5..74af6ea 100755 >>>> --- a/features/pipeline/data/lib/pipeline/waitdev >>>> +++ b/features/bootchain-core/data/lib/bootchain/waitdev >>>> @@ -1,12 +1,12 @@ >>>> #!/bin/bash -efu >>>> -. pipeline-sh-functions >>>> +. bootchain-sh-functions >>>> check_parameter WAITDEV >>>> devspec="$(get_parameter WAITDEV)" >>>> while [ -n "$devspec" ]; do >>>> - envfile="/.initrd/pipeline/waitdev/$callnum" >>>> + envfile="/.initrd/bootchain/waitdev/$callnum" >>>> if [ -s "$envfile" ]; then >>>> devfile= >>>> diff --git a/features/bootchain-core/data/lib/initrd/cmdline.d/bootchain b/features/bootchain-core/data/lib/initrd/cmdline.d/bootchain >>>> new file mode 100755 >>>> index 0000000..b692f6d >>>> --- /dev/null >>>> +++ b/features/bootchain-core/data/lib/initrd/cmdline.d/bootchain >>>> @@ -0,0 +1,6 @@ >>>> +#!/bin/bash -efu >>>> + >>>> +. /.initrd/initenv >>>> + >>>> +[ "${ROOT-}" != bootchain ] || >>>> + echo bootchain > /etc/initrd/method >>>> diff --git a/features/pipeline/data/lib/initrd/cmdline.d/pipeline b/features/bootchain-core/data/lib/initrd/cmdline.d/pipeline >>>> similarity index 64% >>>> rename from features/pipeline/data/lib/initrd/cmdline.d/pipeline >>>> rename to features/bootchain-core/data/lib/initrd/cmdline.d/pipeline >>>> index ac65b68..21b164c 100755 >>>> --- a/features/pipeline/data/lib/initrd/cmdline.d/pipeline >>>> +++ b/features/bootchain-core/data/lib/initrd/cmdline.d/pipeline >>>> @@ -3,4 +3,4 @@ >>>> . /.initrd/initenv >>>> [ "${ROOT-}" != pipeline ] || >>>> - echo pipeline > /etc/initrd/method >>>> + echo bootchain > /etc/initrd/method >>>> diff --git a/features/pipeline/data/lib/uevent/filters/pipeline-waitdev b/features/bootchain-core/data/lib/uevent/filters/bootchain-waitdev >>>> similarity index 77% >>>> rename from features/pipeline/data/lib/uevent/filters/pipeline-waitdev >>>> rename to features/bootchain-core/data/lib/uevent/filters/bootchain-waitdev >>>> index d975006..272aee7 100755 >>>> --- a/features/pipeline/data/lib/uevent/filters/pipeline-waitdev >>>> +++ b/features/bootchain-core/data/lib/uevent/filters/bootchain-waitdev >>>> @@ -3,8 +3,8 @@ >>>> . /.initrd/initenv >>>> . initrd-sh-functions >>>> -mkdir -p -- /.initrd/pipeline/waitdev >>>> -cd /.initrd/pipeline/waitdev >>>> +mkdir -p -- /.initrd/bootchain/waitdev >>>> +cd /.initrd/bootchain/waitdev/ >>>> i=0 >>>> while [ "$i" -lt "${WAITDEV:-0}" ]; do >>>> diff --git a/features/pipeline/data/sbin/pipeline-sh-functions b/features/bootchain-core/data/sbin/bootchain-sh-functions >>>> similarity index 70% >>>> rename from features/pipeline/data/sbin/pipeline-sh-functions >>>> rename to features/bootchain-core/data/sbin/bootchain-sh-functions >>>> index 662d069..fa6201f 100644 >>>> --- a/features/pipeline/data/sbin/pipeline-sh-functions >>>> +++ b/features/bootchain-core/data/sbin/bootchain-sh-functions >>>> @@ -1,13 +1,13 @@ >>>> #!/bin/bash -efu >>>> -if [ -z "${__pipeline_sh_functions-}" ]; then >>>> -__pipeline_sh_functions=1 >>>> +if [ -z "${__bootchain_sh_functions-}" ]; then >>>> +__bootchain_sh_functions=1 >>>> . /.initrd/initenv >>>> . shell-signal >>>> -handlerdir="/lib/pipeline" >>>> -mntdir="/dev/pipeline" >>>> +handlerdir=/lib/bootchain >>>> +[ "${ROOT-}" = pipeline ] && mntdir=/dev/pipeline || mntdir=/dev/bootchain >>>> check_parameter() >>>> { >>>> @@ -29,7 +29,7 @@ resolve_target() >>>> '') >>>> ;; >>>> pipe[0-9]|pipe[0-9][0-9]|pipe[0-9][0-9][0-9]) >>>> - target="$mntdir/dst/$target" >>>> + target="$mntdir/dst/step${target:4}" >>>> ;; >>> Тут явно что-то не то. >>> >>> Ты переименовал pipe* в step* и сделал это изменение для сохранения >>> обратной совместимости. Только что будет если в качестве аргумента этой >>> функции передадут новое имя step* ? >> Очевидно, сейчас не будет реакции на step*. > Будет и будет совершенно непонятное поведение. > > В патче не видно, но полный код: > > resolve_target() > { > local target="$1" > case "${target%%/*}" in > '') > ;; > pipe[0-9]|pipe[0-9][0-9]|pipe[0-9][0-9][0-9]) > target="$mntdir/dst/$target" > ;; > *) > if [ -z "${prevdir-}" ]; then > message "no previous stop to use" > return > fi > target="$prevdir/${target#/}" > ;; > esac > printf '%s' "$target" > } > > Если target не пуст и не имеет префикс 'pipe', то будет работать последний > кейс то есть будет что-то типа target="$prevdir/step3". Такого каталога > нет поэтому будет непонятная ошибка. Да. Ну, потому что не было предусмотрено такого синтаксиса step*. >>> Кажется, потерян ещё один кейс: >>> >>> step[0-9]|step[0-9][0-9]|step[0-9][0-9][0-9]) >>> target="$mntdir/dst/$target" >>> ;; >> Не потерян. Сначала тоже думал именно так реализовать, потом сделал немного > Если не потерян, то получается странность. Ты так хотел уйти от термина > "pipe", но он продолжает использоваться в bootchain= и к нему добавляется > step как указатель на относительную позицию. Согласен. :-) pipe был сохранён для совместимости, а так вообще идея была сразу переименовать в step, так что это не потеря, а злой умысел, но и правда, выглядит странно. )) >> иначе. В следующих коммитах это будет видно. Работает прямая адресация, как >> раньше -- pipe* и потом добавится step-, адресация в обратную сторону >> относительно текущего шага. С минусом интуитивно понятней. Если хочешь, >> давай сделаем алиас step = pipe для прямой адресации. > Я относительную адресацию тоже прокомментировал. > В общем, идею я понял. >>>> *) >>>> if [ -z "${prevdir-}" ]; then >>>> @@ -48,4 +48,4 @@ run() >>>> "$@" >>>> } >>>> -fi # __pipeline_sh_functions >>>> +fi # __bootchain_sh_functions >>>> diff --git a/features/pipeline/data/sbin/pipelined b/features/bootchain-core/data/sbin/chaind >>>> similarity index 78% >>>> rename from features/pipeline/data/sbin/pipelined >>>> rename to features/bootchain-core/data/sbin/chaind >>>> index 1d30061..d401101 100755 >>>> --- a/features/pipeline/data/sbin/pipelined >>>> +++ b/features/bootchain-core/data/sbin/chaind >>>> @@ -21,7 +21,7 @@ exit_handler() >>>> set_cleanup_handler exit_handler >>>> echo "$$" >"$pidfile" >>>> -. pipeline-sh-functions >>>> +. bootchain-sh-functions >>>> [ "${RDLOG-}" != 'console' ] || >>>> @@ -35,22 +35,22 @@ mkdir -p -- "$mntdir" >>>> mountpoint -q "$mntdir" || >>>> mount -t tmpfs tmpfs "$mntdir" ||: >>>> -pipenum=0 >>>> -pipe="$PIPELINE" >>>> +stepnum=0 >>>> +chainsteps="$BOOTCHAIN" >>>> datadir= >>>> destdir= >>>> -while [ -n "$pipe" ]; do >>>> - name="${pipe%%,*}" >>>> +while [ -n "$chainsteps" ]; do >>>> + name="${chainsteps%%,*}" >>>> exe="$handlerdir/$name" >>>> if [ -x "$exe" ]; then >>>> eval "callnum=\"\${callnum_$name:-0}\"" >>>> - datadir="$mntdir/src/pipe$pipenum" >>>> - destdir="$mntdir/dst/pipe$pipenum" >>>> + datadir="$mntdir/src/step$stepnum" >>>> + destdir="$mntdir/dst/step$stepnum" >>>> - [ "$pipenum" != 0 ] || >>>> + [ "$stepnum" != 0 ] || >>>> prevdir="" >>>> mkdir -p -- "$datadir" "$destdir" >>>> @@ -80,8 +80,8 @@ while [ -n "$pipe" ]; do >>>> eval "callnum_$name=\"\$callnum\"" >>>> fi >>>> - pipe="${pipe#$name}" >>>> - pipe="${pipe#,}" >>>> + chainsteps="${chainsteps#$name}" >>>> + chainsteps="${chainsteps#,}" >>>> - pipenum=$(($pipenum + 1)) >>>> + stepnum=$(($stepnum + 1)) >>>> done >>>> diff --git a/features/bootchain-core/rules.mk b/features/bootchain-core/rules.mk >>>> new file mode 100644 >>>> index 0000000..724a0b0 >>>> --- /dev/null >>>> +++ b/features/bootchain-core/rules.mk >>>> @@ -0,0 +1,4 @@ >>>> +MODULES_TRY_ADD += $(BOOTCHAIN_CORE_MODULES) >>>> + >>>> +PUT_UDEV_RULES += $(BOOTCHAIN_CORE_RULES) >>>> +PUT_FEATURE_DIRS += $(BOOTCHAIN_CORE_DATADIR) >>>> diff --git a/features/pipeline/config.mk b/features/pipeline/config.mk >>>> index 9172528..3ff29ac 100644 >>>> --- a/features/pipeline/config.mk >>>> +++ b/features/pipeline/config.mk >>>> @@ -1,8 +1 @@ >>>> -$(call feature-requires,depmod-image add-udev-rules) >>>> - >>>> -PIPELINE_DATADIR = $(FEATURESDIR)/pipeline/data >>>> - >>>> -PIPELINE_RULES = \ >>>> - *-cdrom_id.rules >>>> - >>>> -PIPELINE_MODULES = isofs squashfs overlay >>>> +$(call feature-requires,bootchain-core) >>>> diff --git a/features/pipeline/rules.mk b/features/pipeline/rules.mk >>>> index 3ccd260..e69de29 100644 >>>> --- a/features/pipeline/rules.mk >>>> +++ b/features/pipeline/rules.mk >>>> @@ -1,6 +0,0 @@ >>>> -MODULES_TRY_ADD += $(PIPELINE_MODULES) >>>> - >>>> -PUT_UDEV_RULES += $(PIPELINE_RULES) >>>> - >>>> -PUT_FEATURE_DIRS += $(PIPELINE_DATADIR) >>>> -PUT_FEATURE_FILES += $(PIPELINE_FILES) >>>> -- >>>> 2.24.1 >>>> >>>> _______________________________________________ >>>> Make-initrd mailing list >>>> Make-initrd@lists.altlinux.org >>>> https://lists.altlinux.org/mailman/listinfo/make-initrd >>>> >> -- >> Best regards, >> Leonid Krivoshein. >> >> _______________________________________________ >> Make-initrd mailing list >> Make-initrd@lists.altlinux.org >> https://lists.altlinux.org/mailman/listinfo/make-initrd -- Best regards, Leonid Krivoshein.