[Ovirt-devel] [PATCH appliance] Add logic for allowing SSH keys to be included during appliance creation time
Perry Myers
pmyers at redhat.com
Sat Nov 15 04:30:10 UTC 2008
This is to be used for development purposes only for convenience.
If ovirt_dev is set to 1 (which happens if the Release in the spec file is
0) then this functionality is turned on by default.
AUTH_KEYS makefile var can be overridden by environment to specify alternate
location for auth keys file. Default is ~/.ssh/authorized_keys.
Signed-off-by: Perry Myers <pmyers at redhat.com>
---
Makefile.am | 13 ++++++++++---
ovirt-appliance.ks | 9 +++++++++
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index af84422..adace7c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,6 +23,7 @@ PKG_FMT = tar
DISK_FMT ?= qcow2
SUM ?= sha1sum
APP_RAM ?= 768
+AUTH_KEYS ?= ~/.ssh/authorized_keys
FEDORA = $(shell rpm --eval '%{fedora}')
ARCH = $(shell rpm --eval '%{_arch}')
@@ -43,7 +44,8 @@ EXTRA_DIST = \
DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \
$(NVR).$(PKG_FMT) \
- $(NVR).$(PKG_FMT).$(SUM)
+ $(NVR).$(PKG_FMT).$(SUM) \
+ repos.ks ovirt-authorized_keys
# For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT-
# annotated rpm version strings.
@@ -80,8 +82,13 @@ repos.ks:
echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)" >> $@ \
)
+keys:
+ if [ "$(_ovirt_dev)" = 1 -a -f $(AUTH_KEYS) ]; then \
+ cp -va $(AUTH_KEYS) ovirt-authorized_keys ;\
+ fi
+
SELINUX_ENFORCING=$(shell /usr/sbin/getenforce)
-$(NVR).$(PKG_FMT): repos.ks
+$(NVR).$(PKG_FMT): repos.ks keys
mkdir -p $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree
mkdir -p $(OVIRT_CACHE_DIR)/yum
( \
@@ -141,4 +148,4 @@ publish: rpms
rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src/
createrepo $(OVIRT_CACHE_DIR)/ovirt
-.PHONY: rpms publish $(NVR).$(PKG_FMT).$(SUM) $(NVR).$(PKG_FMT)
+.PHONY: rpms publish $(NVR).$(PKG_FMT).$(SUM) $(NVR).$(PKG_FMT) keys
diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks
index 8fabdb7..f9bfcd5 100644
--- a/ovirt-appliance.ks
+++ b/ovirt-appliance.ks
@@ -44,6 +44,15 @@ lokkit
%end
%post --nochroot
+ if [ -f "ovirt-authorized_keys" ]; then
+ echo "Adding authorized_keys to Image"
+ mkdir -p $INSTALL_ROOT/root/.ssh
+ cp -v ovirt-authorized_keys $INSTALL_ROOT/root/.ssh/authorized_keys
+ chown -R root:root $INSTALL_ROOT/root/.ssh
+ chmod 755 $INSTALL_ROOT/root/.ssh
+ chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys
+ fi
+
set -e
python -c '
from iniparse.ini import INIConfig
--
1.6.0.3
More information about the ovirt-devel
mailing list