From 6ecf2cdb10a375d5fdad5f81ed183e6184e5f58d Mon Sep 17 00:00:00 2001 From: Jeka Der Date: Mon, 13 Oct 2014 20:12:43 +0200 Subject: updated build scripts --- Makefile | 6 +++--- README.md | 13 +++---------- debian/changelog | 6 ++++++ debian/control | 2 +- debian/postinst | 14 ++++++++++++++ debian/postrm | 3 +++ debian/prerm | 3 +++ debian/rules | 1 - fake_ilo | 2 ++ 9 files changed, 35 insertions(+), 15 deletions(-) create mode 100644 debian/postinst create mode 100644 debian/postrm create mode 100644 debian/prerm diff --git a/Makefile b/Makefile index 6e477de..cf33039 100644 --- a/Makefile +++ b/Makefile @@ -3,15 +3,15 @@ sysconfdir=$(DESTDIR)/etc all: # openssl req -x509 -newkey rsa:2048 -keyout $(sysconfdir)/server.key -out $(sysconfdir)/server.crt -nodes -days 9999 -subj "/C=MD/ST=Chisinau/L=Chisinau/O=IT/CN=www.example.com" - openssl req -x509 -newkey rsa:2048 -keyout server.key -out server.crt -nodes -days 9999 -subj "/C=MD/ST=Chisinau/L=Chisinau/O=IT/CN=www.example.com" +# openssl req -x509 -newkey rsa:2048 -keyout server.key -out server.crt -nodes -days 9999 -subj "/C=MD/ST=Chisinau/L=Chisinau/O=IT/CN=www.example.com" echo "Nothing to compile, please run make install" install: all # env mkdir -p $(sysconfdir)/fake_ilo/ install -m 0755 ilo.py $(bindir) install -m 0755 fake_ilo $(sysconfdir)/init.d/ - install -m 0600 server.key $(sysconfdir)/fake_ilo/ - install -m 0600 server.crt $(sysconfdir)/fake_ilo/ +# install -m 0600 server.key $(sysconfdir)/fake_ilo/ +# install -m 0600 server.crt $(sysconfdir)/fake_ilo/ clean: rm -f server.key diff --git a/README.md b/README.md index af5ba35..5cb9496 100644 --- a/README.md +++ b/README.md @@ -59,20 +59,13 @@ b) manually: `$ sudo make install` -ENABLE: -------- - -register the init script (Debian): +3. register the init script (Debian): `update-rc.d fake_ilo enable` +4. Create certificate and key. Data provided in the requested fields is not important: oVirt does not verify certificates: -CUSTOM CERTIFICATE: -------------------- - -The install script creates a default certificate which should be enough for testing. To replace it, follwo the steps: - -1. go into the config directory and generate a self-signed certificate by running this command. Data provided in the requested fields is not important: oVirt does not verify certificates: + `# mkdir /etc/fake_ilo/` `# cd /etc/fake_ilo/` diff --git a/debian/changelog b/debian/changelog index 97b5597..32bd213 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +fake-ilo (0.0.1-4) UNRELEASED; urgency=medium + + * Updated init scripts and installer + + -- Jeka Der Mon, 13 Oct 2014 19:55:00 +0200 + fake-ilo (0.0.1-1) UNRELEASED; urgency=medium * Initial release. diff --git a/debian/control b/debian/control index fd6e0b8..9458602 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 9), openssl, python Package: fake-ilo Architecture: any -Depends: openssl, python, libvirt +Depends: openssl, python, libvirt-daemon Description: iLO emulator iLO emulator which can power cycle libvirt VMs. It was written by me to perform tests of oVirt/RHEV Power Management features by installing hosts as libvirt diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..485edae --- /dev/null +++ b/debian/postinst @@ -0,0 +1,14 @@ +#!/bin/bash + +# generate certificates if absent +if [ ! -f "/etc/fake_ilo/server.crt" ]; then + if [ ! -f "/etc/fake_ilo/server.key" ]; then + mkdir /etc/fake_ilo/ + echo "Creating certificates" + openssl req -x509 -newkey rsa:2048 -keyout /etc/fake_ilo/server.key -out /etc/fake_ilo/server.crt -nodes -days 9999 -subj "/C=MD/ST=Chisinau/L=Chisinau/O=IT/CN=$(hostname -f)" + fi +fi + +# enable the init script +update-rc.d -f fake_ilo defaults +invoke-rc.d fake_ilo start diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..01c4275 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,3 @@ +#!/bin/sh + +update-rc.d -f fake_ilo remove diff --git a/debian/prerm b/debian/prerm new file mode 100644 index 0000000..b3cd3ca --- /dev/null +++ b/debian/prerm @@ -0,0 +1,3 @@ +#!/bin/sh + +invoke-rc.d fake_ilo stop diff --git a/debian/rules b/debian/rules index 4f2c774..cbe925d 100755 --- a/debian/rules +++ b/debian/rules @@ -1,4 +1,3 @@ #!/usr/bin/make -f %: dh $@ - diff --git a/fake_ilo b/fake_ilo index 34e226f..e120ea2 100644 --- a/fake_ilo +++ b/fake_ilo @@ -12,6 +12,8 @@ set -e +# . /lib/lsb/init-functions + PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/bin/ilo.py NAME=fake_ilo -- cgit