From d27dad8d2b7c71cf580baf42a00565d8f2294996 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Fri, 27 Oct 2017 11:47:42 +0800 Subject: [PATCH] add lucii-app-oscam and oscam for SATV --- package/lean/luci-app-oscam/Makefile | 19 ++ .../luasrc/controller/admin/sattv.lua | 16 ++ .../luasrc/model/cbi/sattv/epg.lua | 50 +++++ .../luasrc/model/cbi/sattv/oscam.lua | 67 ++++++ .../lean/luci-app-oscam/root/etc/config/epg | 13 ++ .../lean/luci-app-oscam/root/etc/config/oscam | 4 + .../lean/luci-app-oscam/root/etc/init.d/epg | 23 ++ .../lean/luci-app-oscam/root/etc/init.d/oscam | 70 ++++++ .../luci-app-oscam/root/etc/oscam/oscam.conf | 39 ++++ .../root/etc/oscam/oscam.server | 28 +++ .../luci-app-oscam/root/etc/oscam/oscam.user | 6 + .../root/etc/uci-defaults/luci-sattv | 14 ++ package/lean/luci-app-oscam/root/usr/bin/epg | 199 ++++++++++++++++++ .../luci-app-oscam/root/usr/oscam/oscam.conf | 37 ++++ package/lean/oscam/Makefile | 71 +++++++ 15 files changed, 656 insertions(+) create mode 100644 package/lean/luci-app-oscam/Makefile create mode 100644 package/lean/luci-app-oscam/luasrc/controller/admin/sattv.lua create mode 100644 package/lean/luci-app-oscam/luasrc/model/cbi/sattv/epg.lua create mode 100644 package/lean/luci-app-oscam/luasrc/model/cbi/sattv/oscam.lua create mode 100644 package/lean/luci-app-oscam/root/etc/config/epg create mode 100644 package/lean/luci-app-oscam/root/etc/config/oscam create mode 100755 package/lean/luci-app-oscam/root/etc/init.d/epg create mode 100755 package/lean/luci-app-oscam/root/etc/init.d/oscam create mode 100644 package/lean/luci-app-oscam/root/etc/oscam/oscam.conf create mode 100644 package/lean/luci-app-oscam/root/etc/oscam/oscam.server create mode 100644 package/lean/luci-app-oscam/root/etc/oscam/oscam.user create mode 100644 package/lean/luci-app-oscam/root/etc/uci-defaults/luci-sattv create mode 100755 package/lean/luci-app-oscam/root/usr/bin/epg create mode 100644 package/lean/luci-app-oscam/root/usr/oscam/oscam.conf create mode 100644 package/lean/oscam/Makefile diff --git a/package/lean/luci-app-oscam/Makefile b/package/lean/luci-app-oscam/Makefile new file mode 100644 index 000000000..70a12e865 --- /dev/null +++ b/package/lean/luci-app-oscam/Makefile @@ -0,0 +1,19 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI for OSCAM +LUCI_DEPENDS:=+oscam +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=1 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/package/lean/luci-app-oscam/luasrc/controller/admin/sattv.lua b/package/lean/luci-app-oscam/luasrc/controller/admin/sattv.lua new file mode 100644 index 000000000..03f2b172f --- /dev/null +++ b/package/lean/luci-app-oscam/luasrc/controller/admin/sattv.lua @@ -0,0 +1,16 @@ +module("luci.controller.admin.sattv", package.seeall) + +function index() + +-- entry({"admin", "Others"}, cbi("sattv/epg"), i18n("Others"), 70) + + if nixio.fs.access("/etc/config/epg") then + entry({"admin", "Others"}, cbi("sattv/epg"), _("sattv"), 66).index = true + entry({"admin", "Others", "epg"}, cbi("sattv/epg"), _("EPG"), 1).i18n = "diskapply" + end + + if nixio.fs.access("/etc/config/oscam") then + entry({"admin", "Others", "oscam"}, cbi("sattv/oscam"), _("OSCAM"), 12).i18n = "diskapply" + end + +end diff --git a/package/lean/luci-app-oscam/luasrc/model/cbi/sattv/epg.lua b/package/lean/luci-app-oscam/luasrc/model/cbi/sattv/epg.lua new file mode 100644 index 000000000..da46cad90 --- /dev/null +++ b/package/lean/luci-app-oscam/luasrc/model/cbi/sattv/epg.lua @@ -0,0 +1,50 @@ +require("luci.tools.webadmin") + +--[[ +config epg_set + option enable 1 + option time 30 + option src_url http://dm.epg.net.cn/a/epg.xml + option src_url1 http://dm1.epg.net.cn/a/epg.xml + option src_url2 http://epg.xltvrobbs.net/atmosphere/epg/epg.xml + option src_url3 http://epg1.xltvrobbs.net/atmosphere/epg/epg.xml + +]]-- + + +m = Map("epg", translate("epg_title","Set epg download address"),translate("epg_desc", +"Set epg auto download for dm500 atmosphere")) + +s = m:section(TypedSection, "epg_set", translate("epgset","settings")) +s.anonymous = true +s.addremove = false + +enable = s:option(Flag, "enable", translate("enable", "enable")) +enable.default = false +enable.optional = false +enable.rmempty = false + +interval = s:option(Value, "interval", translate("interval","interval")) +interval.default = 30 +interval.optional = false +interval.rmempty = false + + +s = m:section(TypedSection, "downaddress", translate("downaddress","downaddress")) +s.template = "cbi/tblsection" +s.anonymous = false +s.addremove = true + +enable = s:option(Flag, "addr_enable", translate("enable", "enable")) +enable.default = false +enable.optional = false +enable.rmempty = false + + +url = s:option(Value, "address", translate("dowload address","dowload address")) +url.optional = false +url.rmempty = false + + +return m + diff --git a/package/lean/luci-app-oscam/luasrc/model/cbi/sattv/oscam.lua b/package/lean/luci-app-oscam/luasrc/model/cbi/sattv/oscam.lua new file mode 100644 index 000000000..44a19fcfd --- /dev/null +++ b/package/lean/luci-app-oscam/luasrc/model/cbi/sattv/oscam.lua @@ -0,0 +1,67 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2011 flyzjhz + +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 + +]]-- + + +local fs = require "nixio.fs" +local uci = require "luci.model.uci".cursor() +local lanipaddr = uci:get("network", "lan", "ipaddr") or "192.168.1.1" +--- Retrieves the output of the "get_oscam_port" command. +-- @return String containing the current get_oscam_port +function get_oscam_port() + + local oscam_conf= fs.readfile("/usr/oscam/oscam.conf") + local oscam_conf_port = tonumber(oscam_conf:match("[Hh]ttppor[Tt].-= ([^\n]+)")) or "8899" + return oscam_conf_port +end + +local oscamport = get_oscam_port() + +m = Map("oscam", translate("OSCAM","OSCAM"),translate("oscam desc", +"oscam for openwrt")) + +s = m:section(TypedSection, "setting", translate("set","settings")) +s.anonymous = true +s.addremove = false + +enable = s:option(Flag, "enable", translate("enable", "enable")) +enable.default = false +enable.optional = false +enable.rmempty = false + +interval = s:option(Value, "interval", translate("interval","interval"), +translate("interval_desc","interval_desc")) +interval.optional = false +interval.rmempty = false +interval.default = 30 + +s:option(DummyValue,"oscamweb" ,translate("OSCAM Web Intelface "),translate("Open the oscam Web")) + +tmpl = s:option(Value, "_tmpl", + translate("Edit oscam configuration."), + translate("This is the content of the file '/usr/oscam/oscam.conf'")) + +tmpl.template = "cbi/tvalue" +tmpl.rows = 20 + +function tmpl.cfgvalue(self, section) + return nixio.fs.readfile("/usr/oscam/oscam.conf") +end + +function tmpl.write(self, section, value) + value = value:gsub("\r\n?", "\n") + nixio.fs.writefile("//usr/oscam/oscam.conf", value) +end + +return m + + diff --git a/package/lean/luci-app-oscam/root/etc/config/epg b/package/lean/luci-app-oscam/root/etc/config/epg new file mode 100644 index 000000000..9c2791f68 --- /dev/null +++ b/package/lean/luci-app-oscam/root/etc/config/epg @@ -0,0 +1,13 @@ + +config 'epg_set' + option 'enable' '0' + option 'interval' '30' + +config 'downaddress' 'epg1' + option 'addr_enable' '1' + option 'address' 'http://dm.epg.net.cn/a/epg.xml' + +config 'downaddress' 'epg2' + option 'addr_enable' '1' + option 'address' 'http://epg.xltvrobbs.net/atmosphere/epg/epg.xml' + diff --git a/package/lean/luci-app-oscam/root/etc/config/oscam b/package/lean/luci-app-oscam/root/etc/config/oscam new file mode 100644 index 000000000..795ea4e3c --- /dev/null +++ b/package/lean/luci-app-oscam/root/etc/config/oscam @@ -0,0 +1,4 @@ + +config 'setting' + option 'enable' '0' + diff --git a/package/lean/luci-app-oscam/root/etc/init.d/epg b/package/lean/luci-app-oscam/root/etc/init.d/epg new file mode 100755 index 000000000..9b9014cdd --- /dev/null +++ b/package/lean/luci-app-oscam/root/etc/init.d/epg @@ -0,0 +1,23 @@ +#!/bin/sh /etc/rc.common +# copyrights +# (1)epg dowload Script VER 0.10for openwrt by zjhzzyf + + + +START=96 + + + +start(){ + + + /usr/bin/epg start +} + +stop() { + echo "not implemented yet!" +} + +restart() { + start +} \ No newline at end of file diff --git a/package/lean/luci-app-oscam/root/etc/init.d/oscam b/package/lean/luci-app-oscam/root/etc/init.d/oscam new file mode 100755 index 000000000..ca40a3608 --- /dev/null +++ b/package/lean/luci-app-oscam/root/etc/init.d/oscam @@ -0,0 +1,70 @@ +#!/bin/sh /etc/rc.common +# oscam Script VER 0.10 for openwrt by zjhzzyf + +START=94 + +. /etc/functions.sh +path="/usr/oscam/" + + +kill_oscam() +{ +local otherpids +local execute +otherpids=$(ps -a 2>&1 | grep "/usr/bin/oscam" | grep -v $$ | awk -F " " '{print $1}') +echo "$otherpids" | while read execute +do +kill -9 ${execute} +done +} + + + +oscam_start() +{ + + /usr/bin/oscam -b -c $path + echo "readdy go....." + +} + + + +start(){ +echo "game start....." + enable=$(uci get oscam.@setting[0].enable) + if [ "$enable" == "" ];then + enable=0 + fi + + [ "$enable" == "1" ]&&oscam_start + +interval=$(uci get oscam.@setting[0].interval) +oscam_cron=`cat /etc/crontabs/root | grep "/etc/init.d/oscam restart"` +if [ "$enable" == "1" -a "$interval" != "0" ]; then + oscam_new="*/${interval} * * * * /etc/init.d/oscam restart" + if [ "z${oscam_cron}" != "z${oscam_new}" ] ; then + cat /etc/crontabs/root | grep -v "/etc/init.d/oscam restart" > /tmp/crontabs_oscam + echo "" >> /tmp/crontabs_oscam + echo "*/${interval} * * * * /etc/init.d/oscam restart" >> /tmp/crontabs_oscam + cat /tmp/crontabs_oscam | grep -v ^$ > /etc/crontabs/root + /etc/init.d/cron restart + fi +else + if [ "z${oscam_cron}" != "z" ] ; then + cat /etc/crontabs/root | grep -v "/etc/init.d/oscam restart" > /tmp/crontabs_oscam + cat /tmp/crontabs_oscam | grep -v ^$ > /etc/crontabs/root + /etc/init.d/cron restart + fi + +fi +rm -f /tmp/crontabs_oscam + +} + +stop() { + kill_oscam + echo "oscam stopped" +} + + diff --git a/package/lean/luci-app-oscam/root/etc/oscam/oscam.conf b/package/lean/luci-app-oscam/root/etc/oscam/oscam.conf new file mode 100644 index 000000000..51abc783f --- /dev/null +++ b/package/lean/luci-app-oscam/root/etc/oscam/oscam.conf @@ -0,0 +1,39 @@ +# oscam.conf generated automatically by Streamboard OSCAM 1.00-unstable_svn build #r4503 +# Read more: http://streamboard.gmc.to/oscam/browser/trunk/Distribution/doc/txt/oscam.conf.txt + +[global] +logfile = /dev/shm/oscam.log +disablelog = 1 +clientmaxidle = 36000 +bindwait = 5 +netprio = 9 +nice = 9 +waitforcards = 0 +lb_mode = 1 + +[monitor] +port = 9988 +nocrypt = +aulow = 120 +hideclient_to = 0 +monlevel = 255 +appendchaninfo = 0 + +[dvbapi] +enabled = 1 +au = 1 +boxtype = none +user = user1 +pmt_mode = 0 +request_mode = 0 + +[webif] +httpport = 8899 +httpuser = oscam +httppwd = oscam +httprefresh = 0 +httpallowed = 1.0.0.0-255.255.0.0 +httphideidleclients = 0 +httpreadonly = 0 +httpsavefullcfg = 0 + diff --git a/package/lean/luci-app-oscam/root/etc/oscam/oscam.server b/package/lean/luci-app-oscam/root/etc/oscam/oscam.server new file mode 100644 index 000000000..876103ba0 --- /dev/null +++ b/package/lean/luci-app-oscam/root/etc/oscam/oscam.server @@ -0,0 +1,28 @@ +# oscam.server generated automatically by Streamboard OSCAM 1.00-unstable_svn build #r4503 +# Read more: http://streamboard.gmc.to/oscam/browser/trunk/Distribution/doc/txt/oscam.server.txt + +[reader] +label = reshare1 +enable = 0 +protocol = cccam +device = oscam.3322.org,13111 +user = test01 +password = test01 +inactivitytimeout = 1 +reconnecttimeout = 3 +group = 1 +blockemm-unknown = 1 +blockemm-u = 1 +blockemm-s = 1 +blockemm-g = 1 +lb_weight = 100 +cccversion = 2.1.2 +cccmaxhops = 12 +ccckeepalive = 1 +audisabled = 1 +cccdisableautoblock = 1 + + + + + diff --git a/package/lean/luci-app-oscam/root/etc/oscam/oscam.user b/package/lean/luci-app-oscam/root/etc/oscam/oscam.user new file mode 100644 index 000000000..f02c1bc84 --- /dev/null +++ b/package/lean/luci-app-oscam/root/etc/oscam/oscam.user @@ -0,0 +1,6 @@ +[account] +user = 001 +pwd = 001 +group = 1 +keepalive = 1 +uniq = 0 diff --git a/package/lean/luci-app-oscam/root/etc/uci-defaults/luci-sattv b/package/lean/luci-app-oscam/root/etc/uci-defaults/luci-sattv new file mode 100644 index 000000000..a9e759580 --- /dev/null +++ b/package/lean/luci-app-oscam/root/etc/uci-defaults/luci-sattv @@ -0,0 +1,14 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@epg[-1] + add ucitrack epg + set ucitrack.@epg[-1].init=epg + delete ucitrack.@oscam[-1] + add ucitrack oscam + set ucitrack.@oscam[-1].init=oscam + add_list ucitrack.@oscam[-1].affects=cron + commit ucitrack +EOF +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-oscam/root/usr/bin/epg b/package/lean/luci-app-oscam/root/usr/bin/epg new file mode 100755 index 000000000..e51b91fc4 --- /dev/null +++ b/package/lean/luci-app-oscam/root/usr/bin/epg @@ -0,0 +1,199 @@ +#!/bin/sh +# copyrights +# (1)epg dowload Script VER 0.10for openwrt by zjhzzyf + + +. /lib/functions.sh + + +epg_down() +{ + bsuc=1 + echo "File Path:"$path + filename="epg.xml" + echo "Setup FileName:"$filename + sfullfilename=`echo $path$filename` + echo "sFullFileName:"$sfullfilename + + index=0 + echo "Try Times Max:"$trytimes + while [ "$index" -lt "$trytimes" ] + do + echo "Try Times:"$index + if wget -qO- -t3 $url > $sfullfilename;then + break + fi + index=`expr $index + 1` + done + if [ "$index" -eq "$trytimes" ]; then + ErrMsg=`date` + ErrMsg=$ErrMsg" 下载配置文件失败" + bsuc=0 + return + fi + echo "down $filename completed" +mfullfilename=`echo ${path}store/${filename}.md5` + echo "MD5 File Name:"$mfullfilename + md5old=`cat $mfullfilename` + md5old=`echo $md5old|awk '{print $1}'|tr "[a-z]" "[A-Z]"` + echo "Old File MD5:"$md5old + md5new=`/usr/bin/md5sum $sfullfilename` + md5new=`echo $md5new|awk '{print $1}'|tr "[a-z]" "[A-Z]"` + echo "New File MD5:"$md5new + if [ "$md5old" = "$md5new" ]; then + ErrMsg=`date` + ErrMsg=$ErrMsg" 数据不需要更新" + bsuc=1 + return + else + + counttimes=0 + suctimes=0 + counttimes=`expr $counttimes + 1` + url=$(grep -m 1 "URL" $sfullfilename |awk -F "" '{print $2}'|awk -F "" '{print $1}') + echo "Down Data URL:" $url + +filename=`echo ${url##*/}` + echo "Down File Name:"$filename + + echo "=====" +echo $url + replaces=`echo ${url%/*}` + +replaces=`echo ${replaces#*//}` + + echo replaces: $replaces + echo -e `sed -e "s#$replaces#$replaced#g" $sfullfilename` > `echo $sfullfilename` + echo "=====" + + dfullfilename=`echo $path$filename` + echo "Down Data Save File Name:"$dfullfilename + + index=0 + while [ "$index" -lt "$trytimes" ] + do + echo "Try Times:"$index + if wget -t3 -T120 -qO- $url > $dfullfilename;then + suctimes=`expr $suctimes + 1` + + break + fi + index=`expr $index + 1` + + done + + if [ "$index" -eq "$trytimes" ]; then + bsuc=0 + ErrMsg=`date` + ErrMsg=$ErrMsg" 下载"$url"失败" + + fi + + + if [ "$counttimes" -eq "$suctimes" ]; then + echo $md5new > `echo $mfullfilename` + +mount -o bind /tmp/epg/ /www/atmosphere + rm -rf ${path}/epg/* + +cp ${path}$filename ${path}/epg +cp ${path}epg.xml ${path}/epg + rm -rf ${path}$filename + rm -rf ${path}epg.xml + ErrMsg=`date` + ErrMsg=$ErrMsg" 下载EPG数据成功" + echo $ErrMsg + exit 0 + else + ErrMsg=`date` + ErrMsg= $ErrMsg " 未知原因失败" + fi + fi +} + + +epg_start() { + +config_get enable $1 enable +config_get interval $1 interval +[ "$enable" = "" ]&&enable=0 + +#make scheduler + +epg_cron=`cat /etc/crontabs/root | grep "/usr/bin/epg scheduler"` +if [ "$enable" == "1" -a "${interval}" != "0" ]; then + mkdir -p /tmp/epg/ + mkdir -p /tmp/epg/store + mkdir -p /tmp/epg/epg + mkdir -p /www/atmosphere + epg_new="*/${interval} * * * * /usr/bin/epg scheduler" + if [ "z${epg_cron}" != "z${epg_new}" ] ; then + cat /etc/crontabs/root | grep -v "/etc/init.d/epg scheduler" > /tmp/crontabs_epg + echo "*/${interval} * * * * /etc/init.d/epg scheduler" >> /tmp/crontabs_epg + echo "" >> /tmp/crontabs_epg + cat /tmp/crontabs_epg | grep -v ^$ > /etc/crontabs/root + /etc/init.d/cron restart + fi +else + if [ "z${epg_cron}" != "z" ] ; then + cat /etc/crontabs/root | grep -v "/etc/init.d/epg scheduler" > /tmp/crontabs_epg + cat /tmp/crontabs_epg | grep -v ^$ > /etc/crontabs/root + /etc/init.d/cron restart + fi +rm -f /tmp/crontabs_epg + +fi + +/etc/init.d/cron restart + +} + + +con_get_addr(){ + + config_get addr_enable $1 addr_enable + config_get address $1 address + +[ "$addr_enable" == "1" ]&&{ +url=$address +echo $url +ErrMsg=`date` +ErrMsg=$ErrMsg" 开始从"$url"下载" +echo $ErrMsg >> `echo /tmp/epglog.txt` +rm `echo $path"*"` +epg_down +echo $ErrMsg >> `echo /tmp/epglog.txt` +echo $bsuc +echo "******************************************************************" >> `echo /tmp/epglog.txt` +} +} + + + +epg_scheduler(){ + +path="/tmp/epg/" +trytimes=3 +bsuc=1 +ErrMsg="" +lan_ipaddr=$(uci get network.lan.ipaddr) +replaced="${lan_ipaddr}/atmosphere/epg" + + +} + + +config_load epg +case "$1" in + start) + config_foreach epg_start epg_set + ;; + stop) + echo "stop test " + ;; + scheduler) + epg_scheduler + config_foreach con_get_addr downaddress +;; +esac + diff --git a/package/lean/luci-app-oscam/root/usr/oscam/oscam.conf b/package/lean/luci-app-oscam/root/usr/oscam/oscam.conf new file mode 100644 index 000000000..a552326fe --- /dev/null +++ b/package/lean/luci-app-oscam/root/usr/oscam/oscam.conf @@ -0,0 +1,37 @@ +[global] +# Prozess +nice = -10 +pidfile = /tmp/oscam.pid +# Logging +logfile = /tmp/oscam.log +disablelog = 0 +maxlogsize = 256 +usrfile = /tmp/oscam_user.log +disableuserfile = 0 +usrfileflag = 1 +# Timeouts - If you have problems adjust or remove rows! +clienttimeout = 2000 +fallbacktimeout = 1000 +serialreadertimeout = 800 +# Sonstiges +clientdyndns = 0 +unlockparental = 1 +saveinithistory = 1 + +[monitor] +port = 15990 +nocrypt = 127.0.0.1,192.168.1.1-192.168.1.255 # "No entry for other IP's!" +aulow = 30 +hideclient_to = 0 +monlevel = 4 +appendchaninfo = 0 + +[camd35] +port = 15991 + +[webif] +httpport = 16000 +httprefresh = 0 +httpallowed = 127.0.0.1,192.168.1.1-192.168.1.255 # "No entry for other IP's!" +httphideidleclients = 0 +httpreadonly = 0 diff --git a/package/lean/oscam/Makefile b/package/lean/oscam/Makefile new file mode 100644 index 000000000..6a1d1c44c --- /dev/null +++ b/package/lean/oscam/Makefile @@ -0,0 +1,71 @@ +# +# Copyright (C) 2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# maz-1 + +include $(TOPDIR)/rules.mk + +PKG_BRANCH:=trunk +PKG_SOURCE_URL:=http://www.streamboard.tv/svn/oscam/trunk +#PKG_REV:=$(shell LC_ALL=C svn info ${PKG_SOURCE_URL} | sed -ne's/^Last Changed Rev: //p') +PKG_REV:=10777 + +PKG_NAME:=oscam +PKG_VERSION:=svn$(PKG_REV) +PKG_RELEASE:=1 + +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz +PKG_SOURCE_PROTO:=svn +PKG_SOURCE_VERSION:=$(PKG_REV) + +PKG_BUILD_DEPENDS:= + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR) + + + +include $(INCLUDE_DIR)/package.mk + +define Package/oscam + DEPENDS:=+libopenssl +libpthread +libusb-1.0 + TITLE:=Open Source Conditional Access Module software + URL:=http://streamboard.gmc.to/oscam/ + SUBMENU:= +endef + +define Package/oscam/description + An Open Source Conditional Access Module software, +based on the very good MpCS version 0.9d created by dukat. +endef + +CONFIGURE_ARGS += --with-ssl=openssl + +define Build/Prepare + $(call Build/Prepare/Default) + mkdir -p $(PKG_BUILD_DIR)/build + cd $(PKG_BUILD_DIR)/build; +endef + +define Package/oscam/conffiles +endef + +define Build/Compile + echo 'set (OSCAM_SYSTEM_NAME wrt350nv2)' > $(PKG_BUILD_DIR)/toolchain.cmake + echo 'set (CMAKE_SYSTEM_NAME Linux)' >> $(PKG_BUILD_DIR)/toolchain.cmake + echo 'set (CMAKE_C_COMPILER $(TARGET_CROSS)gcc)' >> $(PKG_BUILD_DIR)/toolchain.cmake + echo 'set (CMAKE_SYSTEM_PROCESSOR $(ARCH))' >> $(PKG_BUILD_DIR)/toolchain.cmake + cd $(PKG_BUILD_DIR)/build;cmake -DCMAKE_TOOLCHAIN_FILE=$(PKG_BUILD_DIR)/toolchain.cmake ..;make +endef + + +define Package/oscam/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/oscam $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,oscam))