summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuli Suominen <ssuominen@gentoo.org>2009-07-30 10:10:12 +0000
committerSamuli Suominen <ssuominen@gentoo.org>2009-07-30 10:10:12 +0000
commit7d381bc8bad4281225dcff10cfcba5901a596011 (patch)
treedc83d0c34426336132934e04d283b0373858ba62 /net-misc
parentMask mplayerplug-in for removal wrt #273121. (diff)
downloadgentoo-2-7d381bc8bad4281225dcff10cfcba5901a596011.tar.gz
gentoo-2-7d381bc8bad4281225dcff10cfcba5901a596011.tar.bz2
gentoo-2-7d381bc8bad4281225dcff10cfcba5901a596011.zip
Make init script POSIX wrt #279058, thanks to Michał Górny.
(Portage version: 2.2_rc33/cvs/Linux x86_64)
Diffstat (limited to 'net-misc')
-rw-r--r--net-misc/hamachi/ChangeLog10
-rw-r--r--net-misc/hamachi/files/hamachi.initd.265
-rw-r--r--net-misc/hamachi/hamachi-0.9.9.9_p20-r3.ebuild107
3 files changed, 180 insertions, 2 deletions
diff --git a/net-misc/hamachi/ChangeLog b/net-misc/hamachi/ChangeLog
index dc7e3c70a1a7..2bef531675f8 100644
--- a/net-misc/hamachi/ChangeLog
+++ b/net-misc/hamachi/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for net-misc/hamachi
-# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/hamachi/ChangeLog,v 1.9 2008/09/10 15:58:53 darkside Exp $
+# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/hamachi/ChangeLog,v 1.10 2009/07/30 10:10:11 ssuominen Exp $
+
+*hamachi-0.9.9.9_p20-r3 (30 Jul 2009)
+
+ 30 Jul 2009; Samuli Suominen <ssuominen@gentoo.org>
+ +hamachi-0.9.9.9_p20-r3.ebuild, +files/hamachi.initd.2:
+ Make init script POSIX wrt #279058, thanks to Michał Górny.
10 Sep 2008; Jeremy Olexa <darkside@gentoo.org>
hamachi-0.9.9.9_p20-r2.ebuild:
diff --git a/net-misc/hamachi/files/hamachi.initd.2 b/net-misc/hamachi/files/hamachi.initd.2
new file mode 100644
index 000000000000..1c03d2b38438
--- /dev/null
+++ b/net-misc/hamachi/files/hamachi.initd.2
@@ -0,0 +1,65 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+opts="start stop status init"
+
+depend() {
+ need net tuncfg
+}
+
+start() {
+ check_config
+ ebegin "Starting hamachi"
+
+ start-stop-daemon --quiet --start -c "${USER}" \
+ --exec /usr/bin/hamachi -- \
+ -c "${CONFDIR}" start 2>&1 >"${LOG}"
+ result=$?
+
+ if [ ${result} -eq 0 ]; then
+ chown "${USER}:${GROUP}" "${CONFDIR}"/ipc_sock
+ chmod g+rwx "${CONFDIR}"/ipc_sock
+
+ /usr/bin/hamachi -c "${CONFDIR}" login
+ if [ -z "$(/usr/bin/hamachi -c "${CONFDIR}" | grep 'logged in')" ]; then
+ result=1
+ /usr/bin/hamachi -c "${CONFDIR}" stop 2>&1 >"${LOG}"
+ fi
+ fi
+
+ eend ${result}
+}
+
+stop() {
+ ebegin "Stopping hamachi"
+
+ /usr/bin/hamachi -c "${CONFDIR}" logout 2>&1 >"${LOG}"
+ /usr/bin/hamachi -c "${CONFDIR}" stop 2>&1 >"${LOG}"
+
+ eend $?
+}
+
+init() {
+ ebegin "Making initial configuration"
+
+ /usr/bin/hamachi-init -c "${CONFDIR}" 2>&1 >/dev/null
+ result=$?
+ chown -R "${USER}:${GROUP}" "${CONFDIR}"
+ chmod g+rx "${CONFDIR}"
+
+ eend ${result}
+}
+
+check_config() {
+ if [ ! -d "${CONFDIR}" ]; then
+ einfo "It seems you don't have configured hamachi yet. Running init now"
+ init
+ fi
+}
+
+status() {
+ service_started "${SVCNAME}" || return 1
+ /usr/bin/hamachi -c "${CONFDIR}"
+ /usr/bin/hamachi -c "${CONFDIR}" list
+}
diff --git a/net-misc/hamachi/hamachi-0.9.9.9_p20-r3.ebuild b/net-misc/hamachi/hamachi-0.9.9.9_p20-r3.ebuild
new file mode 100644
index 000000000000..17be974bd25e
--- /dev/null
+++ b/net-misc/hamachi/hamachi-0.9.9.9_p20-r3.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/hamachi/hamachi-0.9.9.9_p20-r3.ebuild,v 1.1 2009/07/30 10:10:11 ssuominen Exp $
+
+inherit eutils linux-info
+
+# gHamachi GUI
+
+MY_PV=${PV/_p/-}
+MY_P=${PN}-${MY_PV}-lnx
+
+DESCRIPTION="Hamachi is a secure mediated peer to peer."
+HOMEPAGE="http://hamachi.cc"
+LICENSE="as-is"
+SRC_URI=" !pentium? ( http://files.hamachi.cc/linux/${MY_P}.tar.gz )
+ pentium? ( http://files.hamachi.cc/linux/${MY_P}-pentium.tar.gz )"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE="pentium"
+RESTRICT="strip mirror"
+
+# Set workdir for both hamachi versions
+if use pentium; then
+ S=${WORKDIR}/${MY_P}-pentium
+else
+ S=${WORKDIR}/${MY_P}
+fi
+
+pkg_preinst() {
+ # Add group "hamachi" & user "hamachi"
+ enewgroup ${PN}
+ enewuser ${PN} -1 -1 /dev/null ${PN}
+}
+
+pkg_setup() {
+ einfo "Checking your kernel configuration for TUN/TAP support."
+ CONFIG_CHECK="TUN"
+ check_extra_config
+}
+
+src_unpack() {
+ # Unpack the correct Hamachi version
+ if use !pentium; then
+ unpack ${MY_P}.tar.gz
+ else
+ unpack ${MY_P}-pentium.tar.gz
+ fi
+}
+
+src_compile() {
+ # Compile Tuncfg
+ make -sC "${S}"/tuncfg || die "Compiling of tunecfg failed"
+}
+
+src_install() {
+ # Hamachi
+ einfo "Installing Hamachi"
+ insinto /usr/bin
+ insopts -m0755
+ doins hamachi
+ dosym /usr/bin/hamachi /usr/bin/hamachi-init
+
+ # Tuncfg
+ einfo "Installing Tuncfg"
+ insinto /usr/sbin
+ insopts -m0700
+ doins tuncfg/tuncfg
+
+ # Create log directory
+ dodir /var/log/${PN}
+
+ # Config files
+ einfo "Installing config files"
+ newinitd "${FILESDIR}"/tuncfg.initd.2 tuncfg
+ newconfd "${FILESDIR}"/hamachi.confd hamachi
+ newinitd "${FILESDIR}"/hamachi.initd hamachi
+
+ # Docs
+ dodoc CHANGES README LICENSE LICENSE.openssh LICENSE.openssl LICENSE.tuncfg
+
+}
+
+pkg_postinst() {
+ if use pentium; then
+ einfo "Remember, you set the pentium USE flag!"
+ einfo So, you installed the version for older x86 systems!
+ einfo If your CPU is greater than Intel Pentium / AMD K6,
+ einfo remove the pentium USE flag and try this version!
+ fi
+
+ if use !pentium; then
+ ewarn "If you are seeing 'illegal instruction' error when trying"
+ ewarn "to run Hamachi client, set the pentium USE flag!"
+ ewarn "It enables binaries built specifically for older"
+ ewarn "x86 platforms, like Intel Pentium or AMD K6,"
+ ewarn "with all optimizations turned off."
+ fi
+
+ einfo "To start Hamachi just type:"
+ einfo "/etc/init.d/hamachi start"
+
+ # added for bug #218481
+ einfo "If the 'hamachi' command shows no output, use the following command"
+ einfo "to extract the hamachi executable either with app-arch/upx or"
+ einfo "app-arch/upx-ucl:"
+ einfo "/opt/bin/upx -d /usr/bin/hamachi"
+}