aboutsummaryrefslogtreecommitdiffstats
path: root/testing/opennebula/opennebula.initd
diff options
context:
space:
mode:
Diffstat (limited to 'testing/opennebula/opennebula.initd')
-rw-r--r--testing/opennebula/opennebula.initd16
1 files changed, 16 insertions, 0 deletions
diff --git a/testing/opennebula/opennebula.initd b/testing/opennebula/opennebula.initd
index d80d3753d9..0da1099049 100644
--- a/testing/opennebula/opennebula.initd
+++ b/testing/opennebula/opennebula.initd
@@ -8,6 +8,8 @@ depend() {
}
start() {
+ checkconfig || return 1
+
ebegin "Starting OpenNebula daemon"
start-stop-daemon \
--start \
@@ -42,3 +44,17 @@ stop() {
--pidfile "${SCHED_PIDFILE}"
eend $?
}
+
+gen_key() {
+ ebegin "Generating ssh key"
+ su - ${USER} -c "ssh-keygen -q -t dsa -N '' -f ${HOME}/.ssh/id_dsa"
+ cp -p "${HOME}/.ssh/id_dsa.pub" "${HOME}/.ssh/authorized_keys"
+ eend $?
+}
+
+checkconfig() {
+ if [ ! -f "${HOME}/.ssh/id_dsa" ] ; then
+ gen_key || return 1
+ fi
+}
+