Commit 24d247e6 authored by chenhaowen's avatar chenhaowen

remove files for openwrt

parent fed8fb6e
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/package.mk
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
PKG_NAME:=gdut-drcom
# Version: 1.0-1
PKG_VERSION:=1.6
PKG_RELEASE:=0
PKG_MAINTAINER:=CHW
# PKG_SOURCE_URL:=
define Package/gdut-drcom
SECTION:=utils
CATEGORY:=Utilities
DEFAULT:=y
TITLE:=gdut-drcom -- a third-party drcom client for gdut
# DEPENDS:=+libgcrypt
# DEPENDS:=+libopenssl
# DEPENDS:=+libpolarssl
endef
define Build/Prepare
@echo "############## Build/Prepare"
$(Build/Prepare/Default)
$(CP) ./src/* $(PKG_BUILD_DIR)
endef
define Build/Compile
@echo "############## Build/Compile"
export CFLAGS="$CFLAGS -DDEBUG"
# $(call Build/Compile/Default, cryptlib=openssl)
$(call Build/Compile/Default)
endef
define Package/gdut-drcom/postinst
#!/bin/sh
echo "post install: patching ppp.sh"
sed -i '/#added by gdut-drcom/d' /lib/netifd/proto/ppp.sh
sed -i '/proto_run_command/i username=$$(echo -e "\\r\\n$$username") #added by gdut-drcom!' /lib/netifd/proto/ppp.sh
echo "patched!"
endef
define Package/gdut-drcom/prerm
#!/bin/sh
echo "pre remove: unpatching ppp.sh!"
sed -i '/#added by gdut-drcom/d' /lib/netifd/proto/ppp.sh
echo "unpatched!"
endef
define Package/gdut-drcom/install
@echo "############## Package/gdut-drcom/install"
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/gdut-drcom $(1)/usr/bin
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DATA) $(PKG_BUILD_DIR)/root/etc/gdut-drcom.conf $(1)/etc
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/root/etc/init.d/gdut-drcom $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) $(PKG_BUILD_DIR)/root/etc/config/gdut_drcom $(1)/etc/config
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
$(INSTALL_DATA) $(PKG_BUILD_DIR)/root/usr/lib/lua/luci/controller/gdut-drcom.lua $(1)/usr/lib/lua/luci/controller
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi
$(INSTALL_DATA) $(PKG_BUILD_DIR)/root/usr/lib/lua/luci/model/cbi/gdut-drcom.lua $(1)/usr/lib/lua/luci/model/cbi
endef
$(eval $(call BuildPackage,gdut-drcom))
#CC:=gcc
CFLAGS+= -Wall -fPIC -DDEBUG -DVERSION=\"1.6-0\"
VERSION:=1.6.0
CFLAGS+= -Wall -fPIC -DDEBUG -DVERSION=\"$(VERSION)\"
objects= config.o auth.o
......@@ -32,6 +33,12 @@ gdut-drcom: $(objects) gdut-drcom.o
dll: $(objects)
$(CC) -shared $(objects) -o $(DLLNAME) $(CFLAGS) $(LIBS)
tarball: *.c *.h
mkdir ../gdut-drcom
cp -r * ../gdut-drcom
tar cvjf ../release/gdut-drcom-$(VERSION).tar.bz2 * -C ../gdut-drcom
rm -r ../gdut-drcom
gdut-drcom.o: gdut-drcom.c
$(CC) $(CFLAGS) -c $<
......
# config file of gdut-drcom
remote_ip = 10.0.3.2
#remote_root = 61440 #leave as default
keep_alive1_flag = 2a
......
config gdut_drcom
option remote_ip '10.0.3.2'
option keep_alive1_flag '2a'
option enable '1'
option enable_crypt '0'
#!/bin/sh /etc/rc.common
#(c) 2010 ivan_wl
START=99
start() {
remote_ip=$(uci get gdut_drcom.@gdut_drcom[0].remote_ip 2>/dev/null)
keep_alive1_flag=$(uci get gdut_drcom.@gdut_drcom[0].keep_alive1_flag 2>/dev/null)
enable=$(uci get gdut_drcom.@gdut_drcom[0].enable 2>/dev/null)
# enable_dial=$(uci get gdut_drcom.@gdut_drcom[0].enable_dial 2>/dev/null)
# ifname=$(uci get gdut_drcom.@gdut_drcom[0].ifname 2>/dev/null)
# username=$(uci get gdut_drcom.@gdut_drcom[0].username 2>/dev/null)
# password=$(uci get gdut_drcom.@gdut_drcom[0].password 2>/dev/null)
macaddr=$(uci get gdut_drcom.@gdut_drcom[0].macaddr 2>/dev/null)
enable_crypt=$(uci get gdut_drcom.@gdut_drcom[0].enable_crypt 2>/dev/null)
if [ "$enable"x = "1"x ]; then
/etc/init.d/gdut-drcom enable
else
/etc/init.d/gdut-drcom disable
return
fi
# if [ "$enable_dial"x = "1"x ]; then
# uci set network.wan.ifname="$ifname"
# uci set network.wan.proto="pppoe"
# uci set network.wan.username="$username"
# uci set network.wan.password="$password"
# uci set network.wan._orig_ifname='eth0.2'
# uci set network.wan._orig_bridge='false'
# uci commit
# /etc/init.d/network restart
# fi
if [ -n "$macaddr" ]; then
uci set network.wan.macaddr="$macaddr"
uci commit
# /etc/init.d/network restart
fi
cmd="service_start /usr/bin/gdut-drcom -c /etc/gdut-drcom.conf "
if [ -n "$remote_ip" ]; then
cmd=$cmd"--remote-ip=$remote_ip "
fi
if [ -n "$keep_alive1_flag" ]; then
cmd=$cmd"--keep-alive1-flag=$keep_alive1_flag "
fi
if [ "$enable_crypt"x = "1"x ]; then
cmd=$cmd"--enable-crypt "
fi
cmd=$cmd"1> /tmp/gdut-drcom.log 2>/tmp/gdut-drcom_error.log &"
eval $cmd
}
stop()
{
service_stop /usr/bin/gdut-drcom
return 0
}
module("luci.controller.gdut-drcom", package.seeall)
function index()
entry({"admin", "network", "gdut-drcom"}, cbi("gdut-drcom"), _("gdut-drcom client"), 100)
end
--[[
LuCI - Lua Configuration Interface
Copyright 2010 Jo-Philipp Wich <xm@subsignal.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
]]--
require("luci.sys")
m = Map("gdut_drcom", translate("gdut-drcom Client"), translate("Configure gdut-drcom client."))
s = m:section(TypedSection, "gdut_drcom", "")
s.addremove = false
s.anonymous = true
enable = s:option(Flag, "enable", translate("Enable"))
--[[enabledial = s:option(Flag, "enabledial", translate("Enable PPPoE Dial"))
enabledial.default = enabledial.enabled
ifname = s:option(ListValue, "ifname", translate("Interface name"))
ifname:depends("enabledial", "1")
for k, v in ipairs(luci.sys.net.devices()) do
if string.sub(v,0,3) == "eth" then
ifname:value(v)
end
end
username = s:option(Value, "username", translate("Username"))
username:depends("enabledial", "1")
password = s:option(Value, "password", translate("Password"))
password:depends("enabledial", "1")
password.password = true
]]--
macaddr = s:option(Value, "macaddr", translate("Mac address"))
macaddr.datatype="macaddr"
remote_ip = s:option(Value, "remote_ip", translate("Remote ip"))
remote_ip.datatype="ipaddr"
keep_alive_flag = s:option(Value, "keep_alive1_flag", translate("Keep alive1 flag"))
enable_crypt = s:option(Flag, "enable_crypt", translate("Enable crypt"))
local apply = luci.http.formvalue("cbi.apply")
if apply then
io.popen("/etc/init.d/gdut-drcom restart")
end
return m
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment