#10 Release ownership of /var/log/lastlog
Closed 2 years ago by kzak. Opened 2 years ago by zbyszek.

file modified
-23
@@ -339,9 +339,6 @@ 

  mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man{1,6,8,5}

  mkdir -p ${RPM_BUILD_ROOT}%{_sbindir}

  mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/{pam.d,security/console.apps}

- mkdir -p ${RPM_BUILD_ROOT}/var/log

- touch ${RPM_BUILD_ROOT}/var/log/lastlog

- chmod 0644 ${RPM_BUILD_ROOT}/var/log/lastlog

  

  # install util-linux

  %make_install
@@ -434,24 +431,6 @@ 

  	-printf "%{_mandir}/man8/%f*\n" >> %{name}.files

  

  

- %post

- # only for minimal buildroots without /var/log

- [ -d /var/log ] || mkdir -p /var/log

- touch /var/log/lastlog

- chown root:root /var/log/lastlog

- chmod 0644 /var/log/lastlog

- # Fix the file context, do not use restorecon

- if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then

- 	SECXT=$( /usr/sbin/matchpathcon -n /var/log/lastlog 2> /dev/null )

- 	if [ -n "$SECXT" ]; then

- 		# Selinux enabled, but without policy? It's true for buildroots

- 		# without selinux stuff on host machine with enabled selinux.

- 		# We don't want to use any RPM dependence on selinux policy for

- 		# matchpathcon(2). SELinux policy should be optional.

- 		/usr/bin/chcon "$SECXT"  /var/log/lastlog >/dev/null 2>&1 || :

- 	fi

- fi

- 

  %post -n util-linux-core

  if [ ! -L /etc/mtab ]; then

  	ln -sf ../proc/self/mounts /etc/mtab || :
@@ -517,8 +496,6 @@ 

  %attr(755,root,root)	%{_bindir}/login

  %attr(2755,root,tty)	%{_bindir}/write

  

- %ghost %attr(0644,root,root) %verify(not md5 size mtime) /var/log/lastlog

- 

  %{_unitdir}/fstrim.*

  

  %{_bindir}/cal

/var/log directory is provided by filesystem package, no need to create
it. And systemd >= 235 will create /var/log/lastlog owned by utmp. So
release ownership of the file, and let systemd manage it.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1798685.
Similar change in setup: https://pagure.io/setup/pull-request/30.

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

Pull-Request has been closed by kzak

2 years ago
Metadata