Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Open VPN package #13

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
distrib
packages
native/*/work*
cross/*/work*
spk/*/work*
toolchains/*/work*
local.mk

spk/openvpn/src/.DS_Store

spk/openvpn/.DS_Store

distrib/zlib-1.2.5.tar.gz

distrib/xz-5.0.3.tar.xz

distrib/openvpn-2.2.1.tar.gz

distrib/gcc343_glibc232_88f5281.tgz

distrib/lzo-2.06.tar.gz

distrib/openssl-1.0.0e.tar.gz

distrib/libevent-2.0.15-stable.tar.gz

distrib/curl-7.22.0.tar.bz2

distrib/busybox-1.19.2.tar.bz2

cross/.DS_Store

.DS_Store

.gitignore
19 changes: 19 additions & 0 deletions cross/lzo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

PKG_NAME = lzo
PKG_VERS = 2.06
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = http://www.oberhumer.com/opensource/lzo/download/
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

DEPENDS =

MAINTAINER = [email protected]
HOMEPAGE = http://www.oberhumer.com/opensource/lzo/
COMMENT = LZO is a data compression library which is suitable for data de-/compression in real-time.
LICENSE = GPL v2+

GNU_CONFIGURE = 1
CONFIGURE_ARGS = --enable-shared

include ../../mk/spksrc.cross-cc.mk
3 changes: 3 additions & 0 deletions cross/lzo/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lnk:lib/liblzo2.so
lnk:lib/liblzo2.so.2
lib:lib/liblzo2.so.2.0.0
21 changes: 21 additions & 0 deletions cross/openvpn/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

PKG_NAME = openvpn
PKG_VERS = 2.2.1
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = http://swupdate.openvpn.org/community/releases/
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

DEPENDS = cross/zlib cross/lzo cross/openssl

MAINTAINER = [email protected]
HOMEPAGE = http://openvpn.net/
COMMENT = OpenVPN
LICENSE = OpenVPN support a license under GPLv2 along with a commercial license where appropriate without the restrictions of GPLv2

GNU_CONFIGURE = 1
CONFIGURE_ARGS = --enable-password-save

INSTALL_PREFIX = /usr/local/$(PKG_NAME)

include ../../mk/spksrc.cross-cc.mk
1 change: 1 addition & 0 deletions cross/openvpn/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin:bin/openvpn
1 change: 0 additions & 1 deletion cross/transmission/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


PKG_NAME = transmission
PKG_VERS = 2.42
PKG_EXT = tar.xz
Expand Down
1 change: 0 additions & 1 deletion cross/zlib/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


PKG_NAME = zlib
PKG_VERS = 1.2.5
PKG_EXT = tar.gz
Expand Down
2 changes: 1 addition & 1 deletion cross/zlib/PLIST
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
lnkb:lib/libz.so
lnk:lib/libz.so
lnk:lib/libz.so.1
lib:lib/libz.so.1.2.5
34 changes: 34 additions & 0 deletions spk/openvpn/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

SPK_NAME = openvpn
SPK_VERS = 2.2.1
SPK_REV = 1
SPK_ICON = src/openvpn.png

DEPENDS = cross/$(SPK_NAME)

MAINTAINER = botho
COMMENT = "OpenVPN $(SPK_VERS)"
RELOAD_UI = no
DISPLAY_NAME = OpenVPN

HOMEPAGE = http://openvpn.net/
LICENSE = OpenVPN support a license under GPLv2 along with a commercial license where appropriate without the restrictions of GPLv2

INSTALLER_SCRIPT = src/installer.sh
SSS_SCRIPT = src/dsm-control.sh
ADDITIONAL_SCRIPTS =

INSTALL_PREFIX = /usr/local/$(SPK_NAME)
PRE_COPY_TARGET = install-openvpn

include ../../mk/spksrc.spk.mk

.PHONY: install-openvpn
install-openvpn:
@$(MSG) "=========== PACKAGING OPENVPN ===================="
install -m 755 -d $(STAGING_DIR)/var
install -m 755 -d $(STAGING_DIR)/keys
install -m 644 src/var/*.* $(STAGING_DIR)/var/
install -m 755 -d $(STAGING_DIR)/bin
install -m 755 -d $(STAGING_DIR)/keys
install -m 755 $(INSTALL_DIR)/usr/local/openvpn/sbin/openvpn $(STAGING_DIR)/bin/
Empty file added spk/openvpn/PLIST
Empty file.
148 changes: 148 additions & 0 deletions spk/openvpn/src/dsm-control.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
#!/bin/sh

PATH=/bin:/sbin:/usr/bin

DAEMON="/usr/local/openvpn/bin/openvpn"
CONFIG_DIR="/usr/local/var/openvpn"
CONF_FILE="/usr/local/var/openvpn/client.conf"
DAEMONARG="--daemon openvpn"
PIDFILE="/usr/local/var/openvpn/openvpn.pid"
LOG_FILE="/usr/local/var/openvpn/openvpn.log"

test -x $DAEMON || exit 0
test -d $CONFIG_DIR || exit 0

daemon_status ()
{
if [ -f $PIDFILE ]
then
if [ -d /proc/`cat $PIDFILE` ]
then
return 0
else
# PID file exists, but no process has this PID.
rm $PIDFILE
fi
fi
return 1
}

start_daemon ()
{
# Make sure IP forwarding is enabled
echo 1 > /proc/sys/net/ipv4/ip_forward

# Make device if not present (not devfs)
if [ ! -c /dev/net/tun ]
then
# Make /dev/net directory if needed
if [ ! -d /dev/net ]
then
mkdir -m 755 /dev/net
fi
mknod /dev/net/tun c 10 200
fi

# Make sure the tunnel driver is loaded
if !(lsmod | grep -q "^tun")
then
insmod /lib/modules/tun.ko
fi

echo -n "Starting openvpn, please wait ... "
$DAEMON --writepid $PIDFILE --config $CONF_FILE $DAEMONARG --cd $CONFIG_DIR

# Wait until openvpn is ready.
counter=5
while [ $counter -gt 0 ]
do
daemon_status && break
let counter=counter-1
sleep 1
done

sleep 5
ifconfig
echo "Done."
}

stop_daemon ()
{
echo -n "Stopping openvpn daemon, please wait ... "

# Kill openvpn.
PID=`cat $PIDFILE`
kill $PID
rm $PIDFILE

# Wait until openvpn is really dead (may take some time).
counter=20
while [ $counter -gt 0 ]
do
daemon_status || break
let counter=counter-1
sleep 1
done

sleep 5
ifconfig
echo "Done."
}

reload_daemon ()
{
kill -s HUP `cat $PIDFILE`
}


case "$1" in
start)
if daemon_status
then
echo -n "openvpn daemon is already running"
exit 0
else
start_daemon
exit $?
fi
;;
stop)
if daemon_status
then
stop_daemon
exit 0
else
exit $?
fi
;;
restart)
stop_daemon
start_daemon
exit $?
;;
reload)
if daemon_status
then
reload_daemon
fi
exit $?
;;
status)
if daemon_status
then
echo Running
exit 0
else
echo Not running
exit 1
fi
;;
log)
echo "${LOG_FILE}"
exit 0
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status|log}" >&2
exit 1
;;
esac
73 changes: 73 additions & 0 deletions spk/openvpn/src/installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/sh

#########################################
# A few variables to make things readable

# Package specific variables
PACKAGE="openvpn"
DNAME="OpenVPN 2.2.1"

# Common variables
INSTALL_DIR="/usr/local/${PACKAGE}"
VAR_DIR="/usr/local/var/${PACKAGE}"
UPGRADELOCK="/tmp/${PACKAGE}.upgrade.lock"
PATH="${INSTALL_DIR}/bin:/bin:/usr/bin" # Avoid ipkg commands

#########################################
# DSM package manager functions

preinst ()
{
exit 0
}

postinst ()
{
# Installation directories
mkdir -p ${INSTALL_DIR}
mkdir -p ${INSTALL_DIR}/bin
mkdir -p ${VAR_DIR}

# Create symlink
ln -s ${SYNOPKG_PKGDEST}/bin/openvpn ${INSTALL_DIR}/bin/openvpn
ln -s ${SYNOPKG_PKGDEST}/lib ${INSTALL_DIR}/lib
ln -s ${SYNOPKG_PKGDEST}/keys ${INSTALL_DIR}/keys
ln -s ${SYNOPKG_PKGDEST}/var/client.conf ${VAR_DIR}/client.conf
ln -s ${SYNOPKG_PKGDEST}/var/server.conf ${VAR_DIR}/server.conf

# Correct the files ownership (need to be change in a future release by a dedicated user)
chown -R root:root ${SYNOPKG_PKGDEST}

# Correct the files permission
chmod 755 ${SYNOPKG_PKGDEST}/bin/*
chmod 666 ${SYNOPKG_PKGDEST}/var/*.conf

exit 0
}

preuninst ()
{

exit 0
}

postuninst ()
{
# Remove the installation directory
rm -fr ${INSTALL_DIR}
rm -fr ${VAR_DIR}

exit 0
}

preupgrade ()
{
touch $UPGRADELOCK
exit 0
}

postupgrade ()
{
rm -f $UPGRADELOCK
exit 0
}
Binary file added spk/openvpn/src/openvpn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions spk/openvpn/src/var/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Sample OpenVPN Configuration Files.

These files are part of the OpenVPN HOWTO
which is located at:

http://openvpn.net/howto.html
Loading