From: "Dmitry V. Levin" <ldv@altlinux.org>
To: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: Re: [devel] I: sysvinit vs systemd
Date: Sat, 25 Dec 2021 16:35:56 +0300
Message-ID: <20211225133555.GA31036@altlinux.org> (raw)
In-Reply-To: <20211224180411.GC19509@altlinux.org>
On Fri, Dec 24, 2021 at 09:04:11PM +0300, Dmitry V. Levin wrote:
> On Fri, Dec 24, 2021 at 08:50:18PM +0300, Alexey Shabalin wrote:
> [...]
> > > %pre -n systemd-modules-common
> > > src=/etc/modules
> > > dst=/etc/modules-load.d/modules.conf
> > > tmp=$dst.rpmmove
> > > rm -f $tmp
> > > if [ -L $dst -a -s $src -a ! -L $src ]; then
> >
> > Убрал проверку -L $dst. Потому что может не быть такого симлинка
> > (напрмер на системах sysv).
> > На самом деле не важно, есть ли там сейчас симлинк, все равно в итоге
> > там должен оказаться файл с содержимым /etc/modules.
> >
> > > mkdir -p ${tmp%/*}
> >
> > Убрал mkdir, т.к. все эти каталоги принадлежат пакету filesystem и
> > обязаны присутствовать в системе.
> >
> > > mv $src $tmp
> >
> > Оказалось что нельзя делать mv. При отсутствии $src выдает ошибку rpm
> > про cpio archive.
> > Заменил на cp. Rpm сам успешно преобразует $src файл в симлинк и
> > дополнительную помощь не приветствует.
>
> Если mv нельзя, то надо, видимо, делать cp -a.
При обновлении с не изменёнными /etc/sysctl.conf и /etc/modules получается:
'/etc/sysctl.conf' -> '/etc/sysctl.d/99-sysctl.conf.rpmmove'
systemd-sysctl-common-1:249.7-alt7.x86_64
renamed '/etc/sysctl.d/99-sysctl.conf' -> '/etc/sysctl.d/99-sysctl.conf.rpmsave'
renamed '/etc/sysctl.d/99-sysctl.conf.rpmmove' -> '/etc/sysctl.d/99-sysctl.conf'
'/etc/modules' -> '/etc/modules-load.d/modules.conf.rpmmove'
systemd-modules-common-1:249.7-alt7.noarch
renamed '/etc/modules-load.d/modules.conf' -> '/etc/modules-load.d/modules.conf.rpmsave'
renamed '/etc/modules-load.d/modules.conf.rpmmove' -> '/etc/modules-load.d/modules.conf'
При обновлении с изменёнными /etc/sysctl.conf и /etc/modules получается:
'/etc/sysctl.conf' -> '/etc/sysctl.d/99-sysctl.conf.rpmmove'
systemd-sysctl-common-1:249.7-alt7.x86_64
warning: /etc/sysctl.conf saved as /etc/sysctl.conf.rpmsave
renamed '/etc/sysctl.d/99-sysctl.conf' -> '/etc/sysctl.d/99-sysctl.conf.rpmsave'
renamed '/etc/sysctl.d/99-sysctl.conf.rpmmove' -> '/etc/sysctl.d/99-sysctl.conf'
'/etc/modules' -> '/etc/modules-load.d/modules.conf.rpmmove'
systemd-modules-common-1:249.7-alt7.noarch
warning: /etc/modules saved as /etc/modules.rpmsave
renamed '/etc/modules-load.d/modules.conf' -> '/etc/modules-load.d/modules.conf.rpmsave'
renamed '/etc/modules-load.d/modules.conf.rpmmove' -> '/etc/modules-load.d/modules.conf'
Я думаю, мы можем сделать лучше, если будем проверять .rpmsave,
которые создаёт rpm, например:
%pre modules-common
src=/etc/modules
dst=/etc/modules-load.d/modules.conf.rpmmove
rm -f $dst
if [ -s $src -a ! -L $src ]; then
cp -a $src $dst
fi
%post modules-common
src=/etc/modules.rpmsave
dst=/etc/modules-load.d/modules.conf
tmp=$dst.rpmmove
new=$dst.rpmnew
if [ -f $tmp ]; then
if cmp -s $src $tmp; then
mv -v -f $dst $new
mv -v $src $dst
fi
rm -f $tmp
fi
--
ldv
next prev parent reply other threads:[~2021-12-25 13:35 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-17 12:07 Alexey Gladkov
2021-12-17 12:09 ` Dmitry V. Levin
2021-12-21 17:25 ` Alexey Shabalin
2021-12-21 17:28 ` Антон Мидюков
2021-12-21 17:54 ` Sergey Y. Afonin
2021-12-22 4:00 ` Антон Мидюков
2021-12-17 12:12 ` Dmitry V. Levin
2021-12-17 12:38 ` Sergey V Turchin
2021-12-17 12:43 ` Alexey Gladkov
2021-12-17 12:56 ` Sergey V Turchin
2021-12-17 12:57 ` Anton Farygin
2021-12-17 14:41 ` Sergey V Turchin
2021-12-17 13:07 ` [devel] rpm-macro systemctl --user (was: sysvinit vs systemd) Sergey V Turchin
2021-12-17 13:22 ` Dmitry V. Levin
2021-12-17 13:35 ` Sergey V Turchin
2021-12-17 18:52 ` Dmitry V. Levin
2021-12-17 20:14 ` Alexey V. Vissarionov
2021-12-18 0:15 ` Sergey V Turchin
2021-12-18 13:22 ` Sergey V Turchin
2021-12-18 18:07 ` Alexey V. Vissarionov
2021-12-18 19:35 ` Sergey V Turchin
2021-12-18 0:06 ` Sergey V Turchin
2021-12-20 8:29 ` [devel] I: sysvinit vs systemd Stanislav Levin
2021-12-20 8:39 ` Andrey Savchenko
2021-12-20 8:48 ` Stanislav Levin
2021-12-20 10:00 ` Andrey Savchenko
2021-12-20 15:25 ` [devel] всё как в апстрме Dmitry V. Levin
2021-12-20 16:16 ` Anton Farygin
2021-12-20 16:35 ` Dmitry V. Levin
2021-12-21 12:45 ` [devel] I: sysvinit vs systemd Paul Wolneykien
2021-12-21 12:46 ` Paul Wolneykien
2021-12-21 12:47 ` Anton Farygin
2021-12-21 19:32 ` Антон Мидюков
2021-12-21 20:06 ` Leonid Krivoshein
2021-12-21 20:15 ` Leonid Krivoshein
2021-12-22 4:33 ` Антон Мидюков
2021-12-22 10:14 ` Sergey V Turchin
2021-12-22 10:37 ` Антон Мидюков
2021-12-22 11:00 ` Sergey V Turchin
2021-12-22 12:30 ` Alexey V. Vissarionov
2021-12-22 12:43 ` Sergey V Turchin
2021-12-22 11:01 ` Alexey Gladkov
2021-12-23 14:20 ` Dmitry V. Levin
2021-12-23 15:53 ` Alexey Shabalin
2021-12-23 23:26 ` Alexey Gladkov
2021-12-23 23:36 ` Dmitry V. Levin
2021-12-24 0:00 ` Dmitry V. Levin
2021-12-24 0:30 ` Dmitry V. Levin
2021-12-24 17:50 ` Alexey Shabalin
2021-12-24 18:04 ` Dmitry V. Levin
2021-12-25 13:35 ` Dmitry V. Levin [this message]
2021-12-24 15:07 ` Alexey Shabalin
2021-12-24 15:32 ` Dmitry V. Levin
2021-12-24 17:28 ` Alexey Shabalin
2021-12-24 17:55 ` Dmitry V. Levin
2021-12-26 8:02 ` Alexey V. Vissarionov
2021-12-23 15:59 ` Anton Farygin
2021-12-23 20:19 ` Dmitry V. Levin
2021-12-23 14:03 ` Sergey V Turchin
2021-12-23 14:15 ` Sergey V Turchin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211225133555.GA31036@altlinux.org \
--to=ldv@altlinux.org \
--cc=devel@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git