Update ChaosVPN

done by Haegar
add init script
update to version 2.0



git-svn-id: svn://svn.openwrt.org/openwrt/packages@22831 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
ryd 2010-08-29 12:38:00 +00:00
parent c7e344705f
commit ca799d93a3
4 changed files with 59 additions and 26 deletions

View File

@ -1,27 +1,20 @@
#
# Copyright (C) 2006-2008 OpenWrt.org
# Copyright (C) 2010 OpenWrt.org
# All rights reserved.
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: Makefile 12693 2008-09-25 10:47:39Z nico $
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=chaosvpn
PKG_VERSION:=2.0-rc11
PKG_MD5SUM:=8c5c9ee78151d521492ceeb41a812456
PKG_REV:=2.0-rc11
PKG_RELEASE:=1
PKG_VERSION:=2.0
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=git://github.com/ryd/chaosvpn.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/${PKG_NAME}-$(PKG_VERSION)
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
PKG_SOURCE:=${PKG_NAME}-${PKG_VERSION}.tar.gz
PKG_SOURCE_URL:=http://github.com/downloads/ryd/chaosvpn/
PKG_MD5SUM:=4263202d65bf4ab0d1356b149d7c53af
include $(INCLUDE_DIR)/package.mk
@ -29,9 +22,9 @@ define Package/chaosvpn
SECTION:=net
CATEGORY:=Network
TITLE:=Config generator for chaos vpn
DEPENDS:=+ip +tinc +kmod-tun +libopenssl
URL:=https://wiki.hamburg.ccc.de/index.php/ChaosVPN::DebianHowto
MAINTAINER:=Christopher J. Pilkington <cjp@0x1.net>
URL:=http://github.com/ryd/chaosvpn
DEPENDS:=+tinc +kmod-tun +ip +libopenssl
endef
define Package/chaosvpn/description
@ -41,15 +34,21 @@ endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \
COPT="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/lib" \
LIB="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib -Wl,-rpath-link,$(STAGING_DIR)/usr/lib"
CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/lib" \
LIB="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib -lz -lcrypto -Wl,-rpath-link,$(STAGING_DIR)/usr/lib" \
INCLUDES="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
LIBDIRS="-L$(STAGING_DIR)/usr/lib"
endef
define Package/chaosvpn/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/tinc/chaos/ $(1)/usr/sbin/ $(1)/etc/init.d/ $(1)/etc/hotplug.d/iface/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/chaosvpn $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/tinc
$(INSTALL_BIN) $(PKG_BUILD_DIR)/chaosvpn.conf $(1)/etc/tinc/chaosvpn.conf.sample
#$(INSTALL_DATA) $(PKG_BUILD_DIR)/chaosvpn.conf $(1)/etc/tinc/
sed -e 's/"\/sbin\/ip /"\/usr\/sbin\/ip /' <$(PKG_BUILD_DIR)/chaosvpn.conf >$(1)/etc/tinc/chaosvpn.conf
$(INSTALL_BIN) ./files/chaosvpn_config.sh $(1)/usr/sbin/
$(INSTALL_BIN) ./files/chaosvpn.init $(1)/etc/init.d/chaosvpn
$(INSTALL_BIN) ./files/chaosvpn.hotplug $(1)/etc/hotplug.d/iface/40-chaosvpn
endef
$(eval $(call BuildPackage,chaosvpn))

View File

@ -0,0 +1,3 @@
[ "$INTERFACE" == "wan" ] || return
[ "$ACTION" == "ifup" ] && /etc/init.d/chaosvpn restart

View File

@ -0,0 +1,17 @@
#!/bin/sh /etc/rc.common
START=99
start()
{
/usr/sbin/chaosvpn_config.sh
[ $? = 0 ] || {
logger "not starting chaosvpn, check your config"
exit 1
}
/usr/sbin/chaosvpn -f -c /etc/tinc/chaosvpn.conf >/dev/null 2>&1 &
}
stop()
{
killall chaosvpn
}

View File

@ -0,0 +1,14 @@
#!/bin/sh
[ -f "/etc/tinc/chaos/rsa_key.pub" -a -f "/etc/tinc/chaos/rsa_key.priv" ] || {
echo "please generate rsa key pair"
echo "tincd -n chaos --generate-keys=2048"
exit 1
}
C=`grep unconfigured_please_change_me /etc/tinc/chaosvpn.conf | wc -l`
[ "$C" = "0" ] || {
echo "/etc/tinc/chaosvpn.conf is not configured yet"
exit 1
}
exit 0