Compare commits

...

No commits in common. "c8" and "c9s" have entirely different histories.
c8 ... c9s

12 changed files with 871 additions and 56 deletions

59
.gitignore vendored
View File

@ -1 +1,58 @@
SOURCES/initscripts-10.00.18.tar.gz /initscripts-9.43.tar.bz2
/initscripts-9.44.tar.bz2
/initscripts-9.45.tar.bz2
/initscripts-9.46.tar.bz2
/initscripts-9.47.tar.bz2
/initscripts-9.48.tar.bz2
/initscripts-9.50.tar.bz2
/initscripts-9.51.tar.bz2
/initscripts-9.52.tar.bz2
/initscripts-9.53.tar.bz2
/initscripts-9.54.tar.bz2
/initscripts-9.55.tar.bz2
/initscripts-9.56.1.tar.bz2
/initscripts-9.58.tar.bz2
/initscripts-9.59.tar.bz2
/initscripts-9.60.tar.bz2
/initscripts-9.61.tar.bz2
/initscripts-9.62.tar.bz2
/initscripts-9.63.tar.bz2
/initscripts-9.64.tar.bz2
/initscripts-9.65.tar.bz2
/initscripts-9.66.tar.bz2
/initscripts-9.67.tar.bz2
/initscripts-9.68.tar.bz2
/initscripts-9.69.tar.bz2
/initscripts-9.70.tar.gz
/initscripts-9.71.tar.gz
/initscripts-9.72.tar.gz
/initscripts-9.74.tar.gz
/initscripts-9.75.tar.gz
/initscripts-9.76.tar.gz
/initscripts-9.77.tar.gz
/initscripts-9.78.tar.gz
/initscripts-9.79.tar.gz
/initscripts-9.80.tar.gz
/initscripts-9.81.tar.gz
/initscripts-9.82.tar.gz
/initscripts-9.83.tar.gz
/initscripts-10.00.tar.gz
/initscripts-10.01.tar.gz
/initscripts-10.02.tar.gz
/initscripts-10.03.tar.gz
/initscripts-10.04.tar.gz
/initscripts-10.05.tar.gz
/initscripts-10.06.tar.gz
/initscripts-10.07.tar.gz
/initscripts-10.08.tar.gz
/initscripts-10.09.tar.gz
/initscripts-10.10.tar.gz
/initscripts-10.11.tar.gz
/initscripts-10.11.1.tar.gz
/initscripts-10.11.2.tar.gz
/initscripts-10.11.3.tar.gz
/initscripts-10.11.4.tar.gz
/initscripts-10.11.5.tar.gz
/initscripts-10.11.6.tar.gz
/initscripts-10.11.7.tar.gz
/initscripts-10.11.8.tar.gz

View File

@ -1 +0,0 @@
07869d0e85730c355471ff37c311663369864d56 SOURCES/initscripts-10.00.18.tar.gz

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# Additional information
Check upstream's [README.md](https://github.com/fedora-sysv/initscripts/blob/master/README.md) for more info.

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

View File

@ -18,8 +18,8 @@ Requires: gawk \
Name: initscripts Name: initscripts
Summary: Basic support for legacy System V init scripts Summary: Basic support for legacy System V init scripts
Version: 10.00.18 Version: 10.11.8
Release: 1%{?dist} Release: 4%{?dist}
License: GPLv2 License: GPLv2
@ -34,6 +34,9 @@ Requires: procps-ng
Requires: setup Requires: setup
Requires: systemd Requires: systemd
Requires: util-linux Requires: util-linux
Requires: chkconfig
Requires: initscripts-service
Requires: initscripts-rename-device
Requires(pre): shadow-utils Requires(pre): shadow-utils
Requires(post): coreutils Requires(post): coreutils
@ -46,14 +49,12 @@ BuildRequires: glib2-devel
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: popt-devel BuildRequires: popt-devel
BuildRequires: setup BuildRequires: setup
BuildRequires: python3-devel BuildRequires: make
%{?systemd_requires} %{?systemd_requires}
BuildRequires: systemd BuildRequires: systemd
Provides: /sbin/service Obsoletes: %{name} < 10.11.3-1
Obsoletes: %{name} < 9.82-2
# === PATCHES ================================================================= # === PATCHES =================================================================
@ -89,6 +90,31 @@ other legacy tools & utilities.
# === SUBPACKAGES ============================================================= # === SUBPACKAGES =============================================================
%package -n initscripts-rename-device
Summary: Udev helper utility that provides network interface naming
%shared_requirements
%description -n initscripts-rename-device
Udev helper utility that provides network interface naming
# ---------------
%package -n initscripts-service
Summary: Support for service command
BuildArch: noarch
%shared_requirements
Requires: systemd
Provides: /sbin/service
%description -n initscripts-service
This package provides service command.
# ---------------
%package -n network-scripts %package -n network-scripts
Summary: Legacy scripts for manipulating of network devices Summary: Legacy scripts for manipulating of network devices
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
@ -115,6 +141,12 @@ Requires(postun): %{_sbindir}/update-alternatives
Obsoletes: %{name} < 9.82-2 Obsoletes: %{name} < 9.82-2
# This is legacy and deprecated, so nobody should depend on this!
# If ifcfg-style configuration is still desired, NetworkManager can do this.
# Thus, mark this as deprecated to ensure people know to not depend on it.
# Cf. https://docs.fedoraproject.org/en-US/packaging-guidelines/deprecating-packages/
Provides: deprecated()
%description -n network-scripts %description -n network-scripts
This package contains the legacy scripts for activating & deactivating of most This package contains the legacy scripts for activating & deactivating of most
network interfaces. It also provides a legacy version of 'network' service. network interfaces. It also provides a legacy version of 'network' service.
@ -176,6 +208,9 @@ Obsoletes: %{name} < 9.82-2
This package provides script & configuration file for setting up read-only root This package provides script & configuration file for setting up read-only root
support. Additional configuration is required after installation. support. Additional configuration is required after installation.
Please note that readonly-root package is considered deprecated with limited support.
Please use systemd-volatile-root functionality instead, if possible.
# === BUILD INSTRUCTIONS ====================================================== # === BUILD INSTRUCTIONS ======================================================
%prep %prep
@ -282,26 +317,42 @@ fi
# RC symlinks: # RC symlinks:
%{_sysconfdir}/rc[0-6].d %{_sysconfdir}/rc[0-6].d
%{_sysconfdir}/init.d
# --------------- # ---------------
%{_bindir}/* %{_bindir}/*
%{_sbindir}/consoletype %{_sbindir}/consoletype
%{_sbindir}/genhostid %{_sbindir}/genhostid
%{_sbindir}/service
%{_libexecdir}/import-state %{_libexecdir}/import-state
%{_libexecdir}/loadmodules %{_libexecdir}/loadmodules
%{_prefix}/lib/systemd/system/import-state.service %{_prefix}/lib/systemd/system/import-state.service
%{_prefix}/lib/systemd/system/loadmodules.service %{_prefix}/lib/systemd/system/loadmodules.service
%{_mandir}/man1/*
# =============================================================================
%files -n initscripts-rename-device
%{_prefix}/lib/udev/rename_device %{_prefix}/lib/udev/rename_device
%{_udevrulesdir}/* %{_udevrulesdir}/*
%{_mandir}/man1/* # ---------------
%files -n initscripts-service
%dir %{_libexecdir}/%{name}
%dir %{_libexecdir}/%{name}/legacy-actions
%{_sbindir}/service
%{_mandir}/man8/service.* %{_mandir}/man8/service.*
# ============================================================================= # ---------------
%files -n network-scripts %files -n network-scripts
%doc doc/examples/ %doc doc/examples/
@ -346,84 +397,156 @@ fi
# ============================================================================= # =============================================================================
%changelog %changelog
* Wed Aug 10 2022 Jan Macku <jamacku@redhat.com> - 10.00.18-1 * Mon Sep 02 2024 Jan Macku <jamacku@redhat.com> - 10.11.8-4
- ci: Update `.packit.yml` to run on `c8s` - version bump
* Thu Aug 29 2024 Jan Macku <jamacku@redhat.com> - 10.11.8-3
- version bump
* Tue Aug 27 2024 Jan Macku <jamacku@redhat.com> - 10.11.8-2
- version bump
* Tue Aug 27 2024 Jan Macku <jamacku@redhat.com> - 10.11.8-1
- netconsole: var/lock -> run/lock
- netconsole: source sysconfig/network only if it exists
- netconsole: remove unused variables
- netconsole: remove trailing whitespaces
- sync spec with c9s
* Wed Mar 06 2024 Jan Macku <jamacku@redhat.com> - 10.11.7-1
- rename_device: free path after it is used
- rename_device: remove trailing whitespaces
* Thu Feb 08 2024 Jan Macku <jamacku@redhat.com> - 10.11.6-1
- Add -r to while read as per shellcheck
- Fix splitting spaces in paths from statetab files
* Wed Aug 24 2022 Jan Macku <jamacku@redhat.com> - 10.11.5-1
- service: Exit when `/etc/init.d` is missing
* Thu Feb 24 2022 Jan Macku <jamacku@redhat.com> - 10.11.4-1
- spec: Update initscripts Obsoletes
* Thu Feb 24 2022 Jan Macku <jamacku@redhat.com> - 10.11.3-1
- Drop unnecessary obsoletes
- spec: Move rename_device to subpackage `initscripts-rename-device`
- ci: Update `.packit.yml` to run on `c9s`
- ci: Use Differential ShellCheck action - ci: Use Differential ShellCheck action
* Mon Jan 24 2022 Jan Macku <jamacku@redhat.com> - 10.00.17-1 * Wed Jan 26 2022 Jan Macku <jamacku@redhat.com> - 10.11.2-1
- ifup-routes: Revert quotes - ifup-routes: Revert quotes
- ifup-routes: Use `ip replace` only on type `route` - ifup-routes: Use `ip replace` only on type `route`
- ci: introduce GA ci from master to rhel8-branch
- ci: Setup packit for RHEL8 branch
- ci: Get rid of old ci files (travis and zanata)
* Fri Jan 14 2022 Jan Macku <jamacku@redhat.com> - 10.00.16-1
- rename_device: also support dracut-style kernel cmdline configuration
- ifup-routes: Log when using `ip $type replace` - ifup-routes: Log when using `ip $type replace`
- ifup-routes: Use `ip route repace` to avoid race - ifup-routes: Use `ip route repace` to avoid race
- ci: Update path to csdiff repository (#391)
* Mon Feb 15 2021 Jan Macku <jamacku@redhat.com> - 10.00.15-1 * Wed Sep 01 2021 Jan Macku <jamacku@redhat.com> - 10.11.1-1
- spec: Update relation between initscripts and initscripts-service
- spec: Replace not working awk command with sed
- use downstream version style
* Fri Aug 27 2021 Jan Macku <jamacku@redhat.com> - 10.11-1
- specfile: Update obsoletes to allow upgrades (#385)
* Thu Aug 26 2021 Jan Macku <jamacku@redhat.com> - 10.10-1
- Translated using Weblate (Friulian) (#381)
- Translations update from Weblate (#378)
- added veth support
- ifup-eth: add a new PERSISTENT_DHCLIENT_IPV6 option for IPv6 dhclient daemon
- ifdown removes veth pair if both peers are down
- rename_device: also support dracut-style kernel cmdline configuration
- spec: Mark network-scripts as deprecated
- spec: Initscripts now requires chkconfig (#374)
- Translations update from Weblate (#371)
- spec: Move service script into subpackage
- ci: Onboard initscripts to Packit
- ci: Migrate from Travis to GH Actions
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 10.09-3
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 10.09-2
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Mon Feb 15 2021 Jan Macku <jamacku@redhat.com> - 10.09-1
- doc: Document ARPING_WAIT and ARPING_UPDATE_WAIT - doc: Document ARPING_WAIT and ARPING_UPDATE_WAIT
- network scripts: Avoid infinite loop of arping - network scripts: Avoid infinite loop of arping
* Thu Feb 4 2021 Jan Macku <jamacku@redhat.com> - 10.00.14-1 * Thu Feb 4 2021 Jan Macku <jamacku@redhat.com> - 10.08-1
- network: fix condition in set_link_up() - network: fix condition in set_link_up()
- spec: sync with Fedora
* Fri Jan 22 2021 Jan Macku <jamacku@redhat.com> - 10.00.13-1 * Fri Jan 22 2021 Jan Macku <jamacku@redhat.com> - 10.07-1
- doc: Fix "Duplicated string found in the file."
- doc: Documents RES_OPTIONS option
- doc: Documents ifcfg option LINKSTATUS - doc: Documents ifcfg option LINKSTATUS
- ci: use up to date keywords and fix some warnings
* Thu Dec 17 2020 Jan Macku <jamacku@redhat.com> - 10.00.12-1
- network: fix set_link_up() - network: fix set_link_up()
* Tue Dec 15 2020 Jan Macku <jamacku@redhat.com> - 10.00.11-1
- network: add option to keep the link down - network: add option to keep the link down
- Rework of shell ci
- Translations update from Weblate
* Fri Nov 13 2020 Jan Macku <jamacku@redhat.com> - 10.06-1
- service: catch unsupported action keywords
- makefile: Use rpmdev-bumpspec's legacy date option - makefile: Use rpmdev-bumpspec's legacy date option
* Fri Nov 06 2020 Jan Macku <jamacku@redhat.com> - 10.00.10-1 * Fri Nov 06 2020 Jan Macku <jamacku@redhat.com> - 10.05-1
- Allow updating rfkill switch status while in readonly root mode
- service: Prevent variables from globbing - service: Prevent variables from globbing
- init.d/functions: Make usage msgs more clear
- network-scripts: Use net_log() instead of logger
- Allow updating rfkill switch status while in readonly root mode
- Add info into specfile about readonly-root deprecation
- Allow updating mlocate.db while in readonly root mode - Allow updating mlocate.db while in readonly root mode
- rc.d/functions: replace grep's --quiet with -q
* Fri Jul 24 2020 Jan Macku <jamacku@redhat.com> - 10.00.9-1 - Add warning to warn user when ETHTOOL_OPTS is set and ethtool binary is missing - Olav Vitters
- Fix spacing in Makefile
- Add optional 'dev' keyword - Add optional 'dev' keyword
* Tue Jun 16 2020 Jan Macku <jamacku@redhat.com> - 10.00.8-1 * Tue Jul 14 2020 Jan Macku <jamacku@redhat.com> - 10.04-1
- Maintain permisision to set umask
- rwtab: Add support for chrony - rwtab: Add support for chrony
- ifup-eth: Switch to bc utility, which supports floating point computations. - Correct spelling, IP,
- Replace grep -EL with subshell since -L changed behaviour - Fix spelling, for more info
- Fix spelling of SELinux
- Translations update from Weblate
* Wed Apr 15 2020 Jan Macku <jamacku@redhat.com> - 10.00.7-1 * Tue Mar 24 2020 Jan Macku <jamacku@redhat.com> - 10.03-1
- Replace grep -EL with subshell since -L changed behaviour
- Wait for scope link addresses as well as for scope global addresses - Wait for scope link addresses as well as for scope global addresses
- Remove deprecated option -m of pidof - Remove deprecated option -m of pidof
- Use function is_true for testing true conditions
* Tue Dec 10 2019 Jan Macku <jamacku@redhat.com> - 10.00.6-1 - Adding new travis job for testing shell-scripts
- Remove zanata conf
- pull latest translations
- Update of translations and remove files with no translations
- Fix service network stop cmd - Fix service network stop cmd
- Fix missing python3 during build phase - Change spacing of service file to folow spacing of project
* Wed Oct 30 2019 Jan Macku <jamacku@redhat.com> - 10.00.5-1
- network-function: bridges are created by ifup-eth - network-function: bridges are created by ifup-eth
- network: don't fail with IFDOWN_ON_SHUTDOWN
- Add ip6gre tunnel option
- ifup-eth: Check that device name is set
- Initscripts no longer care about rc.local - Initscripts no longer care about rc.local
- Repalace hardcoded tests for yes and no with testing functions
* Fri Aug 23 2019 Lukas Nykryn <lnykryn@redhat.com> - 10.00.4-1
- ifup-eth: Fix bridge setting stp option - ifup-eth: Fix bridge setting stp option
- Fix bug in service(8)
* Wed Aug 07 2019 Jan Macku <jamacku@redhat.com> - 10.00.3-1 - ifup-eth: Check that device name is set
- Fix missing python3 during build phase
- rc.d/functions: fix escape sequence being output under systemd service units - rc.d/functions: fix escape sequence being output under systemd service units
- Replace not working awk command with sed - Add ip6gre tunnel option
- ifup/ifdown: print DEPRECATION_WARNING_ISSUED waring info after source_config
* Thu Jun 06 2019 Jan Macku <jamacku@redhat.com> - 10.00.2-1 * Fri Jun 28 2019 Jan Macku <jamacku@redhat.com> - 10.02-1
- network: don't fail with IFDOWN_ON_SHUTDOWN
- rc.d/functions: remove support cgroups
- Create symlink (/etc/init.d) to /etc/rc.d/init.d
- Add option to wait until target is reachable
- ifup-eth: apply PERSISTENT_DHCLIENT to IPv6 dhclient daemon
- ifup-post: fix incorrect condition for RESOLV_MODS - ifup-post: fix incorrect condition for RESOLV_MODS
- make tag: updated message
- make release-commit: do not create tag automatically
* Fri Aug 03 2018 David Kaspar [Dee'Kej] <dkaspar@redhat.com> - 10.00.1-1 * Mon Aug 06 2018 David Kaspar [Dee'Kej] <dkaspar@redhat.com> - 10.01-1
- consoletype/genhostid/usleep: allow disabling of deprecation warnings - network/ifup/ifdown: deprecations warnings redirected to stderr
- network/ifup/ifdown: allow disabling of deprecation warnings - ifup-eth: use 'bc' instead of 'expr' when computing $forward_delay
- network/ifup/ifdown: deprecation warnings for 'network-scripts' added - network/ifup/ifdown: deprecation warnings for 'network-scripts' added
- network: parsing of /proc/mounts returned
* Thu Jun 21 2018 David Kaspar [Dee'Kej] <dkaspar@redhat.com> - 10.00.0-1
- fork for next major RHEL release
* Thu Jun 21 2018 David Kaspar [Dee'Kej] <dkaspar@redhat.com> - 10.00-1 * Thu Jun 21 2018 David Kaspar [Dee'Kej] <dkaspar@redhat.com> - 10.00-1
- Move the /etc/rwtab.d & /etc/statetab.d folders to 'filesystem' - Move the /etc/rwtab.d & /etc/statetab.d folders to 'filesystem'
@ -731,7 +854,7 @@ ng
* Tue Jan 14 2014 Lukáš Nykrýn <lnykryn@redhat.com> 9.51-1 * Tue Jan 14 2014 Lukáš Nykrýn <lnykryn@redhat.com> 9.51-1
- readonly-root: bind-mount only necessary subset of entries in rwtab - readonly-root: bind-mount only necessary subset of entries in rwtab
- readonly-root: Add /var/log/audit/audit.log to rwtab - readonly-root: Add /var/log/audit/audit.log to rwtab
- readonly-root: restore selinux context after bind mount - readonly-root: restore SELinux context after bind mount
- rename_device: remove comments and trailing whitespaces - rename_device: remove comments and trailing whitespaces
- service: suggest using systemctl if unknown action is used - service: suggest using systemctl if unknown action is used
- ifup-eth: fix typo in error message - ifup-eth: fix typo in error message

28
rebase.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
# We always do a rebase to new upstream's tarball for Fedora Rawhide.
#
# For non-Rawhide Fedora releases, we can sometimes backport specific patches,
# if the rebase is not possible.
#
# This scripts automates this process.
# Since we are operating in a dist-git repository where we can't fix things with
# --force-push if something goes wrong, we need to be extra careful and exit
# immediately if something fails.
set -e
curl https://raw.githubusercontent.com/fedora-sysv/initscripts/rhel9-branch/initscripts.spec -o initscripts.spec || exit 1
spectool -g initscripts.spec
# Make a local scratch build in mock first. If it fails, do not upload new tarball!
# srpm_file="$(basename $(centpkg srpm | grep -i "wrote" | cut -d ':' -f 2))"
# arch="$(uname -p)"
# mock -r "fedora-rawhide-${arch}" "${srpm_file}" || exit 2
# Scratch build passed, the build should pass in Koji as well. Let's proceed:
centpkg new-sources "$(basename $(spectool -S -l initscripts.spec | gawk '{print $2;}'))" || exit 3
git add initscripts.spec
git commit -m "$(grep Version initscripts.spec | gawk '{print $2;}')"
git show

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (initscripts-10.11.8.tar.gz) = 3edb45ede13298e56404b22945a60b2c1c5ade899fd91954297f555ea216cdcef5a8554f51d46d5e41317c1920dc6413c7d02068b484b62884870067bbf1913b

View File

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/initscripts/Sanity/init-scripts-LSB
# Description: Init scripts should meet LSB specifications
# Author: Yulia Kopkova <ykopkova@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/initscripts/Sanity/init-scripts-LSB
export TESTVERSION=1.4
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Jan Scotka <jscotka@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Init scripts should meet LSB specifications" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: initscripts" >> $(METADATA)
@echo "Requires: initscripts" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: RedHatEnterpriseLinux6" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/initscripts/Sanity/init-scripts-LSB
Description: Init scripts should meet LSB specifications
Author: Yulia Kopkova <ykopkova@redhat.com>

View File

@ -0,0 +1,228 @@
#!/bin/bash
# vim: dict=/usr/share/rhts-library/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/initscripts/Sanity/init-scripts-LSB
# Description: Init scripts should meet LSB specifications
# Author: Jan Scotka <jscotka@redhat.com>, Yulia Kopkova <ykopkova@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/bin/rhts-environment.sh
. /usr/share/rhts-library/rhtslib.sh
PACKAGE="initscripts"
SRV_NETCONSOLE=netconsole
SRV_NETFS=netfs
TRG_REMOTEFS=remote-fs.target
SRV_NETWORK=network
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "useradd testuserqa" 0 "Add test user"
rlFileBackup /etc/sysconfig/netconsole
if rlIsRHEL '<7'; then #there is no syslog in rhel7 and highier
rlRun "sed -i -e 's,^# SYSLOGADDR=,SYSLOGADDR=redhat.com,' /etc/sysconfig/netconsole" 0 "Set remote syslog server address /etc/sysconfig/netconsole"
fi
rlPhaseEnd
rlPhaseStartTest "netconsole service LSB compliance test"
if ls /lib*/modules/*/kernel/drivers/net/netconsole.ko*; then
rlRun "ls /lib*/modules/*/kernel/drivers/net/netconsole.ko*" 0
if rlIsRHEL '<7'; then
SERVICE=$SRV_NETCONSOLE
rlServiceStop $SERVICE
rlLog ">>>>>>>>> service start"
rlRun "service $SERVICE start" 0 " Service must start without problem "
rlRun "service $SERVICE status" 0 " Then Status command "
rlRun "service $SERVICE start" 0 " Already started service "
rlRun "service $SERVICE status" 0 " Again status command "
rlLog ">>>>>>>>> service restart"
rlRun "service $SERVICE restart" 0 " Restarting of service "
rlRun "service $SERVICE status" 0 " Status command "
rlLog ">>>>>>>>> service stop"
rlRun "service $SERVICE stop" 0 " Stopping service "
rlRun "service $SERVICE status" 3 " Status of stopped service "
rlRun "service $SERVICE stop" 0 " Stopping service again "
rlRun "service $SERVICE status" 3 " Status of stopped service "
rlLog ">>>>>>>>> insufficient rights"
rlRun "service $SERVICE start " 0 " Starting service for restarting under nonpriv user "
rlRun "su testuserqa -c 'service $SERVICE restart'" 1 "Insufficient rights, restarting resrvice under nonprivileged user must fail "
rlLog ">>>>>>>>> operations"
rlServiceStop $SERVICE
rlRun "service $SERVICE start" 0 " Service have to implement start function "
rlRun "service $SERVICE restart" 0 " Service have to implement restart function "
rlRun "service $SERVICE status" 0 " Service have to implement status function "
rlRun "service $SERVICE condrestart" 0 " Service have to implement condrestart function "
rlRun "service $SERVICE reload" 0 " Service have to implement reload function "
rlRun "service $SERVICE force-reload" 0 " Service have to implement force-reload function "
rlLog ">>>>>>>>> nonexist operations"
rlRun "service $SERVICE noexistop" 2 " Testing proper return code when nonexisting function "
rlServiceRestore $SERVICE
fi # rhel 6 or less
else
rlLog ">>>> no netconsole kernel module appear here"
rlRun "ls /lib*/modules/*/kernel/drivers/net/netconsole.ko*" 1,2
fi
rlLog "NIC should support polling, NETPOLL should be compliled in kernel and netconsole module should be loaded"
rlLog "`cat /usr/src/kernels/$(uname -r)/.config | grep -i poll`"
rlLog "netconsole module: `lsmod | grep -i netconsole && echo true || echo false`"
rlLog "`cat /var/log/messages | grep -i netconsole | tail -n 10`"
rlPhaseEnd
# for RHEL6 and lower
if rlIsRHEL '<7'; then
rlPhaseStartTest "netfs service LSB compliance test"
SERVICE=$SRV_NETFS
rlServiceStop $SERVICE
rlLog ">>>>>>>>> service start"
rlRun "service $SERVICE start" 0 " Service must start without problem "
rlRun "service $SERVICE status" 0 " Then Status command "
rlRun "service $SERVICE start" 0 " Already started service "
rlRun "service $SERVICE status" 0 " Again status command "
rlLog ">>>>>>>>> service restart"
rlRun "service $SERVICE restart" 0 " Restarting of service "
rlRun "service $SERVICE status" 0 " Status command "
rlLog ">>>>>>>>> service stop"
rlRun "service $SERVICE stop" 0 " Stopping service "
rlRun "service $SERVICE status" 3 " Status of stopped service "
rlRun "service $SERVICE stop" 0 " Stopping service again "
rlRun "service $SERVICE status" 3 " Status of stopped service "
rlLog ">>>>>>>>> insufficient rights"
rlRun "service $SERVICE start " 0 " Starting service for restarting under nonpriv user "
rlRun "su testuserqa -c 'service $SERVICE restart'" 4 "Insufficient rights, restarting resrvice under nonprivileged user must fail "
rlLog ">>>>>>>>> operations"
rlServiceStop $SERVICE
rlRun "service $SERVICE start" 0 " Service have to implement start function "
rlRun "service $SERVICE restart" 0 " Service have to implement restart function "
rlRun "service $SERVICE status" 0 " Service have to implement status function "
rlLog ">>>>>>>>> nonexist operations"
rlRun "service $SERVICE noexistop" 2 " Testing proper return code when nonexisting function "
rlServiceRestore $SERVICE
rlPhaseEnd
else
rlPhaseStartTest "remote-fs target LSB compliance test"
TARGET=$TRG_REMOTEFS
rlServiceStop $TARGET
rlLog ">>>>>>>>> target start"
rlRun "service $TARGET start" 0 " Target must start without problem "
rlRun "service $TARGET status" 0 " Then Status command "
rlRun "service $TARGET start" 0 " Already started target "
rlRun "service $TARGET status" 0 " Again status command "
rlLog ">>>>>>>>> target restart"
rlRun "service $TARGET restart" 0 " Restarting target "
rlRun "service $TARGET status" 0 " Status command "
rlLog ">>>>>>>>> target stop"
rlRun "service $TARGET stop" 0 " Stopping target "
rlRun "service $TARGET status" 3 " Status of stopped target "
rlRun "service $TARGET stop" 0 " Stopping target again "
rlRun "service $TARGET status" 3 " Status of stopped target "
rlLog ">>>>>>>>> insufficient rights"
rlRun "service $TARGET start " 0 " Starting target for restarting under nonpriv user "
rlRun "su testuserqa -c 'service $TARGET restart'" 1 " Insufficient rights, restarting target under nonprivileged user must fail " # returns 1 instead of 4 because of polkit
rlLog ">>>>>>>>> operations"
rlServiceStop $TARGET
rlRun "service $TARGET start" 0 " Target have to implement start function "
rlRun "service $TARGET restart" 0 " Target have to implement restart function "
rlRun "service $TARGET status" 0 " Target have to implement status function "
rlLog ">>>>>>>>> nonexist operations"
rlRun "service $TARGET noexistop" 2 " Testing proper return code when nonexisting function "
rlServiceRestore $TARGET
rlPhaseEnd
fi
# rlPhaseStartTest "$SRV_NETWORK service LSB compliance test"
#
# SERVICE=$SRV_NETWORK
# rlServiceStop $SERVICE
# rlLog ">>>>>>>>> service start"
# rlRun "service $SERVICE start" 0 " Service must start without problem "
# rlRun "service $SERVICE status" 0 " Then Status command "
# rlRun "service $SERVICE start" 1,0 " Already started service "
# rlRun "service $SERVICE status" 0 " Again status command "
# rlLog ">>>>>>>>> service restart"
# rlRun "service $SERVICE restart" 0 " Restarting of service "
# rlRun "service $SERVICE status" 0 " Status command "
# rlLog ">>>>>>>>> service stop"
# rlRun "service $SERVICE stop" 0 " Stopping service "
# rlRun "service $SERVICE status" 0 " Status of stopped service "
# rlRun "service $SERVICE stop" 0 " Stopping service again "
# rlRun "service $SERVICE status" 0 " Status of stopped service "
# rlLog ">>>>>>>>> insufficient rights"
# rlRun "service $SERVICE start " 0 " Starting service for restarting under nonpriv user "
# rlRun "su testuserqa -c 'service $SERVICE restart'" 4 "Insufficient rights, restarting resrvice under nonprivileged user must fail "
# rlLog ">>>>>>>>> operations"
# rlServiceStop $SERVICE
# rlRun "service $SERVICE start" 0 " Service have to implement start function "
# rlRun "service $SERVICE restart" 0 " Service have to implement restart function "
# rlRun "service $SERVICE status" 0 " Service have to implement status function "
# rlRun "service $SERVICE reload" 0 " Service have to implement reload function "
# rlRun "service $SERVICE force-reload" 0 " Service have to implement force-reload function "
# rlLog ">>>>>>>>> nonexist operations"
# rlRun "service $SERVICE noexistop" 2 " Testing proper return code when nonexisting function "
# rlServiceRestore $SERVICE
# service $SERVICE start
rlPhaseEnd
rlPhaseStartCleanup
rlRun "userdel -fr testuserqa" 0 "Remove test user"
rlFileRestore
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

291
tests/standard-inventory-qcow2 Executable file
View File

@ -0,0 +1,291 @@
#!/usr/bin/env python
import argparse
import errno
import json
import os
import shutil
import shlex
import signal
import socket
import subprocess
import sys
import tempfile
import time
import distutils.util
IDENTITY = """
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEA1DrTSXQRF8isQQfPfK3U+eFC4zBrjur+Iy15kbHUYUeSHf5S
jXPYbHYqD1lHj4GJajC9okle9rykKFYZMmJKXLI6987wZ8vfucXo9/kwS6BDAJto
ZpZSj5sWCQ1PI0Ce8CbkazlTp5NIkjRfhXGP8mkNKMEhdNjaYceO49ilnNCIxhpb
eH5dH5hybmQQNmnzf+CGCCLBFmc4g3sFbWhI1ldyJzES5ZX3ahjJZYRUfnndoUM/
TzdkHGqZhL1EeFAsv5iV65HuYbchch4vBAn8jDMmHh8G1ixUCL3uAlosfarZLLyo
3HrZ8U/llq7rXa93PXHyI/3NL/2YP3OMxE8baQIDAQABAoIBAQCxuOUwkKqzsQ9W
kdTWArfj3RhnKigYEX9qM+2m7TT9lbKtvUiiPc2R3k4QdmIvsXlCXLigyzJkCsqp
IJiPEbJV98bbuAan1Rlv92TFK36fBgC15G5D4kQXD/ce828/BSFT2C3WALamEPdn
v8Xx+Ixjokcrxrdeoy4VTcjB0q21J4C2wKP1wEPeMJnuTcySiWQBdAECCbeZ4Vsj
cmRdcvL6z8fedRPtDW7oec+IPkYoyXPktVt8WsQPYkwEVN4hZVBneJPCcuhikYkp
T3WGmPV0MxhUvCZ6hSG8D2mscZXRq3itXVlKJsUWfIHaAIgGomWrPuqC23rOYCdT
5oSZmTvFAoGBAPs1FbbxDDd1fx1hisfXHFasV/sycT6ggP/eUXpBYCqVdxPQvqcA
ktplm5j04dnaQJdHZ8TPlwtL+xlWhmhFhlCFPtVpU1HzIBkp6DkSmmu0gvA/i07Z
pzo5Z+HRZFzruTQx6NjDtvWwiXVLwmZn2oiLeM9xSqPu55OpITifEWNjAoGBANhH
XwV6IvnbUWojs7uiSGsXuJOdB1YCJ+UF6xu8CqdbimaVakemVO02+cgbE6jzpUpo
krbDKOle4fIbUYHPeyB0NMidpDxTAPCGmiJz7BCS1fCxkzRgC+TICjmk5zpaD2md
HCrtzIeHNVpTE26BAjOIbo4QqOHBXk/WPen1iC3DAoGBALsD3DSj46puCMJA2ebI
2EoWaDGUbgZny2GxiwrvHL7XIx1XbHg7zxhUSLBorrNW7nsxJ6m3ugUo/bjxV4LN
L59Gc27ByMvbqmvRbRcAKIJCkrB1Pirnkr2f+xx8nLEotGqNNYIawlzKnqr6SbGf
Y2wAGWKmPyEoPLMLWLYkhfdtAoGANsFa/Tf+wuMTqZuAVXCwhOxsfnKy+MNy9jiZ
XVwuFlDGqVIKpjkmJyhT9KVmRM/qePwgqMSgBvVOnszrxcGRmpXRBzlh6yPYiQyK
2U4f5dJG97j9W7U1TaaXcCCfqdZDMKnmB7hMn8NLbqK5uLBQrltMIgt1tjIOfofv
BNx0raECgYEApAvjwDJ75otKz/mvL3rUf/SNpieODBOLHFQqJmF+4hrSOniHC5jf
f5GS5IuYtBQ1gudBYlSs9fX6T39d2avPsZjfvvSbULXi3OlzWD8sbTtvQPuCaZGI
Df9PUWMYZ3HRwwdsYovSOkT53fG6guy+vElUEDkrpZYczROZ6GUcx70=
-----END RSA PRIVATE KEY-----
"""
USER_DATA = """#cloud-config
users:
- default
- name: root
groups: sudo
shell: /bin/bash
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUOtNJdBEXyKxBB898rdT54ULjMGuO6v4jLXmRsdRhR5Id/lKNc9hsdioPWUePgYlqML2iSV72vKQoVhkyYkpcsjr3zvBny9+5xej3+TBLoEMAm2hmllKPmxYJDU8jQJ7wJuRrOVOnk0iSNF+FcY/yaQ0owSF02Nphx47j2KWc0IjGGlt4fl0fmHJuZBA2afN/4IYIIsEWZziDewVtaEjWV3InMRLllfdqGMllhFR+ed2hQz9PN2QcapmEvUR4UCy/mJXrke5htyFyHi8ECfyMMyYeHwbWLFQIve4CWix9qtksvKjcetnxT+WWrutdr3c9cfIj/c0v/Zg/c4zETxtp standard-test-qcow2
ssh_pwauth: True
chpasswd:
list: |
root:foobar
expire: False
runcmd:
- mkfs.ext4 /dev/sdb
- mount /dev/sdb /usr/local
- sudo mount -o remount,rw /usr
- mkdir /expected /output
"""
def main(argv):
parser = argparse.ArgumentParser(description="Inventory for a QCow2 test image")
parser.add_argument("--list", action="store_true", help="Verbose output")
parser.add_argument('--host', help="Get host variables")
parser.add_argument("subjects", nargs="*", default=shlex.split(os.environ.get("TEST_SUBJECTS", "")))
opts = parser.parse_args()
try:
if opts.host:
data = host(opts.host)
else:
data = list(opts.subjects)
sys.stdout.write(json.dumps(data, indent=4, separators=(',', ': ')))
except RuntimeError as ex:
sys.stderr.write("{0}: {1}\n".format(os.path.basename(sys.argv[0]), str(ex)))
return 1
return 0
def list(subjects):
hosts = []
variables = {}
for subject in subjects:
if subject.endswith((".qcow2", ".qcow2c")):
vars = host(subject)
if vars:
hosts.append(subject)
variables[subject] = vars
return {"localhost": {"hosts": hosts, "vars": {}}, "subjects": {"hosts": hosts, "vars": {}},
"_meta": {"hostvars": variables}}
def start_qemu(image, cloudinit, log, disk_directory=None, disk_size=None, portrange=(2222, 5555)):
for port in xrange(*portrange):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
try:
sock.bind(("127.0.0.3", port))
if disk_size:
return subprocess.Popen(["/usr/bin/qemu-system-x86_64", "-m", "1024", image,
"-enable-kvm", "-snapshot", "-cdrom", cloudinit,
"-hdb", disk_directory,
"-net", "nic,model=virtio", "-net",
"user,hostfwd=tcp:127.0.0.3:{0}-:22".format(port),
"-device", "isa-serial,chardev=pts2", "-chardev", "file,id=pts2,path=" + log,
"-display", "none"], stdout=open(os.devnull, 'w')), port
else:
return subprocess.Popen(["/usr/bin/qemu-system-x86_64", "-m", "1024", image,
"-enable-kvm", "-snapshot", "-cdrom", cloudinit,
"-net", "nic,model=virtio", "-net",
"user,hostfwd=tcp:127.0.0.3:{0}-:22".format(port),
"-device", "isa-serial,chardev=pts2", "-chardev", "file,id=pts2,path=" + log,
"-display", "none"], stdout=open(os.devnull, 'w')), port
except IOError:
pass
finally:
sock.close()
else:
raise RuntimeError("unable to find free local port to map SSH to")
def host(image):
null = open(os.devnull, 'w')
try:
tty = os.open("/dev/tty", os.O_WRONLY)
os.dup2(tty, 2)
except OSError:
tty = None
pass
# A directory for temporary stuff
directory = tempfile.mkdtemp(prefix="inventory-cloud")
identity = os.path.join(directory, "identity")
with open(identity, 'w') as f:
f.write(IDENTITY)
os.chmod(identity, 0o600)
metadata = os.path.join(directory, "meta-data")
with open(metadata, 'w') as f:
f.write("")
userdata = os.path.join(directory, "user-data")
with open(userdata, 'w') as f:
f.write(USER_DATA)
# Create additional disk
disk_size = None
disk_directory = None
try:
disk_size = os.environ.get("EXTEND_DISK_SIZE")
if disk_size:
sys.stderr.write("\nCreate additional cloud init disk DISK SIZE {}\n".format(disk_size))
disk_directory = "{}/atomic-host-disk2-{}".format(directory, disk_size)
subprocess.check_call(["qemu-img", "create", "-f", "qcow2", disk_directory, disk_size], stdout=null)
except KeyError:
sys.stderr.write("\nCouldn't create additional cloud init disk DISK SIZE\n")
pass
# Create our cloud init so we can log in
cloudinit = os.path.join(directory, "cloud-init.iso")
subprocess.check_call(["/usr/bin/genisoimage", "-input-charset", "utf-8",
"-volid", "cidata", "-joliet", "-rock", "-quiet",
"-output", cloudinit, userdata, metadata], stdout=null)
# Determine if virtual machine should be kept available for diagnosis after completion
try:
diagnose = distutils.util.strtobool(os.getenv("TEST_DEBUG", "0"))
except ValueError:
diagnose = 0
sys.stderr.write("Launching virtual machine for {0}\n".format(image))
# And launch the actual VM
artifacts = os.environ.get("TEST_ARTIFACTS", os.path.join(os.getcwd(), "artifacts"))
try:
os.makedirs(artifacts)
except OSError as exc:
if exc.errno != errno.EEXIST or not os.path.isdir(artifacts):
raise
log = os.path.join(artifacts, "{0}.log".format(os.path.basename(image)))
proc = None # for failure detection
cpe = None # for exception scoping
for tries in xrange(0, 5):
try:
proc, port = start_qemu(image, cloudinit, log, disk_directory=disk_directory, disk_size=disk_size)
break
except subprocess.CalledProcessError as cpe:
time.sleep(1)
continue
if proc is None:
raise RuntimeError("Could not launch VM for qcow2 image"
" '{0}':{1}".format(image, cpe.output))
# The variables
variables = {"ansible_ssh_port": "{0}".format(port),
"ansible_ssh_host": "127.0.0.3",
"ansible_ssh_user": "root",
"ansible_ssh_pass": "foobar",
"ansible_ssh_private_key_file": identity,
"ansible_ssh_common_args": "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"}
# Write out a handy inventory file, for our use and for debugging
args = " ".join(["{0}='{1}'".format(*item) for item in variables.items()])
inventory = os.path.join(directory, "inventory")
with open(inventory, "w") as f:
f.write("[subjects]\nlocalhost {1}\n".format(image, args))
# Wait for ssh to come up
ping = ["/usr/bin/ansible", "--inventory", inventory, "localhost", "--module-name", "raw", "--args", "/bin/true"]
for tries in xrange(0, 30):
try:
(pid, ret) = os.waitpid(proc.pid, os.WNOHANG)
if pid != 0:
raise RuntimeError("qemu failed to launch qcow2 image: {0}".format(image))
subprocess.check_call(ping, stdout=null, stderr=null)
break
except subprocess.CalledProcessError:
time.sleep(3)
else:
# Kill the qemu process
try:
os.kill(proc.pid, signal.SIGTERM)
except OSError:
pass
raise RuntimeError("could not access launched qcow2 image: {0}".format(image))
# Process of our parent
ppid = os.getppid()
child = os.fork()
if child:
return variables
# Daemonize and watch the processes
os.chdir("/")
os.setsid()
os.umask(0)
if tty is None:
tty = null.fileno()
# Duplicate standard input to standard output and standard error.
os.dup2(null.fileno(), 0)
os.dup2(tty, 1)
os.dup2(tty, 2)
# Now wait for the parent process to go away, then kill the VM
while True:
time.sleep(3)
try:
os.kill(ppid, 0)
os.kill(proc.pid, 0)
except OSError:
break # Either of the processes no longer exist
if diagnose:
sys.stderr.write("\n")
sys.stderr.write("DIAGNOSE: ssh -p {0} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "
"root@{1} # password: {2}\n".format(port, "127.0.0.3", "foobar"))
sys.stderr.write("DIAGNOSE: export ANSIBLE_INVENTORY={0}\n".format(inventory))
sys.stderr.write("DIAGNOSE: kill {0} # when finished\n".format(os.getpid()))
def _signal_handler(*args):
sys.stderr.write("\nDIAGNOSE ending...\n")
signal.signal(signal.SIGTERM, _signal_handler)
signal.pause()
# Kill the qemu process
try:
os.kill(proc.pid, signal.SIGTERM)
except OSError:
pass
shutil.rmtree(directory)
sys.exit(0)
if __name__ == '__main__':
sys.exit(main(sys.argv))

12
tests/tests.yml Normal file
View File

@ -0,0 +1,12 @@
---
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
- container
- atomic
tests:
- Sanity-init-scripts-LSB
required_packages:
- initscripts