Skip to content

Instantly share code, notes, and snippets.

@pkern

pkern/Makefile

Last active Oct 28, 2020
Embed
What would you like to do?
OpenWRT package for sniproxy
include $(TOPDIR)/rules.mk
PKG_NAME:=sniproxy
PKG_VERSION:=0.6.0
PKG_RELEASE:=1
PKG_SOURCE_URL:=https://github.com/dlundquist/sniproxy/archive/
PKG_SOURCE:=$(PKG_VERSION).tar.gz
PKG_MD5SUM:=bcfb5d1efe045b8b356a4229f2339f02
PKG_MAINTAINER:=Philipp Kern <pkern@debian.org>
include $(INCLUDE_DIR)/package.mk
define Package/sniproxy
SECTION:=net
CATEGORY:=Network
TITLE:=Transparent TLS and HTTP layer 4 proxy with SNI support
URL:=https://github.com/dlundquist/sniproxy
DEPENDS:=+libev +libpcre
endef
define Package/sniproxy/description
Transparent TLS and HTTP layer 4 proxy with SNI support
Proxies incoming HTTP and TLS connections based on the hostname contained in
the initial request of the TCP session. This enables HTTPS name-based virtual
hosting to separate backend servers without installing the private key on the
proxy machine.
endef
define Build/Configure
( cd $(PKG_BUILD_DIR) && ./autogen.sh )
$(call Build/Configure/Default)
endef
TARGET_CFLAGS+=-std=c99
PKG_INSTALL:=1
define Package/sniproxy/install
$(INSTALL_DIR) $(1)/usr/sbin
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/$(PKG_NAME) $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/sniproxy.init $(1)/etc/init.d/sniproxy
endef
define Package/sniproxy/postinst
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Enabling rc.d symlink for $(PKG_NAME)"
/etc/init.d/$(PKG_NAME) enable
fi
exit 0
endef
define Package/sniproxy/prerm
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Removing rc.d symlink for $(PKG_NAME)"
/etc/init.d/$(PKG_NAME) disable
fi
exit 0
endef
$(eval $(call BuildPackage,sniproxy))
#!/bin/sh /etc/rc.common
START=80
APP=sniproxy
SERVICE_WRITE_PID=1
SERVICE_DAEMONIZE=1
start() {
service_start /usr/sbin/$APP
}
stop() {
service_stop /usr/sbin/$APP
}
@pkern

This comment has been minimized.

Copy link
Owner Author

@pkern pkern commented Oct 28, 2020

Thanks, updated!

@sigio

This comment has been minimized.

Copy link

@sigio sigio commented Oct 28, 2020

Also linked here from an openwrt issue looking to package sniproxy (but that issue is 2 years old :P )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment