aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-extended/webmin
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2011-10-24 15:13:27 +0100
committerPaul Eggleton <paul.eggleton@linux.intel.com>2011-10-24 15:13:27 +0100
commit8a4f50f2176c3232f224e42036b89ea9d494748a (patch)
treefbfcc01d299541d92fb54c8d28ed0b6a8b5e8942 /recipes-extended/webmin
parent8a97f21d4c2ba2f07896ede32ed3cc892b97ddc5 (diff)
downloadmeta-baryon-8a4f50f2176c3232f224e42036b89ea9d494748a.tar.gz
meta-baryon-8a4f50f2176c3232f224e42036b89ea9d494748a.tar.bz2
meta-baryon-8a4f50f2176c3232f224e42036b89ea9d494748a.zip
Show info about the web interface on startup
Add a webmin-notice package containing an init script that prints out the web admin URL, and add it to baryon-image. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'recipes-extended/webmin')
-rw-r--r--recipes-extended/webmin/webmin-notice/webmin-notice.sh42
-rw-r--r--recipes-extended/webmin/webmin-notice_1.0.bb21
2 files changed, 63 insertions, 0 deletions
diff --git a/recipes-extended/webmin/webmin-notice/webmin-notice.sh b/recipes-extended/webmin/webmin-notice/webmin-notice.sh
new file mode 100644
index 0000000..fa493ef
--- /dev/null
+++ b/recipes-extended/webmin/webmin-notice/webmin-notice.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# Webmin connect info report script
+# Copyright (C) 2011 Intel Corporation
+# Distributed under the MIT license
+
+if ! [ -f /var/webmin/miniserv.pid ] ; then
+ echo "Webmin not started or failed to start"
+ exit
+elif ! [ -d /proc/`cat /var/webmin/miniserv.pid` ] ; then
+ echo "Webmin not started or failed to start"
+ exit
+fi
+
+if [ "`pidof avahi-daemon`" != "" ] ; then
+ host=`grep "^host-name=" /etc/avahi/avahi-daemon.conf | sed 's/host-name=//'`
+ if [ "$host" = "" ] ; then
+ host=`hostname`
+ fi
+ domain=`grep "^domain-name=" /etc/avahi/avahi-daemon.conf | sed 's/domain-name=//'`
+ if [ "$domain" = "" ] ; then
+ domain="local"
+ fi
+ avahiaddr="$host.$domain"
+fi
+
+port=`grep "^port=" /etc/webmin/miniserv.conf | sed 's/port=//'`
+ssl=`grep "^ssl=" /etc/webmin/miniserv.conf | sed 's/ssl=//'`
+if [ "$ssl" = "1" ] ; then
+ proto="https"
+else
+ proto="http"
+fi
+ipaddr=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
+
+addr="$proto://$ipaddr:$port"
+if [ "$avahiaddr" != "" ] ; then
+ addr="$proto://$avahiaddr:$port or $addr"
+fi
+echo
+echo "Web administration interface is now available at:"
+echo " $addr"
+
diff --git a/recipes-extended/webmin/webmin-notice_1.0.bb b/recipes-extended/webmin/webmin-notice_1.0.bb
new file mode 100644
index 0000000..623bda0
--- /dev/null
+++ b/recipes-extended/webmin/webmin-notice_1.0.bb
@@ -0,0 +1,21 @@
+DESCRIPTION = "Web administration notice script"
+LICENSE = "MIT"
+SRC_URI = "file://webmin-notice.sh"
+LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
+RDEPENDS_${PN} = "webmin"
+
+inherit allarch update-rc.d
+
+INITSCRIPT_NAME = "webmin-notice"
+INITSCRIPT_PARAMS = "start 99 5 3 ."
+
+S = "${WORKDIR}"
+
+do_install() {
+ install -d ${D}${sysconfdir}
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 webmin-notice.sh ${D}${sysconfdir}/init.d/webmin-notice
+}
+
+# No sundry packages
+PACKAGES = "${PN}"