-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvdsm-hook-floppyinject.spec
71 lines (55 loc) · 1.66 KB
/
vdsm-hook-floppyinject.spec
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
%define floppyinject_name vdsm-hook-floppyinject
%define vdsm_name vdsm
Summary: Creating and mounting floppy disk for Red-Hat VDSM
Name: vdsm-hook-floppyinject
Source: %{floppyinject_name}.tar.gz
Version: 1.0
Vendor: Red-Had
Release: 2%{?dist}
License: GPLv2+
Group: Applications/System
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
ExclusiveArch: x86_64
Requires: vdsm
%description
Creating and mounting floppy disk for Red-Hat VDSM
%prep
%setup -c -q
%build
%install
rm -rf $RPM_BUILD_ROOT
make -C %{_builddir}/%{name}-%{version} PREFIX="%{buildroot}" \
LIBEXECDIR=%{_libexecdir}/%{vdsm_name} \
install
%clean
rm -rf $RPM_BUILD_ROOT
%files
%attr (755,vdsm,kvm) %{_libexecdir}/vdsm/hooks/before_vm_start/50_floppyinject
%attr (755,vdsm,kvm) %{_libexecdir}/vdsm/hooks/before_vm_migrate_destination/50_floppyinject
%attr (440,root,root) %{_sysconfdir}/sudoers.d/50_vdsm_hook_floppyinject
%post
# update sudoers
tmp_sudoers=$(mktemp)
cp -a /etc/sudoers $tmp_sudoers
/bin/sed -i -e "/# vdsm-hook-floppyinject/,/# end vdsm-hook-floppyinject/d" $tmp_sudoers
cat >> $tmp_sudoers <<EOF
# vdsm-hook-floppyinject customizations
#include /etc/sudoers.d/50_vdsm_hook_floppyinject
# end vdsm-hook-floppyinject customizations
EOF
cp -a $tmp_sudoers /etc/sudoers
rm -f $tmp_sudoers
%postun
if [ "$1" -eq 0 ]; then
# remove updated qemu.conf
sed -i '/# by vdsm-hook-floppyinject$/d' /etc/libvirt/qemu.conf
# remove updated sudoers
tmp_sudoers=$(mktemp)
cp -a /etc/sudoers $tmp_sudoers
/bin/sed -i -e "/# vdsm-hook-floppyinject/,/# end vdsm-hook-floppyinject/d" $tmp_sudoers
cp -a $tmp_sudoers /etc/sudoers
rm -f $tmp_sudoers
fi
exit 0
%doc
%changelog