Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/validate-cg-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ignore_multiple_sources=" \

# List of ignored specs due to no source tarball to scan.
ignore_no_source_tarball=" \
azurelinux-sysinfo \
ca-certificates \
check-restart \
core-packages \
Expand Down
2 changes: 1 addition & 1 deletion SPECS/LICENSES-AND-NOTICES/LICENSES-MAP.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions SPECS/LICENSES-AND-NOTICES/data/licenses.json
Original file line number Diff line number Diff line change
Expand Up @@ -2152,6 +2152,7 @@
"azcopy",
"azure-iot-sdk-c",
"azure-storage-cpp",
"azurelinux-sysinfo",
"bazel",
"blobfuse",
"blobfuse2",
Expand Down
13 changes: 13 additions & 0 deletions SPECS/azurelinux-sysinfo/azurelinux-sysinfo.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Azure Linux Sysinfo Service
After=cloud-init.target multi-user.target

[Service]
Environment=PYTHONUNBUFFERED=1
Type=simple
ExecStart=/usr/bin/python3 /usr/bin/collect-sysinfo
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target
9 changes: 9 additions & 0 deletions SPECS/azurelinux-sysinfo/azurelinux-sysinfo.signatures.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Signatures": {
"collect-sysinfo": "b47df8a856c49e4bc02b36d1c3dd2825b75b9d8449b5dae8af401fc6818131c9",
"sysinfo-schema-v1.json": "67b541239416bd5f9a77a0799881f21c2e5eea686dc7a3ccaffe6bd7219a4798",
"azurelinux-sysinfo.service": "c719ab2238d0412b7ac6a793cd83e5be7879023161f86fb29d1c0ca18e70631c",
"sysinfo-selinuxpolicies.cil": "1f0df94a09f4db09093743339b6162735b6f1c81108cd3b857a6dbc729630400"
}
}

69 changes: 69 additions & 0 deletions SPECS/azurelinux-sysinfo/azurelinux-sysinfo.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Summary: Package to deploy azurelinux-sysinfo service
Name: azurelinux-sysinfo
Version: %{azl}.0
Release: 1%{?dist}
License: MIT
Vendor: Microsoft Corporation
Distribution: Azure Linux
Group: System Environment/Base
URL: https://aka.ms/azurelinux
Source0: collect-sysinfo
Source1: sysinfo-schema-v1.json
Source2: azurelinux-sysinfo.service
Source3: sysinfo-selinuxpolicies.cil
Requires: systemd
Requires: python3-psutil

%description
Deploys a systemd service that gathers system information related to the device, operating system, cloud-init, boot
time, resource utilization, installed packages, and SELinux mode. Collected information is written in JSON format to
a log file on the user's system for easy access and analysis. The systemd service runs at boot time if installed during
image creation.

%install
# Copy collection python script to /usr/bin/
mkdir -p %{buildroot}%{_bindir}/
install -m 755 %{SOURCE0} %{buildroot}%{_bindir}/

# Copy data schema to /usr/share/azurelinux-sysinfo/
mkdir -p %{buildroot}%{_datadir}/azurelinux-sysinfo/
install -m 755 %{SOURCE1} %{buildroot}%{_datadir}/azurelinux-sysinfo/

# Copy service to /etc/systemd/system/
mkdir -p %{buildroot}%{_sysconfdir}/systemd/system/
install -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/systemd/system/

# Copy the sysinfo-selinuxpolicies file to /usr/share/selinux/packages/
mkdir -p %{buildroot}%{_datadir}/selinux/packages/
install -m 755 %{SOURCE3} %{buildroot}%{_datadir}/selinux/packages/

%files
%{_bindir}/collect-sysinfo
%dir %{_datadir}/azurelinux-sysinfo/
%{_datadir}/azurelinux-sysinfo/sysinfo-schema-v1.json
%{_sysconfdir}/systemd/system/azurelinux-sysinfo.service
%{_datadir}/selinux/packages/sysinfo-selinuxpolicies.cil

%post
#!/bin/sh
# Enable the systemd service
systemctl enable azurelinux-sysinfo.service

# Apply required SElinux policies only if selinux-policy is present
if rpm -q selinux-policy &> /dev/null; then
semodule -i %{_datadir}/selinux/packages/sysinfo-selinuxpolicies.cil
fi

%postun
# If selinux-policy is present, remove the sysinfo-selinuxpolicies module
if rpm -q selinux-policy &> /dev/null; then
semodule -r sysinfo-selinuxpolicies
fi

%changelog
* Thu Apr 04 2024 Amrita Kohli <amritakohli@microsoft.com> - 3.0-1
- License verified.
- Implementation of package that deploys azurelinux-sysinfo service.
- Original version for CBL-Mariner.


Loading