Browse Source

Merge pull request #50 from nanpuyue/patch-1

refine openwrt build / init scripts
pull/52/head
Max Lv 10 years ago
parent
commit
40ea3f690b
2 changed files with 14 additions and 14 deletions
  1. 16
      openwrt/Makefile
  2. 12
      openwrt/files/shadowsocks.init

16
openwrt/Makefile

@ -11,9 +11,10 @@ PKG_SOURCE_VERSION:=69f8bd61c096337abb34a9e64534865d08022957
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MAINTAINER:=Max Lv <max.c.lv@gmail.com> PKG_MAINTAINER:=Max Lv <max.c.lv@gmail.com>
PKG_INSTALL:=1
PKG_FIXUP:=autoreconf
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
PKG_INSTALL:=1
PKG_FIXUP:=autoreconf
PKG_BUILD_PARALLEL:=1 PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
@ -46,7 +47,7 @@ endef
Package/shadowsocks-libev-polarssl/description=$(Package/shadowsocks-libev/description) Package/shadowsocks-libev-polarssl/description=$(Package/shadowsocks-libev/description)
define Package/shadowsocks-libev/conffiles define Package/shadowsocks-libev/conffiles
/etc/config/shadowsocks.json
/etc/shadowsocks.json
endef endef
ifeq ($(BUILD_VARIANT),polarssl) ifeq ($(BUILD_VARIANT),polarssl)
@ -54,12 +55,11 @@ ifeq ($(BUILD_VARIANT),polarssl)
endif endif
define Package/shadowsocks-libev/install define Package/shadowsocks-libev/install
$(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d $(1)/etc/config
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ss-local $(1)/usr/bin/ss-local
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ss-redir $(1)/usr/bin/ss-redir
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ss-tunnel $(1)/usr/bin/ss-tunnel
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_CONF) ./files/shadowsocks.json $(1)/etc
$(INSTALL_BIN) ./files/shadowsocks.init $(1)/etc/init.d/shadowsocks $(INSTALL_BIN) ./files/shadowsocks.init $(1)/etc/init.d/shadowsocks
$(INSTALL_CONF) ./files/shadowsocks.json $(1)/etc/config/shadowsocks.json
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ss-{local,redir,tunnel} $(1)/usr/bin
endef endef
Package/shadowsocks-libev-polarssl/install=$(Package/shadowsocks-libev/install) Package/shadowsocks-libev-polarssl/install=$(Package/shadowsocks-libev/install)

12
openwrt/files/shadowsocks.init

@ -2,15 +2,15 @@
# Copyright (C) 2006-2011 OpenWrt.org # Copyright (C) 2006-2011 OpenWrt.org
START=95 START=95
STOP=95
SERVICE_USE_PID=1
SERVICE_WRITE_PID=1
SERVICE_DAEMONIZE=1
start() { start() {
echo "starting shadowsocks..."
/usr/bin/ss-local -c /etc/config/shadowsocks.json -f /var/run/shadowsocks.pid
service_start /usr/bin/ss-local -c /etc/shadowsocks.json
} }
stop() { stop() {
echo "shadowsocks stopped."
kill -9 `cat /var/run/shadowsocks.pid`
service_stop /usr/bin/ss-local
} }
Loading…
Cancel
Save