summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrochner <drochner@pkgsrc.org>2012-02-24 15:26:28 +0000
committerdrochner <drochner@pkgsrc.org>2012-02-24 15:26:28 +0000
commitd2de3357cc2815c413c3548110bf0d2ef13ae3d1 (patch)
tree7aa7c53b0c7b311a6554bea838bdecc61a0fe704
parentb7ee50c3b832278e9f789cfb1aa54eddbe235a42 (diff)
downloadpkgsrc-d2de3357cc2815c413c3548110bf0d2ef13ae3d1.tar.gz
add an example rc.d script which sets the hostname to the xen domain name
-rw-r--r--sysutils/xenstoretools/Makefile5
-rw-r--r--sysutils/xenstoretools/PLIST3
-rw-r--r--sysutils/xenstoretools/files/xendomname.sh26
3 files changed, 32 insertions, 2 deletions
diff --git a/sysutils/xenstoretools/Makefile b/sysutils/xenstoretools/Makefile
index e371aec68d0..a9f0d8f9396 100644
--- a/sysutils/xenstoretools/Makefile
+++ b/sysutils/xenstoretools/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1.1.1 2011/10/03 16:55:34 sborrill Exp $
+# $NetBSD: Makefile,v 1.2 2012/02/24 15:26:28 drochner Exp $
#
# VERSION is set in xentool41/version.mk
@@ -40,6 +40,9 @@ MAKE_ENV+= PREFIX=${prefix:Q} WRKSRC=${WRKSRC}
MAKE_ENV+= MV=${MV:Q} PYTHON=${PYTHONBIN:Q} SED=${SED:Q}
MAKE_ENV+= VARBASE=${VARBASE}
+RCD_SCRIPTS= xendomname
+FILES_SUBST+= PREFIX=${PREFIX:Q}
+
.include "../../mk/bsd.prefs.mk"
INSTALLATION_DIRS= bin lib
diff --git a/sysutils/xenstoretools/PLIST b/sysutils/xenstoretools/PLIST
index 6542cb67876..aab6b0f9f72 100644
--- a/sysutils/xenstoretools/PLIST
+++ b/sysutils/xenstoretools/PLIST
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.1.1.1 2011/10/03 16:55:34 sborrill Exp $
+@comment $NetBSD: PLIST,v 1.2 2012/02/24 15:26:28 drochner Exp $
bin/xenstore
bin/xenstore-chmod
bin/xenstore-control
@@ -12,3 +12,4 @@ bin/xenstore-write
lib/libxenstore.so
lib/libxenstore.so.3.0
lib/libxenstore.so.3.0.0
+share/examples/rc.d/xendomname
diff --git a/sysutils/xenstoretools/files/xendomname.sh b/sysutils/xenstoretools/files/xendomname.sh
new file mode 100644
index 00000000000..6f37a9414a8
--- /dev/null
+++ b/sysutils/xenstoretools/files/xendomname.sh
@@ -0,0 +1,26 @@
+#!@RCD_SCRIPTS_SHELL@
+
+# PROVIDE: xendomname
+# REQUIRE: network mountcritlocal
+# BEFORE: dhcpcd
+#
+# Sets the hostname to the xen domain name
+# (dhcpcd can pick it up and send it to the DHCP server.)
+#
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name=xendomname
+rcvar=$name
+start_cmd="xendomname_start"
+
+xendomname_start()
+{
+ mount /kern || true
+ dname="`@PREFIX@/bin/xenstore-read name`"
+ echo "Setting hostname to xen domain name: $dname"
+ hostname "$dname"
+}
+
+load_rc_config $name
+run_rc_command "$1"