我正在使用RPM創建一組文件和目錄,每個RPM都有不同的文件/目錄權限集。我創建了一個spec文件,它構建了這個RPM。 該規範文件看起來如下:rpmbuild設置錯誤的文件所有權說:root:root(錯誤的所有者/組構建:用戶)
Name: testMultipleFiles
Version: 1.0
Release: 2
Summary: Demo how to package multiple files
Group: DCCA Deployment
License: GPLv2
Source: testMultipleFiles.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
AutoReqProv: on
%description
Authors:
--------
Name Raj Kumar Sanpui
%prep
%setup -q
%build
%install
mkdir -p $RPM_BUILD_ROOT/opt/insiteone/dir1
mkdir -p $RPM_BUILD_ROOT/opt/insiteone/dir2
mkdir -p $RPM_BUILD_ROOT/opt/insiteone/dir3
mkdir -p $RPM_BUILD_ROOT/opt/insiteone/dir4
mkdir -p $RPM_BUILD_ROOT/opt/insiteone/dir5
mkdir -p $RPM_BUILD_ROOT/opt/insiteone/dir6
mkdir -p $RPM_BUILD_ROOT/opt/insiteone/dir7
mkdir -p $RPM_BUILD_ROOT/opt/insiteone/dir8
mkdir -p $RPM_BUILD_ROOT/opt/insiteone/dir9
mkdir -p $RPM_BUILD_ROOT/opt/insiteone/dir10
install file1.sh $RPM_BUILD_ROOT/opt/insiteone/dir1
install file2.sh $RPM_BUILD_ROOT/opt/insiteone/dir2
install file3.sh $RPM_BUILD_ROOT/opt/insiteone/dir3
install file4.sh $RPM_BUILD_ROOT/opt/insiteone/dir4
install file5.sh $RPM_BUILD_ROOT/opt/insiteone/dir5
install file6.sh $RPM_BUILD_ROOT/opt/insiteone/dir6
%clean
rm -rf $RPM_BUILD_ROOT
%post
%postun
%files
%defattr(644,insite1,insite1,0755)
/opt/insiteone/dir1/file1.sh
/opt/insiteone/dir2/file2.sh
/opt/insiteone/dir3/file3.sh
%attr(644,insite1,insite1)/opt/insiteone/dir4/file4.sh
%attr(644,insite1,insite1)/opt/insiteone/dir5/file5.sh
%attr(644,insite1,insite1)/opt/insiteone/dir6/file6.sh
%dir %attr(777,insite1,insite1)/opt/insiteone/dir4
%dir %attr(700,insite1,insite1)/opt/insiteone/dir5
%dir %attr(644,insite1,insite1)/opt/insiteone/dir6
%dir %attr(640,insite1,insite1)/opt/insiteone/dir7
%dir %attr(600,insite1,insite1)/opt/insiteone/dir8
%dir %attr(744,insite1,insite1)/opt/insiteone/dir9
%dir %attr(644,insite1,insite1)/opt/insiteone/dir10
然而,當我建立這個RPM,沒有錯誤,並生成成功,但生成日誌說:
Checking permissions and ownerships - using the permissions files
/tmp/Check.perms.gv6tJD
setting /var/tmp/testMultipleFiles-1.0-build/ to root:root 0755. (wrong owner/group build:users)
setting /var/tmp/testMultipleFiles-1.0-build/opt to root:root 0755. (wrong owner/group build:users)
,這意味着,它被設置以root身份:而不是insite1:insite1作爲用戶和組。
這是完整的生成日誌。
[email protected]:~/rpmbuild/SPECS> rpmbuild -bb testmulti.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.14760
+ umask 022
+ cd /home/build/rpmbuild/BUILD
+ cd /home/build/rpmbuild/BUILD
+ rm -rf testMultipleFiles-1.0
+ /usr/bin/gzip -dc /home/build/rpmbuild/SOURCES/testMultipleFiles.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd testMultipleFiles-1.0
++ /usr/bin/id -u
+ '[' 1001 = 0 ']'
++ /usr/bin/id -u
+ '[' 1001 = 0 ']'
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.14760
+ umask 022
+ cd /home/build/rpmbuild/BUILD
+ /bin/rm -rf /var/tmp/testMultipleFiles-1.0-build
++ dirname /var/tmp/testMultipleFiles-1.0-build
+ /bin/mkdir -p /var/tmp
+ /bin/mkdir /var/tmp/testMultipleFiles-1.0-build
+ cd testMultipleFiles-1.0
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.14760
+ umask 022
+ cd /home/build/rpmbuild/BUILD
+ cd testMultipleFiles-1.0
+ mkdir -p /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir1
+ mkdir -p /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir2
+ mkdir -p /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir3
+ mkdir -p /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir4
+ mkdir -p /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir5
+ mkdir -p /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir6
+ mkdir -p /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir7
+ mkdir -p /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir8
+ mkdir -p /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir9
+ mkdir -p /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir10
+ install file1.sh /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir1
+ install file2.sh /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir2
+ install file3.sh /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir3
+ install file4.sh /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir4
+ install file5.sh /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir5
+ install file6.sh /var/tmp/testMultipleFiles-1.0-build/opt/insiteone/dir6
+ /usr/lib/rpm/brp-lib64-linux
[email protected]: if you find problems with this script, drop me a note
+ RPM_BUILD_ROOT=/var/tmp/testMultipleFiles-1.0-build
+ export RPM_BUILD_ROOT
+ test -x /usr/sbin/Check -a 1001 = 0 -o -x /usr/sbin/Check -a '!' -z /var/tmp/testMultipleFiles-1.0-build
+ echo 'I call /usr/sbin/Check...'
I call /usr/sbin/Check...
+ /usr/sbin/Check
Checking permissions and ownerships - using the permissions files
/tmp/Check.perms.gv6tJD
setting /var/tmp/testMultipleFiles-1.0-build/ to root:root 0755. (wrong owner/group build:users)
setting /var/tmp/testMultipleFiles-1.0-build/opt to root:root 0755. (wrong owner/group build:users)
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-symlink
Processing files: testMultipleFiles-1.0-2
Finding Provides: /usr/lib/rpm/find-provides testMultipleFiles
Finding Requires: /usr/lib/rpm/find-requires testMultipleFiles
Finding Supplements: /usr/lib/rpm/find-supplements testMultipleFiles
Requires(interp): /bin/sh /bin/sh
Requires(rpmlib): rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
Requires(post): /bin/sh
Requires(postun): /bin/sh
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/testMultipleFiles-1.0-build
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/testMultipleFiles-1.0-build
Wrote: /home/build/rpmbuild/RPMS/x86_64/testMultipleFiles-1.0-2.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.14760
+ umask 022
+ cd /home/build/rpmbuild/BUILD
+ cd testMultipleFiles-1.0
+ rm -rf /var/tmp/testMultipleFiles-1.0-build
+ exit 0
請注意:的insite1:insite1用戶和組將出現在目標機器事先的RPM安裝,這是不存在的RPM構建機器的東西,因爲沒有理由讓我創建它們。
增加:我觀察到的,它會開始安裝所有文件和目錄精細具有適當權限,在具有用戶和本組的目標機(insite1:insite1),然而目錄DIR1,DIR2,和dir3仍然設置爲根:根但0755,我期待它是insite1:insite1基於%defattr
設置。 是不是沒有辦法設置默認的目錄權限?
感謝部分解決了這個問題,'dir1','dir2'和'dir3'現在安裝了'insite1:insite1',但仍然在構建相同的錯誤時出現:設置/var/tmp/testMultipleFiles-1.0-build/爲root:root 0755.(錯誤的所有者/組構建:用戶)' – kingsmasher1