-
Notifications
You must be signed in to change notification settings - Fork 13
/
ovirt-node-ng.spec.in
112 lines (90 loc) · 3.78 KB
/
ovirt-node-ng.spec.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
%global _node_image_dir /usr/share/%{name}/image/
%global _node_image_file %{_node_image_dir}/%{name}-@PLACEHOLDER_RPM_VERSION@-@PLACEHOLDER_RPM_RELEASE@.squashfs.img
# Disable compression, because the image is already compressed
%define _source_payload w0.gzdio
%define _binary_payload w0.gzdio
Name: @PACKAGE_NAME@
Version: @PLACEHOLDER_RPM_VERSION@
Release: @PLACEHOLDER_RPM_RELEASE@
License: GPL-2.0-only
Summary: oVirt Node Next Image Update
URL: https://www.ovirt.org/download/node.html
Source0: %{name}-@PACKAGE_VERSION@.tar.gz
Source1: @IMAGENAME@.squashfs.img
Source2: product.img
Requires: imgbased >= 0.7.2
Obsoletes: %{name}-placeholder < %{version}-%{release}
Provides: %{name}-placeholder = %{version}-%{release}
Obsoletes: ovirt-node-ng-image < %{version}-%{release}
Provides: ovirt-node-ng-image = %{version}-%{release}
BuildArch: noarch
BuildRequires: autoconf
BuildRequires: automake
%description
This package will update an oVirt Node Next host with the new image.
%prep
%setup -q -n %{name}-@PACKAGE_VERSION@
%build
%configure
make %{?_smp_mflags}
%install
# Install the image
/usr/bin/install -d %{buildroot}/%{_node_image_dir}
/usr/bin/install -m 644 %{SOURCE1} %{buildroot}/%{_node_image_file}
/usr/bin/install -m 644 %{SOURCE2} %{buildroot}/%{_node_image_dir}/product.img
%pre
# Veriying avoiding installing over an active local storage,
# we use the following 'find' options:
# -xdev, Don't descend directories on other filesystems, those are not considered local storages,
# and are not affected by the installation
# -not -empty, Skip empty metadata files as storage domains cannot have empty metadata file.
# we also exclude folders starting with /rhvh which holds symbolic links to block storage domains
# Or mounted file based storage domains, although these are likely skipped by -xdev.
local_sds=($(find / -xdev -path "*/dom_md/metadata" -not -empty | egrep -v ^/rhev/))
if [ "$local_sds" ]; then
echo "Local storage domains were found on the same filesystem as / ! Please migrate the data to a new LV before upgrading, or you will lose the VMs"
echo "See: https://bugzilla.redhat.com/show_bug.cgi?id=1550205#c3"
echo "Storage domains were found in:"
for sd in "${local_sds[@]}"; do
echo -e "\t$(dirname $sd)"
done
exit 1
fi
%post
set -e
# Some magic to ensure that imgbase from
# the new image is used for updates
export IMGBASED_IMAGE_UPDATE_RPM=$(lsof -p $PPID 2>/dev/null | grep image-update | awk '{print $9}')
export MNTDIR="$(mktemp -d)"
mount "%{_node_image_file}" "$MNTDIR"
mount "$MNTDIR"/LiveOS/rootfs.img "$MNTDIR"
export PYTHONPATH=$(find $MNTDIR/usr/lib/python* -name imgbased -type d -exec dirname {} \; | sort | tail -1):$PYTHONPATH
imgbase --debug update --format liveimg %{_node_image_file} >> /var/log/imgbased.log 2>&1
umount "$MNTDIR"
umount "$MNTDIR"
%files
%dir %{_node_image_dir}
%{_node_image_file}
%{_node_image_dir}/product.img
%changelog
* Thu Nov 30 2023 Sandro Bonazzola <sandro.bonazzola@gmail.com> - 4.5.5
- oVirt Node 4.5.5
- Migrated license tag to SPDX format
* Thu Dec 01 2022 Lev Veyde <lveyde@redhat.com> - 4.5.4
- oVirt Node 4.5.4
* Thu Oct 27 2022 Lev Veyde <lveyde@redhat.com> - 4.5.3.2
- oVirt Node 4.5.3.2
* Wed Oct 19 2022 Lev Veyde <lveyde@redhat.com> - 4.5.3.1
- oVirt Node 4.5.3.1
* Wed Aug 10 2022 Lev Veyde <lveyde@redhat.com> - 4.5.2
- oVirt Node 4.5.2
* Wed Jun 22 2022 Lev Veyde <lveyde@redhat.com> - 4.5.1
- oVirt Node 4.5.1
* Wed May 25 2022 Sandro Bonazzola <sbonazzo@redhat.com> - 4.5.0.3
- oVirt Node 4.5.0.3
* Fri May 13 2022 Sandro Bonazzola <sbonazzo@redhat.com> - 4.5.0.2
- oVirt Node 4.5.0.2
* Tue Apr 26 2022 Sandro Bonazzola <sbonazzo@redhat.com> - 4.5.0.1
- oVirt Node 4.5.0.1
* Tue Sep 07 2021 Sandro Bonazzola <sbonazzo@redhat.com> - 4.5.0
- oVirt Node 4.5.0