幽灵在规格文件中的rpm的目录?

问题描述 投票:0回答:3

我知道如何在其规格文件中掩饰rpm的文件:
%install
touch $RPM_BUILD_ROOT%/path/file
...
%files
%ghost /path/file

但是,如果我对目录采用相同的方法,则它不起作用:
%install
mkdir -p $RPM_BUILD_ROOT%/path/folder
...
%files
%ghost /path/folder

有人尝试过吗? 非常非常thx!

karl

rpm specifications rpm-spec ghost
3个回答
1
投票
我知道这个问题是旧的,但是我只是遇到了这个问题,解决方案是在预上器期间删除文件夹,这可能在将来对人们有所帮助。

%install touch $RPM_BUILD_ROOT%/path/file ... %files %ghost /path/folder %preun rm -rf /path/folder



0
投票

标记

0
投票

%dir

%attr
的相互作用我找不到任何详细信息,因此在这里我对RPM版本4.19.1.1.
的实验记录了我的实验。
Name: test-rpm
Version: 1.0.0
Release: 1
Summary: A simple test RPM
License: GPL

%description
A basic rpm for test purposes.

%prep

%build

%install
    # * Does %attr on a directory apply to files within?
    #   - Yes, %attr applies to all contents, which can lead to unexpected
    #     results.
    # * Does %ghost assume a file?
    #   - Yes, but note (see below) that "rpm --verify" does not discern
    #     between files and directories. Note that "rpm -qlvp <path.to.rpm>"
    #     lists the entry as a file.
    #   - %ghost only applies to the final component of a path, regardless of
    #     the presence of %dir. For example, given "%ghost /d3/d4/d5":
    #     > exit code 1: rpm -qf /d3; rpm -qf /d3/d4
    #     > exit code 0: rpm -qf /d3/d4/d5
    # * Can %ghost be added to %dir?
    #   - Yes. Note that "rpm -qlvp <path.to.rpm>" lists the entry as a
    #     directory.
    # * Does %attr on %ghost get checked by rpm?
    #   - Yes, but as long as all the attributes match, "rpm --verify" does not
    #     discern between files and directories. Tested using:
    #     > %attr (644,root,root) %ghost /d3/d4/d5
    #     > %attr (775,root,root) %ghost %dir /d4/d5/d6
    cd "%{buildroot}"
    mkdir -p {d1,d2}/{d1,d2}/d1

    echo "foo" >d1/f1
    echo "bar" >d1/f2
    echo "baz" >d1/f3
    echo "qwerty" >d1/d1/f1
    echo "asdfgh" >d1/d1/f2

    echo "foo" >d2/f1
    echo "bar" >d2/f2
    echo "baz" >d2/f3
    echo "qwerty" >d2/d1/f1
    echo "asdfgh" >d2/d1/f2

%clean

%pre

%post
echo "Install: %{name}"

%files
%defattr(666,root,root,777)
/d1
%attr (644,root,root) /d2
%attr (644,root,root) %ghost /d3/d4/d5
%attr (775,root,root) %ghost %dir /d4/d5/d6

%changelog
* Mon Feb 03 2025 initial rpm


最新问题
© www.soinside.com 2019 - 2025. All rights reserved.