Remove test file packaging from main package, this cleanup reduced rpm
file size by ~2MB and may be an 16MB disk space after installation.
Add a patch to use bfq scheduler, more info at:
https://bugzilla.redhat.com/show_bug.cgi?id=1738828
More info on sysusers at:
https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/#_dynamic_allocation
https://fedoraproject.org/wiki/Changes/Adopting_sysusers.d_format
Change-Id: I07c011e4e87e18650eb9fd7ee45d010b7901e04d
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/19379
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,11 @@ |
| 0 |
+# RPM macros for packages creating system accounts |
|
| 1 |
+# |
|
| 2 |
+# Turn a sysusers.d file into macros specified by |
|
| 3 |
+# https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/#_dynamic_allocation |
|
| 4 |
+# This has been modified according to Photon needs |
|
| 5 |
+ |
|
| 6 |
+%sysusers_requires_compat Requires(pre): shadow |
|
| 7 |
+ |
|
| 8 |
+%sysusers_create_compat() \ |
|
| 9 |
+%(%{_rpmconfigdir}/sysusers.generate-pre.sh %{?*}) \
|
|
| 10 |
+%{nil}
|
| ... | ... |
@@ -1,7 +1,9 @@ |
| 1 |
+%global udev_services %{name}-udevd.service %{name}-udev-settle.service %{name}-udev-trigger.service %{name}-udevd-control.socket %{name}-udevd-kernel.socket %{name}-timesyncd.service
|
|
| 2 |
+ |
|
| 1 | 3 |
Name: systemd |
| 2 | 4 |
URL: http://www.freedesktop.org/wiki/Software/systemd |
| 3 | 5 |
Version: 252.4 |
| 4 |
-Release: 7%{?dist}
|
|
| 6 |
+Release: 8%{?dist}
|
|
| 5 | 7 |
License: LGPLv2+ and GPLv2+ and MIT |
| 6 | 8 |
Summary: System and Service Manager |
| 7 | 9 |
Group: System Environment/Security |
| ... | ... |
@@ -18,10 +20,16 @@ Source4: 99-dhcp-en.network |
| 18 | 18 |
Source5: 10-rdrand-rng.conf |
| 19 | 19 |
Source6: 10-defaults.preset |
| 20 | 20 |
|
| 21 |
-Patch0: enoX-uses-instance-number-for-vmware-hv.patch |
|
| 22 |
-Patch1: fetch-dns-servers-from-environment.patch |
|
| 23 |
-Patch2: 0001-systemd-Support-OOMPolicy-in-scope-units.patch |
|
| 24 |
-Patch3: 0001-systemd-Default-to-OOMPolicy-continue-for-login-sess.patch |
|
| 21 |
+Source11: macros.sysusers |
|
| 22 |
+Source12: sysusers.attr |
|
| 23 |
+Source13: sysusers.prov |
|
| 24 |
+Source14: sysusers.generate-pre.sh |
|
| 25 |
+ |
|
| 26 |
+Patch0: enoX-uses-instance-number-for-vmware-hv.patch |
|
| 27 |
+Patch1: fetch-dns-servers-from-environment.patch |
|
| 28 |
+Patch2: 0001-systemd-Support-OOMPolicy-in-scope-units.patch |
|
| 29 |
+Patch3: 0001-systemd-Default-to-OOMPolicy-continue-for-login-sess.patch |
|
| 30 |
+Patch4: use-bfq-scheduler.patch |
|
| 25 | 31 |
|
| 26 | 32 |
Requires: Linux-PAM |
| 27 | 33 |
Requires: bzip2 |
| ... | ... |
@@ -144,12 +152,12 @@ Summary: Rule-based device node and kernel event manager |
| 144 | 144 |
License: LGPLv2+ |
| 145 | 145 |
|
| 146 | 146 |
Requires: %{name} = %{version}-%{release}
|
| 147 |
-Requires(post): %{name}
|
|
| 148 |
-Requires(preun): %{name}
|
|
| 149 |
-Requires(postun): %{name}
|
|
| 147 |
+Requires(post): %{name} = %{version}-%{release}
|
|
| 148 |
+Requires(preun): %{name} = %{version}-%{release}
|
|
| 149 |
+Requires(postun): %{name} = %{version}-%{release}
|
|
| 150 | 150 |
Requires(post): grep |
| 151 | 151 |
Requires: kmod |
| 152 |
-Provides: udev = %{version}
|
|
| 152 |
+Provides: udev = %{version}-%{release}
|
|
| 153 | 153 |
|
| 154 | 154 |
%description udev |
| 155 | 155 |
This package contains systemd-udev and the rules and hardware database |
| ... | ... |
@@ -159,9 +167,9 @@ machines and in virtual machines, but not in containers. |
| 159 | 159 |
%package container |
| 160 | 160 |
Summary: Tools for containers and VMs |
| 161 | 161 |
Requires: %{name} = %{version}-%{release}
|
| 162 |
-Requires(post): %{name}
|
|
| 163 |
-Requires(preun): %{name}
|
|
| 164 |
-Requires(postun): %{name}
|
|
| 162 |
+Requires(post): %{name} = %{version}-%{release}
|
|
| 163 |
+Requires(preun): %{name} = %{version}-%{release}
|
|
| 164 |
+Requires(postun): %{name} = %{version}-%{release}
|
|
| 165 | 165 |
License: LGPLv2+ |
| 166 | 166 |
|
| 167 | 167 |
%description container |
| ... | ... |
@@ -174,9 +182,9 @@ and %{name}-importd.
|
| 174 | 174 |
Summary: Tools to send journal events over the network |
| 175 | 175 |
Requires: %{name} = %{version}-%{release}
|
| 176 | 176 |
License: LGPLv2+ |
| 177 |
-Requires(post): %{name}
|
|
| 178 |
-Requires(preun): %{name}
|
|
| 179 |
-Requires(postun): %{name}
|
|
| 177 |
+Requires(post): %{name} = %{version}-%{release}
|
|
| 178 |
+Requires(preun): %{name} = %{version}-%{release}
|
|
| 179 |
+Requires(postun): %{name} = %{version}-%{release}
|
|
| 180 | 180 |
Requires: libmicrohttpd |
| 181 | 181 |
Provides: %{name}-journal-gateway = %{version}-%{release}
|
| 182 | 182 |
|
| ... | ... |
@@ -246,13 +254,12 @@ fi |
| 246 | 246 |
CONFIGURE_OPTS=( |
| 247 | 247 |
-Dmode=release |
| 248 | 248 |
-Dkmod=true |
| 249 |
- -Duser-path=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin |
|
| 249 |
+ -Duser-path=%{_usr}/local/bin:%{_usr}/local/sbin:%{_bindir}:%{_sbindir}
|
|
| 250 | 250 |
-Dservice-watchdog= |
| 251 | 251 |
-Dblkid=true |
| 252 | 252 |
-Dseccomp=true |
| 253 | 253 |
-Ddefault-dnssec=no |
| 254 | 254 |
-Dfirstboot=false |
| 255 |
- -Dinstall-tests=false |
|
| 256 | 255 |
-Dldconfig=false |
| 257 | 256 |
-Dxz=true |
| 258 | 257 |
-Dzlib=true |
| ... | ... |
@@ -262,7 +269,7 @@ CONFIGURE_OPTS=( |
| 262 | 262 |
-Dsmack=true |
| 263 | 263 |
-Dgcrypt=true |
| 264 | 264 |
-Dsplit-usr=true |
| 265 |
- -Dsysusers=false |
|
| 265 |
+ -Dsysusers=true |
|
| 266 | 266 |
-Dpam=true |
| 267 | 267 |
-Dpolkit=true |
| 268 | 268 |
-Dselinux=true |
| ... | ... |
@@ -283,8 +290,8 @@ CONFIGURE_OPTS=( |
| 283 | 283 |
-Db_lto=true |
| 284 | 284 |
-Db_ndebug=false |
| 285 | 285 |
-Ddefault-hierarchy=hybrid |
| 286 |
- -Dsysvinit-path=/etc/rc.d/init.d |
|
| 287 |
- -Drc-local=/etc/rc.d/rc.local |
|
| 286 |
+ -Dsysvinit-path=%{_sysconfdir}/rc.d/init.d
|
|
| 287 |
+ -Drc-local=%{_sysconfdir}/rc.d/rc.local
|
|
| 288 | 288 |
-Dfallback-hostname=photon |
| 289 | 289 |
-Doomd=false |
| 290 | 290 |
-Dhomed=false |
| ... | ... |
@@ -297,11 +304,11 @@ CONFIGURE_OPTS=( |
| 297 | 297 |
$CROSS_COMPILE_CONFIG |
| 298 | 298 |
) |
| 299 | 299 |
|
| 300 |
-%meson "${CONFIGURE_OPTS[@]}"
|
|
| 301 |
-%meson_build |
|
| 300 |
+%{meson} "${CONFIGURE_OPTS[@]}"
|
|
| 301 |
+%{meson_build}
|
|
| 302 | 302 |
|
| 303 | 303 |
%install |
| 304 |
-%meson_install |
|
| 304 |
+%{meson_install}
|
|
| 305 | 305 |
|
| 306 | 306 |
sed -i '/srv/d' %{buildroot}%{_tmpfilesdir}/home.conf
|
| 307 | 307 |
sed -i "s:0775 root lock:0755 root root:g" %{buildroot}%{_tmpfilesdir}/legacy.conf
|
| ... | ... |
@@ -313,10 +320,13 @@ sed -i "s:#DNSOverTLS=opportunistic:DNSOverTLS=no:g" %{buildroot}%{_sysconfdir}/
|
| 313 | 313 |
|
| 314 | 314 |
sed -i 's/#DefaultOOMPolicy=stop/DefaultOOMPolicy=continue/' %{buildroot}%{_sysconfdir}/%{name}/system.conf
|
| 315 | 315 |
|
| 316 |
-rm -f %{buildroot}%{_var}/log/README
|
|
| 317 |
-mkdir -p %{buildroot}%{_localstatedir}/opt/journal/log
|
|
| 318 |
-mkdir -p %{buildroot}%{_localstatedir}/log
|
|
| 319 |
-ln -sfv %{_localstatedir}/opt/journal/log %{buildroot}%{_localstatedir}/log/journal
|
|
| 316 |
+rm -f %{buildroot}%{_var}/log/README \
|
|
| 317 |
+ %{buildroot}%{_sysusersdir}/README
|
|
| 318 |
+ |
|
| 319 |
+mkdir -p %{buildroot}%{_var}/opt/journal/log \
|
|
| 320 |
+ %{buildroot}%{_var}/log
|
|
| 321 |
+ |
|
| 322 |
+ln -sfr %{buildroot}%{_var}/opt/journal/log %{buildroot}%{_var}/log/journal
|
|
| 320 | 323 |
|
| 321 | 324 |
find %{buildroot} -name '*.la' -delete
|
| 322 | 325 |
install -Dm 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/udev/rules.d
|
| ... | ... |
@@ -333,30 +343,35 @@ ln -sfv multi-user.target %{buildroot}%{_unitdir}/default.target
|
| 333 | 333 |
%ifarch x86_64 |
| 334 | 334 |
install -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/modules-load.d
|
| 335 | 335 |
%endif |
| 336 |
+ |
|
| 337 |
+install -m 0644 -D -t %{buildroot}%{_rpmmacrodir}/ %{SOURCE11}
|
|
| 338 |
+install -m 0644 -D -t %{buildroot}%{_rpmconfigdir}/fileattrs/ %{SOURCE12}
|
|
| 339 |
+install -m 0755 -D -t %{buildroot}%{_rpmconfigdir}/ %{SOURCE13}
|
|
| 340 |
+install -m 0755 -D -t %{buildroot}%{_rpmconfigdir}/ %{SOURCE14}
|
|
| 341 |
+ |
|
| 336 | 342 |
%find_lang %{name} ../%{name}.lang
|
| 337 | 343 |
|
| 338 | 344 |
%post |
| 339 | 345 |
%{name}-machine-id-setup &>/dev/null || :
|
| 340 | 346 |
|
| 341 | 347 |
systemctl daemon-reexec &>/dev/null || {
|
| 342 |
- if [ $1 -gt 1 ] && [ -d /run/%{name}/system ] ; then
|
|
| 343 |
- kill -TERM 1 &>/dev/null || : |
|
| 344 |
- fi |
|
| 348 |
+ if [ $1 -gt 1 ] && [ -d /run/%{name}/system ] ; then
|
|
| 349 |
+ kill -TERM 1 &>/dev/null || : |
|
| 350 |
+ fi |
|
| 345 | 351 |
} |
| 346 | 352 |
|
| 347 | 353 |
journalctl --update-catalog &>/dev/null || : |
| 354 |
+systemd-sysusers || : |
|
| 348 | 355 |
%{name}-tmpfiles --create &>/dev/null || :
|
| 349 | 356 |
|
| 350 | 357 |
if [ $1 -eq 1 ] ; then |
| 351 |
- systemctl preset-all &>/dev/null || : |
|
| 352 |
- systemctl --global preset-all &>/dev/null || : |
|
| 358 |
+ systemctl preset-all &>/dev/null || : |
|
| 359 |
+ systemctl --global preset-all &>/dev/null || : |
|
| 353 | 360 |
fi |
| 354 | 361 |
|
| 355 | 362 |
%clean |
| 356 | 363 |
rm -rf %{buildroot}/*
|
| 357 | 364 |
|
| 358 |
-%global udev_services %{name}-udevd.service %{name}-udev-settle.service %{name}-udev-trigger.service %{name}-udevd-control.socket %{name}-udevd-kernel.socket %{name}-timesyncd.service
|
|
| 359 |
- |
|
| 360 | 365 |
%post udev |
| 361 | 366 |
udevadm hwdb --update &>/dev/null || : |
| 362 | 367 |
if [ $1 -eq 1 ] || [ $1 -eq 2 ]; then |
| ... | ... |
@@ -371,9 +386,6 @@ fi |
| 371 | 371 |
%postun udev |
| 372 | 372 |
%systemd_postun_with_restart %{name}-udevd.service
|
| 373 | 373 |
|
| 374 |
-%postun tests |
|
| 375 |
-rm -rf %{_libdir}/%{name}/tests
|
|
| 376 |
- |
|
| 377 | 374 |
%files |
| 378 | 375 |
%defattr(-,root,root) |
| 379 | 376 |
%dir %{_sysconfdir}/%{name}
|
| ... | ... |
@@ -399,6 +411,7 @@ rm -rf %{_libdir}/%{name}/tests
|
| 399 | 399 |
%config(noreplace) %{_sysconfdir}/%{name}/timesyncd.conf
|
| 400 | 400 |
%config(noreplace) %{_sysconfdir}/%{name}/networkd.conf
|
| 401 | 401 |
%config(noreplace) %{_sysconfdir}/%{name}/pstore.conf
|
| 402 |
+%config(noreplace) %{_sysusersdir}/*.conf
|
|
| 402 | 403 |
|
| 403 | 404 |
%ifarch x86_64 |
| 404 | 405 |
%config(noreplace) %{_sysconfdir}/modules-load.d/10-rdrand-rng.conf
|
| ... | ... |
@@ -426,6 +439,7 @@ rm -rf %{_libdir}/%{name}/tests
|
| 426 | 426 |
%{_bindir}/portablectl
|
| 427 | 427 |
%{_bindir}/resolvectl
|
| 428 | 428 |
%{_bindir}/systemctl
|
| 429 |
+%{_bindir}/%{name}-sysusers
|
|
| 429 | 430 |
%{_bindir}/%{name}-analyze
|
| 430 | 431 |
%{_bindir}/%{name}-ask-password
|
| 431 | 432 |
%{_bindir}/%{name}-cat
|
| ... | ... |
@@ -474,10 +488,21 @@ rm -rf %{_libdir}/%{name}/tests
|
| 474 | 474 |
%{_environmentdir}/99-environment.conf
|
| 475 | 475 |
%exclude %{_datadir}/locale
|
| 476 | 476 |
%{_libdir}/binfmt.d
|
| 477 |
-%{_libdir}/rpm
|
|
| 478 |
-%{_libdir}/sysctl.d
|
|
| 479 |
-%{_libdir}/%{name}
|
|
| 480 |
- |
|
| 477 |
+%{_libdir}/rpm/*
|
|
| 478 |
+%{_libdir}/sysctl.d/*
|
|
| 479 |
+%{_systemd_util_dir}/boot/*
|
|
| 480 |
+%{_systemd_util_dir}/catalog/*
|
|
| 481 |
+%{_systemd_util_dir}/*.so
|
|
| 482 |
+%{_systemd_util_dir}/network/*
|
|
| 483 |
+%{_systemd_util_dir}/ntp-units.d/*
|
|
| 484 |
+%{_systemd_util_dir}/portable/*
|
|
| 485 |
+%{_systemd_util_dir}/resolv.conf
|
|
| 486 |
+%{_systemd_util_dir}/%{name}*
|
|
| 487 |
+%{_systemd_util_dir}/user*
|
|
| 488 |
+%{_systemd_util_dir}/import-pubring.gpg
|
|
| 489 |
+%{_unitdir}/*
|
|
| 490 |
+%{_presetdir}/*
|
|
| 491 |
+%{_systemdgeneratordir}/*
|
|
| 481 | 492 |
%{_datadir}/bash-completion/*
|
| 482 | 493 |
%{_datadir}/factory/*
|
| 483 | 494 |
%{_datadir}/dbus-1
|
| ... | ... |
@@ -485,24 +510,24 @@ rm -rf %{_libdir}/%{name}/tests
|
| 485 | 485 |
%{_datadir}/polkit-1
|
| 486 | 486 |
%{_datadir}/%{name}
|
| 487 | 487 |
%{_datadir}/zsh/*
|
| 488 |
-%{_localstatedir}/log/journal
|
|
| 489 |
- |
|
| 490 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system/basic.target.wants
|
|
| 491 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system/bluetooth.target.wants
|
|
| 492 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system/default.target.wants
|
|
| 493 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system/getty.target.wants
|
|
| 494 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system/graphical.target.wants
|
|
| 495 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system/local-fs.target.wants
|
|
| 496 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system/machines.target.wants
|
|
| 497 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system/multi-user.target.wants
|
|
| 498 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system/network-online.target.wants
|
|
| 499 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system/printer.target.wants
|
|
| 500 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system/remote-fs.target.wants
|
|
| 501 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system/sockets.target.wants
|
|
| 502 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system/sysinit.target.wants
|
|
| 503 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system/system-update.target.wants
|
|
| 504 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system/timers.target.wants
|
|
| 505 |
-%ghost %dir %attr(0755,-,-) /etc/%{name}/system
|
|
| 488 |
+%{_var}/log/journal
|
|
| 489 |
+ |
|
| 490 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system/basic.target.wants
|
|
| 491 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system/bluetooth.target.wants
|
|
| 492 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system/default.target.wants
|
|
| 493 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system/getty.target.wants
|
|
| 494 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system/graphical.target.wants
|
|
| 495 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system/local-fs.target.wants
|
|
| 496 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system/machines.target.wants
|
|
| 497 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system/multi-user.target.wants
|
|
| 498 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system/network-online.target.wants
|
|
| 499 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system/printer.target.wants
|
|
| 500 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system/remote-fs.target.wants
|
|
| 501 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system/sockets.target.wants
|
|
| 502 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system/sysinit.target.wants
|
|
| 503 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system/system-update.target.wants
|
|
| 504 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system/timers.target.wants
|
|
| 505 |
+%ghost %dir %attr(0755,-,-) %{_sysconfdir}/%{name}/system
|
|
| 506 | 506 |
|
| 507 | 507 |
%files devel |
| 508 | 508 |
%defattr(-,root,root) |
| ... | ... |
@@ -670,7 +695,7 @@ rm -rf %{_libdir}/%{name}/tests
|
| 670 | 670 |
|
| 671 | 671 |
%files rpm-macros |
| 672 | 672 |
%defattr(-,root,root) |
| 673 |
-%{_libdir}/rpm/macros.d
|
|
| 673 |
+%{_rpmmacrodir}/*
|
|
| 674 | 674 |
|
| 675 | 675 |
%files tests |
| 676 | 676 |
%defattr(-,root,root) |
| ... | ... |
@@ -679,6 +704,10 @@ rm -rf %{_libdir}/%{name}/tests
|
| 679 | 679 |
%files lang -f ../%{name}.lang
|
| 680 | 680 |
|
| 681 | 681 |
%changelog |
| 682 |
+* Fri Feb 03 2023 Shreenidhi Shedi <sshedi@vmware.com> 252.4-8 |
|
| 683 |
+- Enable sysusers |
|
| 684 |
+- Add a patch to use bBFQ scheduler |
|
| 685 |
+- Remove test file packaging with main package |
|
| 682 | 686 |
* Tue Jan 17 2023 Ashwin Dayanand Kamat <kashwindayan@vmware.com> 252.4-7 |
| 683 | 687 |
- Support OOMPolicy in scope units |
| 684 | 688 |
* Sat Jan 14 2023 Ashwin Dayanand Kamat <kashwindayan@vmware.com> 252.4-6 |
| 0 | 2 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,96 @@ |
| 0 |
+#!/bin/bash |
|
| 1 |
+# -*- mode: shell-script; indent-tabs-mode: true; tab-width: 4; -*- |
|
| 2 |
+ |
|
| 3 |
+# This script turns sysuser.d files into scriptlets mandated by Fedora |
|
| 4 |
+# packaging guidelines. The general idea is to define users using the |
|
| 5 |
+# declarative syntax but to turn this into traditional scriptlets. |
|
| 6 |
+ |
|
| 7 |
+user() {
|
|
| 8 |
+ local user="$1" |
|
| 9 |
+ local uid="$2" |
|
| 10 |
+ local desc="$3" |
|
| 11 |
+ local group="$4" |
|
| 12 |
+ local home="$5" |
|
| 13 |
+ local shell="$6" |
|
| 14 |
+ |
|
| 15 |
+ [ "$desc" = '-' ] && desc= |
|
| 16 |
+ { [ "$home" = '-' ] || [ "$home" = '' ]; } && home=/
|
|
| 17 |
+ { [ "$shell" = '-' ] || [ "$shell" = '' ]; } && shell=/usr/sbin/nologin
|
|
| 18 |
+ |
|
| 19 |
+ if [ "$uid" = '-' ] || [ "$uid" = '' ]; then |
|
| 20 |
+ cat <<EOF |
|
| 21 |
+getent passwd '$user' >/dev/null || \\ |
|
| 22 |
+ useradd -r -g '$group' -d '$home' -s '$shell' -c '$desc' '$user' || : |
|
| 23 |
+EOF |
|
| 24 |
+ else |
|
| 25 |
+ cat <<EOF |
|
| 26 |
+if ! getent passwd '$user' >/dev/null; then |
|
| 27 |
+ if ! getent passwd '$uid' >/dev/null; then |
|
| 28 |
+ useradd -r -u '$uid' -g '$group' -d '$home' -s '$shell' -c '$desc' '$user' || : |
|
| 29 |
+ else |
|
| 30 |
+ useradd -r -g '$group' -d '$home' -s '$shell' -c '$desc' '$user' || : |
|
| 31 |
+ fi |
|
| 32 |
+fi |
|
| 33 |
+EOF |
|
| 34 |
+ fi |
|
| 35 |
+} |
|
| 36 |
+ |
|
| 37 |
+group() {
|
|
| 38 |
+ local group="$1" |
|
| 39 |
+ local gid="$2" |
|
| 40 |
+ |
|
| 41 |
+ if [ "$gid" = '-' ]; then |
|
| 42 |
+ cat <<EOF |
|
| 43 |
+getent group '$group' >/dev/null || groupadd -r '$group' || : |
|
| 44 |
+EOF |
|
| 45 |
+ else |
|
| 46 |
+ cat <<EOF |
|
| 47 |
+getent group '$group' >/dev/null || groupadd -f -g '$gid' -r '$group' || : |
|
| 48 |
+EOF |
|
| 49 |
+ fi |
|
| 50 |
+} |
|
| 51 |
+ |
|
| 52 |
+usermod() {
|
|
| 53 |
+ local user="$1" |
|
| 54 |
+ local group="$2" |
|
| 55 |
+ |
|
| 56 |
+ cat <<EOF |
|
| 57 |
+if getent group '$group' >/dev/null; then |
|
| 58 |
+ usermod -a -G '$group' '$user' || : |
|
| 59 |
+fi |
|
| 60 |
+EOF |
|
| 61 |
+} |
|
| 62 |
+ |
|
| 63 |
+parse() {
|
|
| 64 |
+ local line="" |
|
| 65 |
+ while read -r line || [ -n "$line" ] ; do |
|
| 66 |
+ { [ "${line:0:1}" = '#' ] || [ "${line:0:1}" = ';' ]; } && continue
|
|
| 67 |
+ line="${line## *}"
|
|
| 68 |
+ [ -z "$line" ] && continue |
|
| 69 |
+ eval "arr=( $line )" |
|
| 70 |
+ case "${arr[0]}" in
|
|
| 71 |
+ ('u')
|
|
| 72 |
+ if [[ "${arr[2]}" == *":"* ]]; then
|
|
| 73 |
+ user "${arr[1]}" "${arr[2]%:*}" "${arr[3]}" "${arr[2]#*:}" "${arr[4]}" "${arr[5]}"
|
|
| 74 |
+ else |
|
| 75 |
+ group "${arr[1]}" "${arr[2]}"
|
|
| 76 |
+ user "${arr[1]}" "${arr[2]}" "${arr[3]}" "${arr[1]}" "${arr[4]}" "${arr[5]}"
|
|
| 77 |
+ fi |
|
| 78 |
+ ;; |
|
| 79 |
+ ('g')
|
|
| 80 |
+ group "${arr[1]}" "${arr[2]}"
|
|
| 81 |
+ ;; |
|
| 82 |
+ ('m')
|
|
| 83 |
+ group "${arr[2]}" "-"
|
|
| 84 |
+ user "${arr[1]}" "-" "" "${arr[1]}" "" ""
|
|
| 85 |
+ usermod "${arr[1]}" "${arr[2]}"
|
|
| 86 |
+ ;; |
|
| 87 |
+ esac |
|
| 88 |
+ done |
|
| 89 |
+} |
|
| 90 |
+ |
|
| 91 |
+for fn in "$@"; do |
|
| 92 |
+ [ -e "$fn" ] || continue |
|
| 93 |
+ echo "# generated from $(basename "$fn")" |
|
| 94 |
+ parse <"$fn" |
|
| 95 |
+done |
| 0 | 96 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,62 @@ |
| 0 |
+#!/bin/bash |
|
| 1 |
+ |
|
| 2 |
+process_u() {
|
|
| 3 |
+ if [ ! -z "${2##*[!0-9]*}" ]; then
|
|
| 4 |
+ # Single shared static ID. |
|
| 5 |
+ echo "user($1) = $2" |
|
| 6 |
+ echo "group($1) = $2" |
|
| 7 |
+ elif [[ $2 == *:* ]]; then |
|
| 8 |
+ # UID:<group>. |
|
| 9 |
+ uid=$(echo $2 | cut -d':' -f1 -) |
|
| 10 |
+ group=$(echo $2 | cut -d':' -f2 -) |
|
| 11 |
+ if [ ! -z "${group##*[!0-9]*}" ]; then
|
|
| 12 |
+ # UID:GID. |
|
| 13 |
+ echo "user($1) = ${uid}"
|
|
| 14 |
+ echo "group($1) = ${group}"
|
|
| 15 |
+ else |
|
| 16 |
+ # UID:<groupname>. |
|
| 17 |
+ echo "user($1) = ${uid}"
|
|
| 18 |
+ echo "group(${group})"
|
|
| 19 |
+ fi |
|
| 20 |
+ else |
|
| 21 |
+ # Dynamic (or something else uninteresting). |
|
| 22 |
+ echo "user($1)" |
|
| 23 |
+ echo "group($1)" |
|
| 24 |
+ fi |
|
| 25 |
+} |
|
| 26 |
+ |
|
| 27 |
+process_g() {
|
|
| 28 |
+ if [ ! -z "${2##*[!0-9]*}" ]; then
|
|
| 29 |
+ # Static GID. |
|
| 30 |
+ echo "group($1) = $2" |
|
| 31 |
+ else |
|
| 32 |
+ # Dynamic (or something else uninteresting). |
|
| 33 |
+ echo "group($1)" |
|
| 34 |
+ fi |
|
| 35 |
+} |
|
| 36 |
+ |
|
| 37 |
+parse() {
|
|
| 38 |
+ local line="" |
|
| 39 |
+ while read line; do |
|
| 40 |
+ [ "${line:0:1}" = '#' -o "${line:0:1}" = ';' ] && continue
|
|
| 41 |
+ line="${line## *}"
|
|
| 42 |
+ [ -z "$line" ] && continue |
|
| 43 |
+ set -- $line |
|
| 44 |
+ case "$1" in |
|
| 45 |
+ ('u')
|
|
| 46 |
+ process_u "$2" "$3" |
|
| 47 |
+ ;; |
|
| 48 |
+ ('g')
|
|
| 49 |
+ process_g "$2" "$3" |
|
| 50 |
+ ;; |
|
| 51 |
+ ('m')
|
|
| 52 |
+ echo "user($2)" |
|
| 53 |
+ echo "group($3)" |
|
| 54 |
+ ;; |
|
| 55 |
+ esac |
|
| 56 |
+ done |
|
| 57 |
+} |
|
| 58 |
+ |
|
| 59 |
+while read fn; do |
|
| 60 |
+ parse < "$fn" |
|
| 61 |
+done |
| 0 | 62 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,43 @@ |
| 0 |
+From 1990fb757f6d275d807fcb48ad09f5fc7c947bc6 Mon Sep 17 00:00:00 2001 |
|
| 1 |
+From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> |
|
| 2 |
+Date: Wed, 14 Aug 2019 15:57:42 +0200 |
|
| 3 |
+Subject: [PATCH] udev: use bfq as the default scheduler |
|
| 4 |
+ |
|
| 5 |
+As requested in https://bugzilla.redhat.com/show_bug.cgi?id=1738828. |
|
| 6 |
+Test results are that bfq seems to behave better and more consistently on |
|
| 7 |
+typical hardware. The kernel does not have a configuration option to set |
|
| 8 |
+the default scheduler, and it currently needs to be set by userspace. |
|
| 9 |
+ |
|
| 10 |
+See the bug for more discussion and links. |
|
| 11 |
+--- |
|
| 12 |
+ rules.d/60-block-scheduler.rules | 5 +++++ |
|
| 13 |
+ rules.d/meson.build | 1 + |
|
| 14 |
+ 2 files changed, 6 insertions(+) |
|
| 15 |
+ create mode 100644 rules.d/60-block-scheduler.rules |
|
| 16 |
+ |
|
| 17 |
+diff --git a/rules.d/60-block-scheduler.rules b/rules.d/60-block-scheduler.rules |
|
| 18 |
+new file mode 100644 |
|
| 19 |
+index 0000000000..850b64540e |
|
| 20 |
+--- /dev/null |
|
| 21 |
+@@ -0,0 +1,5 @@ |
|
| 22 |
++# do not edit this file, it will be overwritten on update |
|
| 23 |
++ |
|
| 24 |
++ACTION=="add", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", \
|
|
| 25 |
++ KERNEL=="mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|sd*[!0-9]|sr*", \ |
|
| 26 |
++ ATTR{queue/scheduler}="bfq"
|
|
| 27 |
+diff --git a/rules.d/meson.build b/rules.d/meson.build |
|
| 28 |
+index 8d2878a36d..a3b395c9ce 100644 |
|
| 29 |
+--- a/rules.d/meson.build |
|
| 30 |
+@@ -8,6 +8,7 @@ rules = [ |
|
| 31 |
+ [files('60-autosuspend.rules',
|
|
| 32 |
+ '60-block.rules', |
|
| 33 |
+ '60-cdrom_id.rules', |
|
| 34 |
++ '60-block-scheduler.rules', |
|
| 35 |
+ '60-drm.rules', |
|
| 36 |
+ '60-evdev.rules', |
|
| 37 |
+ '60-fido-id.rules', |
|
| 38 |
+-- |
|
| 39 |
+2.37.2 |
|
| 40 |
+ |