mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-22 18:14:19 +08:00
Compare commits
52 Commits
json-edito
...
kernel-cc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc743ec3a7 | ||
|
|
2cd8e830b4 | ||
|
|
0c8fe5219e | ||
|
|
7149ff400b | ||
|
|
cb51d61097 | ||
|
|
4b603feaf7 | ||
|
|
28a699ace1 | ||
|
|
ecb30c14a7 | ||
|
|
4df1883bc0 | ||
|
|
ad7561290b | ||
|
|
72c80e7255 | ||
|
|
eeae7ce03a | ||
|
|
e660f7eb4e | ||
|
|
e25330b763 | ||
|
|
db18c12c03 | ||
|
|
3c3534e5e6 | ||
|
|
7493d71ea8 | ||
|
|
847f109800 | ||
|
|
3113657a5f | ||
|
|
1e14f810b0 | ||
|
|
d8788edffa | ||
|
|
ec152f8f9f | ||
|
|
ca278a1871 | ||
|
|
209ea5b025 | ||
|
|
dd375f2a18 | ||
|
|
cd49a9c30f | ||
|
|
66706c7995 | ||
|
|
551f885344 | ||
|
|
527a104ef5 | ||
|
|
840130ec14 | ||
|
|
c466667e3d | ||
|
|
b83cb84ff9 | ||
|
|
0bef3a9e5a | ||
|
|
6ee6b3675f | ||
|
|
e8f90b0d41 | ||
|
|
46eb21a677 | ||
|
|
3161fbde1c | ||
|
|
43ea4d028a | ||
|
|
c908ea3e7c | ||
|
|
75299f0ea2 | ||
|
|
dc6ef2b53e | ||
|
|
6badb49fd9 | ||
|
|
4a670745ca | ||
|
|
eda680f4cf | ||
|
|
8bb1b8e147 | ||
|
|
9cdc86c8e8 | ||
|
|
ba02924ce5 | ||
|
|
ee679f8258 | ||
|
|
13b7f7e363 | ||
|
|
293b0835b1 | ||
|
|
54395dd359 | ||
|
|
bbc05c7c79 |
188
alleato-base/Makefile
Normal file
188
alleato-base/Makefile
Normal file
@@ -0,0 +1,188 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=alleato-base
|
||||
|
||||
PKG_VERSION:=14.49.2
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE_URL:=git@iopsys.inteno.se:alleato_base.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=8314aed451255410a2cd4fa43ac3235504e8f018
|
||||
|
||||
PKG_MAINTAINER:=Martin Assarsson, ALLEATO
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
######################################################
|
||||
|
||||
define Package/alleato3
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+python
|
||||
TITLE:=Alleato python libraries
|
||||
endef
|
||||
|
||||
define Package/zwaved
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+jansson
|
||||
TITLE:=Alleato zwave daemon
|
||||
endef
|
||||
|
||||
define Package/zwave-mgr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+alleato3
|
||||
TITLE:=Alleato zwave manager
|
||||
endef
|
||||
|
||||
define Package/zwave-profiler
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+alleato3
|
||||
TITLE:=Alleato zwave profiler
|
||||
endef
|
||||
|
||||
define Package/alleato-scheduler
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+alleato3
|
||||
TITLE:=Alleato scheduler
|
||||
endef
|
||||
|
||||
define Package/alleato-boxconfig
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+alleato3
|
||||
TITLE:=Alleato boxconfig
|
||||
endef
|
||||
|
||||
define Package/all-omc
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+alleato3 +screen
|
||||
TITLE:=Alleato remote tunnel
|
||||
endef
|
||||
|
||||
define Package/ubus-kicker
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=
|
||||
TITLE:=Alleato ubus-kicker
|
||||
endef
|
||||
|
||||
define Package/mqttnagios
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=
|
||||
TITLE:=Alleato mqttnagios
|
||||
endef
|
||||
|
||||
define Package/all4-alleato-tools
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=
|
||||
TITLE:=Alleato tools
|
||||
endef
|
||||
|
||||
######################################################
|
||||
|
||||
define Package/alleato3/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/python2.7/
|
||||
$(CP) -r $(PKG_BUILD_DIR)/python-2.7/* $(1)/usr/lib/python2.7/
|
||||
endef
|
||||
|
||||
define Package/zwaved/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/zwaved $(1)/etc/init.d/zwaved
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/zwaved $(1)/usr/sbin/zwaved
|
||||
endef
|
||||
|
||||
define Package/zwave-mgr/install
|
||||
$(INSTALL_DIR) $(1)/usr/mqttrules $(1)/etc/init.d $(1)/etc/alleato/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/zwave-mgr $(1)/etc/init.d/zwave-mgr
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/zwave_mgr $(1)/usr/mqttrules/zwave_mgr
|
||||
endef
|
||||
|
||||
define Package/zwave-profiler/install
|
||||
$(INSTALL_DIR) $(1)/usr/mqttrules $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/zwave-profiler $(1)/etc/init.d/zwave-profiler
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/zwave-profiler $(1)/usr/mqttrules/zwave-profiler
|
||||
endef
|
||||
|
||||
define Package/alleato-scheduler/install
|
||||
$(INSTALL_DIR) $(1)/usr/mqttrules $(1)/etc/init.d $(1)/etc/crontabs/sched
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/scheduler $(1)/etc/init.d/scheduler
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/scheduler $(1)/usr/mqttrules/scheduler
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/schedule $(1)/etc/crontabs/sched/schedule
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/schedule $(1)/etc/crontabs/schedule
|
||||
endef
|
||||
|
||||
define Package/alleato-boxconfig/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/bin $(1)/etc/init.d $(1)/etc/alleato $(1)/home/mosquitto
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/boxconfig $(1)/etc/init.d/boxconfig
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/boxconfig $(1)/usr/bin/boxconfig
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/genmosquittoconf $(1)/usr/bin/genmosquittoconf
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/check_client_id $(1)/usr/sbin/check_client_id
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/boxconfig.conf $(1)/etc/boxconfig.conf
|
||||
endef
|
||||
|
||||
define Package/all-omc/install
|
||||
$(INSTALL_DIR) $(1)/root $(1)/etc/init.d $(1)/etc/config $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/omc $(1)/etc/init.d/omc
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/root/ssh_key $(1)/root/ssh_key
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/alleato.config $(1)/etc/config/alleato
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/omc $(1)/usr/bin/omc
|
||||
endef
|
||||
|
||||
define Package/ubus-kicker/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/ubus-kicker $(1)/etc/init.d/ubus-kicker
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/ubus-kicker $(1)/usr/sbin/ubus-kicker
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/akick $(1)/usr/sbin/akick
|
||||
endef
|
||||
|
||||
define Package/mqttnagios/install
|
||||
$(INSTALL_DIR) $(1)/etc/nagios.d $(1)/usr/bin $(1)/etc/crontabs $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/mqttnagios $(1)/etc/init.d/mqttnagios
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/send_mqtt_nag $(1)/usr/bin/send_mqtt_nag
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nagios.d/dropbear $(1)/etc/nagios.d/dropbear.nag
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nagios.d/mosquitto $(1)/etc/nagios.d/mosquitto.nag
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nagios.d/ssh $(1)/etc/nagios.d/ssh.nag
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nagios.d/zwaved $(1)/etc/nagios.d/zwaved.nag
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/mqttnagios $(1)/etc/crontabs/mqttnagios
|
||||
echo '/5 * * * * /usr/sbin/check_client_id' >> $(1)/etc/crontabs/root
|
||||
endef
|
||||
|
||||
define Package/all4-alleato-tools/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d $(1)/opt/alleato
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/house $(1)/etc/init.d/house
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/rulesd $(1)/etc/init.d/rulesd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/alleato_tools $(1)/usr/bin/alleato_tools
|
||||
endef
|
||||
|
||||
######################################################
|
||||
|
||||
$(eval $(call BuildPackage,alleato3))
|
||||
$(eval $(call BuildPackage,zwaved))
|
||||
$(eval $(call BuildPackage,zwave-mgr))
|
||||
$(eval $(call BuildPackage,zwave-profiler))
|
||||
$(eval $(call BuildPackage,alleato-scheduler))
|
||||
$(eval $(call BuildPackage,alleato-boxconfig))
|
||||
$(eval $(call BuildPackage,all-omc))
|
||||
$(eval $(call BuildPackage,ubus-kicker))
|
||||
$(eval $(call BuildPackage,mqttnagios))
|
||||
$(eval $(call BuildPackage,all4-alleato-tools))
|
||||
7
anyfi/Config.in
Normal file
7
anyfi/Config.in
Normal file
@@ -0,0 +1,7 @@
|
||||
config ANYFI_CONTROLLER
|
||||
string "Controller IP or FQDN"
|
||||
depends on PACKAGE_anyfi
|
||||
help
|
||||
The default IP address or fully qualified domain name (FQDN)
|
||||
of the Controller that should manage the Anyfi.net software.
|
||||
|
||||
61
anyfi/Makefile
Normal file
61
anyfi/Makefile
Normal file
@@ -0,0 +1,61 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
ANYFI_TARGET := $(ARCH)-linux-$(subst C,c,$(LIBC))-$(LIBCV)
|
||||
|
||||
PKG_NAME := anyfi
|
||||
PKG_VERSION := 1.3.9
|
||||
PKG_RELEASE := 1
|
||||
|
||||
PKG_SOURCE := anyfimac-$(PKG_VERSION)-$(ANYFI_TARGET).tar.bz2
|
||||
PKG_SOURCE_URL := http://anyfi.net/download
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/anyfimac-$(PKG_VERSION)-$(ANYFI_TARGET)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION := net
|
||||
CATEGORY := Network
|
||||
TITLE := Anyfi.net - Free SDWN Data Plane for IEEE 802.11
|
||||
URL := http://anyfi.net
|
||||
DEPENDS := +kmod-tun +librt +wl-anyfi
|
||||
MAINTAINER := Anyfi Networks <eng@anyfinetworks.com>
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Anyfi.net is a free Software-Defined Wirless Networking (SDWN)
|
||||
forwarding data plane implementation for IEEE 802.11.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
echo "config anyfi controller" > $(PKG_BUILD_DIR)/anyfi.conf
|
||||
echo " option 'hostname' $(CONFIG_ANYFI_CONTROLLER)" >> \
|
||||
$(PKG_BUILD_DIR)/anyfi.conf
|
||||
echo "config anyfi optimizer" >> $(PKG_BUILD_DIR)/anyfi.conf
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
@echo "Nothing to do - Anyfi.net software comes pre-built."
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/anyfi
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/anyfi.conf $(1)/etc/config/anyfi
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/anyfimac $(1)/sbin
|
||||
$(LN) anyfimac $(1)/sbin/anyfid
|
||||
$(LN) anyfimac $(1)/sbin/myfid
|
||||
$(INSTALL_DIR) $(1)/bin
|
||||
$(LN) ../sbin/anyfimac $(1)/bin/anyfidctl
|
||||
$(LN) ../sbin/anyfimac $(1)/bin/myfidctl
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
558
anyfi/files/lib/network/anyfi.sh
Normal file
558
anyfi/files/lib/network/anyfi.sh
Normal file
@@ -0,0 +1,558 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2013-2014 Anyfi Networks AB.
|
||||
#
|
||||
# Overview of the Integration
|
||||
# ===========================
|
||||
#
|
||||
# Anyfi.net software consists of two user space daemons; the radio daemon
|
||||
# anyfid and the tunnel termination daemon myfid. They communicate with each
|
||||
# other and with a Controller [1] over UDP/IP.
|
||||
#
|
||||
# The radio daemon anyfid provides guests with access to remote Wi-Fi networks.
|
||||
# It needs a Wi-Fi monitor interface to detect when guest devices come within
|
||||
# range and a pool of virtual access points to serve them. The integration is
|
||||
# responsible for creating the monitor interface and the pool of virtual access
|
||||
# points; anyfid handles the rest.
|
||||
#
|
||||
# The tunnel termination daemon myfid provides remote access to the local Wi-Fi
|
||||
# network. It is up to the integration to configure myfid to authenticate remote
|
||||
# devices in the same way that devices are authenticated when connecting
|
||||
# locally.
|
||||
#
|
||||
# Myfid is also responsible for telling the controller the MAC address of
|
||||
# devices that connect locally, so that they can later be offered seamless
|
||||
# remote access whenever they come close to another access point running anyfid.
|
||||
# However, when the user changes the WPA passphrase all such associations
|
||||
# between previously connected devices and the local Wi-Fi network should be
|
||||
# removed. The integration does so by passing myfid the --reset flag.
|
||||
#
|
||||
# Below is the integration logic in pseudo code. If you need to integrate
|
||||
# Anyfi.net software in your own firmware build environment you can find step
|
||||
# by step instructions at http://anyfi.net/integration.
|
||||
#
|
||||
# 1. A Community Edition of the Controller is available for download at
|
||||
# http://www.anyfinetworks.com/download. You can also use the public
|
||||
# demonstration controller at "demo.anyfi.net".
|
||||
#
|
||||
#
|
||||
# Integration Logic in Pseudo Code
|
||||
# ================================
|
||||
#
|
||||
# After enabling a Wi-Fi device:
|
||||
# IF a controller is configured AND Anyfi.net is not disabled
|
||||
# ALLOCATE monitor interface and virtual access point pool for anyfid
|
||||
# START anyfid
|
||||
#
|
||||
# FOREACH Wi-Fi interface of this device
|
||||
# IF a controller is configured AND Anyfi.net is not disabled
|
||||
# GENERATE a config file for myfid
|
||||
#
|
||||
# IF the WPA passphrase has changed
|
||||
# ADD the --reset flag to myfid arguments
|
||||
#
|
||||
# START myfid on the Wi-Fi interface
|
||||
#
|
||||
# After disabling a Wi-Fi device:
|
||||
# STOP anyfid
|
||||
#
|
||||
# FOREACH Wi-Fi interface of this device
|
||||
# STOP myfid on the Wi-Fi interface
|
||||
#
|
||||
# NOTE 1: The integration provides remote access to all Wi-Fi interfaces on the
|
||||
# system that have anyfi_disabled set to 0. Each interface will have
|
||||
# its own myfid daemon. There should however only be one anyfid daemon
|
||||
# per radio.
|
||||
#
|
||||
# NOTE 2: On concurrent dual band routers each radio should have its own anyfid
|
||||
# daemon.
|
||||
#
|
||||
#
|
||||
# Anyfi.net UCI data model
|
||||
# ========================
|
||||
#
|
||||
# Anyfi.net global parameters:
|
||||
#
|
||||
# Name Type Default Description
|
||||
# controller
|
||||
# .hostname IP or FQDN demo.anyfi.net Controller IP or FQDN
|
||||
# .key path - Controller public key PEM file
|
||||
# optimizer
|
||||
# .key path - Optimizer public key PEM file
|
||||
#
|
||||
# Wi-Fi device parameters:
|
||||
#
|
||||
# Name Type Default Description
|
||||
# anyfi_disabled boolean 0 Enable/disable guest access on this radio
|
||||
# anyfi_iface port - Bind anyfid to a WAN interface IP address
|
||||
# anyfi_port number - Bind anyfid to a SDWN UDP port
|
||||
# anyfi_floor percent 5 Min backhaul and spectrum allocation
|
||||
# anyfi_ceiling percent 75 Max backhaul and spectrum allocation
|
||||
# anyfi_uplink integer - WAN uplink capacity in bits per second
|
||||
# anyfi_downlink integer - WAN downlink capacity in bits per second
|
||||
# anyfi_bssids integer - Max number of virtual interfaces to use
|
||||
# anyfi_clients integer - Max number of concurrent guest users
|
||||
#
|
||||
# Wi-Fi interface parameters:
|
||||
#
|
||||
# Name Type Default Description
|
||||
# anyfi_disabled boolean 0 Enable remote access on this network
|
||||
# anyfi_iface string - Bind myfid to a WAN interface IP
|
||||
# address
|
||||
# anyfi_port port - Bind myfid to a SDWN UDP port
|
||||
# anyfi_autz_server IP - RADIUS authorization server IP
|
||||
# anyfi_autz_port port 1812 RADIUS authorization server UDP port
|
||||
# anyfi_autz_secret string - RADIUS authorization server shared
|
||||
# secret
|
||||
# anyfi_acct_server IP - RADIUS extra accounting server IP
|
||||
# anyfi_acct_port port 1813 RADIUS extra accounting server UDP port
|
||||
# anyfi_acct_secret string - RADIUS extra accounting server shared
|
||||
# secret
|
||||
|
||||
append ENABLE_HOOKS anyfi_enable
|
||||
append DISABLE_HOOKS anyfi_disable
|
||||
|
||||
# Daemon run dir for temporary files.
|
||||
RUNDIR=/var/run
|
||||
|
||||
# Config file dir for persistent configuration files.
|
||||
CONFDIR=/etc
|
||||
|
||||
##### Wi-Fi device handling ##################################################
|
||||
|
||||
# Get the channel for Wi-Fi device.
|
||||
# anyfi_dev_get_channel <device>
|
||||
anyfi_dev_get_channel() {
|
||||
local device="$1"
|
||||
local hwmode channel
|
||||
|
||||
config_get hwmode "$device" hwmode
|
||||
config_get channel "$device" channel
|
||||
|
||||
if [ "$channel" = auto -o "$channel" = 0 ]; then
|
||||
case "$hwmode" in
|
||||
auto)
|
||||
channel=auto
|
||||
;;
|
||||
|
||||
*b*|*g*)
|
||||
channel=auto2
|
||||
;;
|
||||
|
||||
*a*)
|
||||
channel=auto5
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
echo "$channel"
|
||||
}
|
||||
|
||||
# Get the WLAN interface list for a WLAN device.
|
||||
# anyfi_get_vifs <device>
|
||||
anyfi_get_vifs() {
|
||||
local device=$1
|
||||
local vifs=""
|
||||
local cfg
|
||||
|
||||
for cfg in $CONFIG_SECTIONS; do
|
||||
local type dev
|
||||
config_get type "$cfg" TYPE
|
||||
config_get dev "$cfg" device
|
||||
|
||||
if [ "$type" = wifi-iface ] && [ "$dev" = "$device" ]; then
|
||||
append vifs "$cfg"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$vifs"
|
||||
}
|
||||
|
||||
# Start the Anyfi.net radio head daemon anyfid on a device.
|
||||
# anyfi_dev_start <device> <type> <controller> <controller_key>
|
||||
anyfi_dev_start()
|
||||
{
|
||||
local device="$1"
|
||||
local type="$2"
|
||||
local controller="$3"
|
||||
local controller_key="$4"
|
||||
local nvifs bssids monitor iflist
|
||||
|
||||
# Determine how many virtual interfaces we should use
|
||||
config_get bssids "$device" anyfi_bssids
|
||||
nvifs=$(anyfi_get_vifs "$device" | wc -w)
|
||||
|
||||
if [ -n "$bssids" ]; then
|
||||
# Limit the number of virtual interfaces to 32
|
||||
[ "$bssids" -lt 32 ] || bssids=32
|
||||
elif [ $nvifs -lt 4 ]; then
|
||||
# Don't use more that 8 interfaces in total if possible...
|
||||
bssids=$((8 - $nvifs))
|
||||
else
|
||||
# ...but try to allocate at least 4 interfaces for anyfid.
|
||||
bssids=4
|
||||
fi
|
||||
|
||||
# ALLOCATE monitor and pool of virtual access points
|
||||
if monitor=$(anyfi_${type}_alloc_monitor "$device") && \
|
||||
iflist=$(anyfi_${type}_alloc_iflist "$device" $bssids)
|
||||
then
|
||||
local args=""
|
||||
local wanif port floor ceiling uplink downlink clients
|
||||
|
||||
config_get wanif "$device" anyfi_iface
|
||||
config_get port "$device" anyfi_port
|
||||
config_get floor "$device" anyfi_floor
|
||||
config_get ceiling "$device" anyfi_ceiling
|
||||
config_get uplink "$device" anyfi_uplink
|
||||
config_get downlink "$device" anyfi_downlink
|
||||
config_get clients "$device" anyfi_clients
|
||||
|
||||
# If there are no interfaces on this device then
|
||||
# anyfid controls channel
|
||||
if [ "$nvifs" -eq 0 ]; then
|
||||
args="$args --channel=$(anyfi_dev_get_channel $device)"
|
||||
fi
|
||||
|
||||
[ -n "$wanif" ] && args="$args --bind-if=$wanif"
|
||||
[ -n "$port" ] && args="$args --bind-port=$port"
|
||||
[ -n "$floor" ] && args="$args --floor=$floor"
|
||||
[ -n "$ceiling" ] && args="$args --ceiling=$ceiling"
|
||||
[ -n "$uplink" ] && args="$args --uplink=$uplink"
|
||||
[ -n "$downlink" ] && args="$args --downlink=$downlink"
|
||||
[ -n "$clients" ] && args="$args --max-clients=$clients"
|
||||
[ -n "$controller_key" ] && \
|
||||
args="$args --controller-key=$controller_key"
|
||||
|
||||
# START anyfid
|
||||
echo "$device: starting anyfid"
|
||||
/sbin/anyfid --accept-license -C "$controller" -B \
|
||||
-P $RUNDIR/anyfid_$device.pid $args \
|
||||
$monitor $iflist
|
||||
else
|
||||
echo "$device: failed to allocate anyfid interfaces" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
##### Wi-Fi interface handling ###############################################
|
||||
|
||||
# Get the printable name of an interface.
|
||||
anyfi_vif_get_name() {
|
||||
local ifname
|
||||
config_get ifname "$1" ifname
|
||||
echo "${ifname:-$1}"
|
||||
}
|
||||
|
||||
# Generate the config file for myfid from UCI variables.
|
||||
# anyfi_vif_gen_config <vif>
|
||||
anyfi_vif_gen_config() {
|
||||
local vif="$1"
|
||||
local name="$(anyfi_vif_get_name $1)"
|
||||
local device net ssid enc key isolate ifname
|
||||
|
||||
config_get device "$vif" device
|
||||
config_get net "$vif" network
|
||||
config_get ssid "$vif" ssid
|
||||
config_get enc "$vif" encryption
|
||||
config_get key "$vif" key
|
||||
config_get isolate "$vif" isolate
|
||||
config_get ifname "$vif" ifname
|
||||
|
||||
# Check basic settings before proceeding
|
||||
[ -n "$net" ] || [ -n "$ssid" ] || return 1
|
||||
|
||||
local auth_proto auth_mode auth_cache group_rekey
|
||||
local ciphers wpa_ciphers rsn_ciphers passphrase
|
||||
local auth_server auth_port auth_secret
|
||||
local autz_server autz_port autz_secret
|
||||
local acct_server acct_port acct_secret
|
||||
local acct2_server acct2_port acct2_secret
|
||||
local radius_nasid
|
||||
|
||||
# Resolve explicit cipher overrides (tkip, ccmp or tkip+ccmp)
|
||||
case "$enc" in
|
||||
*+tkip+ccmp|*+tkip+aes)
|
||||
ciphers=tkip+ccmp
|
||||
;;
|
||||
|
||||
*+ccmp|*+aes)
|
||||
ciphers=ccmp
|
||||
;;
|
||||
|
||||
*+tkip)
|
||||
ciphers=tkip
|
||||
;;
|
||||
esac
|
||||
|
||||
# Resolve authentication protocol (WPA or WPA2)
|
||||
case "$enc" in
|
||||
psk-mixed*|wpa-mixed*|mixed-psk*|mixed-wpa*)
|
||||
auth_proto=wpa+rsn
|
||||
wpa_ciphers=$ciphers
|
||||
rsn_ciphers=$ciphers
|
||||
;;
|
||||
|
||||
psk2*|wpa2*)
|
||||
auth_proto=rsn
|
||||
rsn_ciphers=$ciphers
|
||||
;;
|
||||
|
||||
psk*|wpa*)
|
||||
auth_proto=wpa
|
||||
wpa_ciphers=$ciphers
|
||||
;;
|
||||
|
||||
none)
|
||||
echo "$name: no remote access for security reasons (open network)" 1>&2
|
||||
return 1
|
||||
;;
|
||||
|
||||
wep*)
|
||||
echo "$name: no remote access for security reasons (wep is insecure)" 1>&2
|
||||
return 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "$name: unrecognized encryption type $enc" 1>&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Resolve authenticator mode (PSK or 802.1X)
|
||||
case "$enc" in
|
||||
psk*)
|
||||
auth_mode=psk
|
||||
passphrase=$key
|
||||
[ -n "$passphrase" ] || return 1
|
||||
;;
|
||||
|
||||
wpa*)
|
||||
auth_mode=eap
|
||||
|
||||
config_get auth_server "$vif" radius_server
|
||||
config_get auth_port "$vif" radius_port
|
||||
config_get auth_secret "$vif" radius_secret
|
||||
|
||||
config_get acct_server "$vif" acct_server
|
||||
config_get acct_port "$vif" acct_port
|
||||
config_get acct_secret "$vif" acct_secret
|
||||
|
||||
config_get auth_cache "$vif" auth_cache
|
||||
config_get group_rekey "$vif" wpa_group_rekey
|
||||
|
||||
[ -n "$auth_server" ] || return 1
|
||||
[ -n "$auth_secret" ] || auth_secret="$key"
|
||||
[ -n "$acct_server" -a -z "$acct_secret" ] && acct_secret="$key"
|
||||
;;
|
||||
|
||||
none)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "$name: no remote access ('encryption' not configured)" 1>&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Optional RADIUS authorization and accounting for Anyfi.net
|
||||
config_get autz_server "$vif" anyfi_autz_server
|
||||
config_get autz_port "$vif" anyfi_autz_port
|
||||
config_get autz_secret "$vif" anyfi_autz_secret
|
||||
|
||||
config_get acct2_server "$vif" anyfi_acct_server
|
||||
config_get acct2_port "$vif" anyfi_acct_port
|
||||
config_get acct2_secret "$vif" anyfi_acct_secret
|
||||
|
||||
config_get radius_nasid "$vif" radius_nasid
|
||||
|
||||
# Generate common config file options
|
||||
cat <<EOF
|
||||
ssid = '$ssid'
|
||||
bridge = br-$net
|
||||
auth_proto = $auth_proto
|
||||
EOF
|
||||
|
||||
# Generate dependent config file options
|
||||
[ "$isolate" = 1 ] && echo "isolation = 1"
|
||||
[ -n "$ifname" ] && echo "local_ap = $ifname"
|
||||
[ -n "$auth_mode" ] && echo "auth_mode = $auth_mode"
|
||||
[ -n "$auth_cache" ] && echo "auth_cache = $auth_cache"
|
||||
[ -n "$rsn_ciphers" ] && echo "rsn_ciphers = $rsn_ciphers"
|
||||
[ -n "$wpa_ciphers" ] && echo "wpa_ciphers = $wpa_ciphers"
|
||||
[ -n "$group_rekey" ] && echo "group_rekey = $group_rekey"
|
||||
[ -n "$passphrase" ] && echo "passphrase = '$passphrase'"
|
||||
[ -n "$radius_nasid" ] && echo "radius_nas_id = $radius_nas_id"
|
||||
if [ -n "$auth_server" ] && [ -n "$auth_secret" ]; then
|
||||
echo "radius_auth_server = $auth_server"
|
||||
echo "radius_auth_port = ${auth_port:-1812}"
|
||||
echo "radius_auth_secret = $auth_secret"
|
||||
fi
|
||||
if [ -n "$acct_server" ] && [ -n "$acct_secret" ]; then
|
||||
echo "radius_acct_server = $acct_server"
|
||||
echo "radius_acct_port = ${acct_port:-1813}"
|
||||
echo "radius_acct_secret = $acct_secret"
|
||||
fi
|
||||
if [ -n "$autz_server" ] && [ -n "$autz_secret" ]; then
|
||||
echo "radius_autz_server = $autz_server"
|
||||
echo "radius_autz_port = ${autz_port:-1812}"
|
||||
echo "radius_autz_secret = $autz_secret"
|
||||
fi
|
||||
if [ -n "$acct2_server" ] && [ -n "$acct2_secret" ]; then
|
||||
echo "radius_acct2_server = $acct2_server"
|
||||
echo "radius_acct2_port = ${acct2_port:-1813}"
|
||||
echo "radius_acct2_secret = $acct2_secret"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# Get the current value from a myfid configuration file.
|
||||
# anyfi_vif_get_config <file> <config>
|
||||
anyfi_vif_get_config() {
|
||||
local file="$1"
|
||||
local key="$2"
|
||||
|
||||
[ -e "$file" ] || return 1
|
||||
|
||||
# Assume the format is exactly "key = value",
|
||||
# where value may or may not be in ''
|
||||
grep "$key = " $file | cut -d '=' -f2- | cut -b2- | \
|
||||
sed -e "/^'.*'$/s/^'\\(.*\\)'$/\\1/"
|
||||
}
|
||||
|
||||
# Start the Anyfi.net tunnel-termination daemon myfid on an interface.
|
||||
# anyfi_vif_start <vif> <controller> <controller_key> <optimizer_key>
|
||||
anyfi_vif_start()
|
||||
{
|
||||
local vif="$1"
|
||||
local controller="$2"
|
||||
local controller_key="$3"
|
||||
local optimizer_key="$4"
|
||||
|
||||
local name="$(anyfi_vif_get_name $vif)"
|
||||
local pid_file="$RUNDIR/myfid_$name.pid"
|
||||
local conf_file="$CONFDIR/myfid_$name.conf"
|
||||
local new_conf_file="$RUNDIR/myfid_$name.conf"
|
||||
|
||||
# GENERATE a config file for myfid
|
||||
if (anyfi_vif_gen_config $vif) > $new_conf_file; then
|
||||
local controller_key optimizer_key
|
||||
local key old_key wanif port
|
||||
local args=""
|
||||
|
||||
config_get key "$vif" key
|
||||
config_get wanif "$vif" anyfi_iface
|
||||
config_get port "$vif" anyfi_port
|
||||
|
||||
# ADD optional arguments
|
||||
[ -n "$wanif" ] && args="$args --bind-if=$wanif"
|
||||
[ -n "$port" ] && args="$args --bind-port=$port"
|
||||
[ -n "$controller_key" ] && \
|
||||
args="$args --controller-key=$controller_key"
|
||||
[ -n "$optimizer_key" ] && \
|
||||
args="$args --optimizer-key=$optimizer_key"
|
||||
|
||||
# ADD the --reset flag to myfid arguments if the passphrase
|
||||
# has changed or myfid is started for the first time
|
||||
old_key="$(anyfi_vif_get_config $conf_file passphrase)"
|
||||
[ "$key" == "$old_key" ] || args="$args --reset"
|
||||
|
||||
# Update the myfid config file in flash only if needed
|
||||
if ! cmp -s $new_conf_file $conf_file; then
|
||||
mv $new_conf_file $conf_file
|
||||
else
|
||||
rm -f $new_conf_file
|
||||
fi
|
||||
|
||||
# START myfid
|
||||
echo "$name: starting myfid"
|
||||
/sbin/myfid --accept-license -C "$controller" -B -P $pid_file \
|
||||
$args $conf_file
|
||||
fi
|
||||
}
|
||||
|
||||
# Stop an Anyfi.net daemon gracefully
|
||||
# anyfi_stop_daemon <pidfile>
|
||||
anyfi_stop_daemon() {
|
||||
local pidfile="$1"
|
||||
|
||||
kill -TERM $(cat $pidfile)
|
||||
for t in $(seq 0 5); do
|
||||
[ -e $pidfile ] || return 0
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "Timeout waiting for daemon assocated with $pidfile to exit" 1>&2
|
||||
kill -KILL $(cat $pidfile)
|
||||
rm -f $pidfile
|
||||
return 1
|
||||
}
|
||||
|
||||
# Enable Anyfi.net for a Wi-Fi device.
|
||||
# Run from ENABLE_HOOKS
|
||||
anyfi_enable()
|
||||
{
|
||||
local device="$1"
|
||||
local controller
|
||||
local type vif vifs
|
||||
|
||||
# A controller IP or FQDN is required
|
||||
controller="$(uci get anyfi.controller.hostname 2>/dev/null)"
|
||||
[ -n "$controller" ] || return 0
|
||||
|
||||
# Optional controller and optimizer public keys
|
||||
controller_key="$(uci get anyfi.controller.key 2>/dev/null)"
|
||||
optimizer_key="$(uci get anyfi.optimizer.key 2>/dev/null)"
|
||||
|
||||
# Reload the wireless config to get the assigned ifnames right
|
||||
config_load wireless
|
||||
config_get type "$device" type
|
||||
vifs=$(anyfi_get_vifs "$device")
|
||||
|
||||
# START anyfid on this device
|
||||
if [ "$(config_get $device anyfi_disabled)" != 1 ] && \
|
||||
/sbin/anyfi-probe "$type"
|
||||
then
|
||||
anyfi_dev_start $device $type "$controller" "$controller_key"
|
||||
fi
|
||||
|
||||
# FOREACH Wi-Fi interface of this device
|
||||
for vif in $vifs; do
|
||||
if [ "$(config_get $vif disabled)" != 1 ] && \
|
||||
[ "$(config_get $vif anyfi_disabled)" != 1 ]
|
||||
then
|
||||
anyfi_vif_start $vif "$controller" \
|
||||
"$controller_key" "$optimizer_key"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Disable Anyfi.net for a Wi-Fi device.
|
||||
# Run from DISABLE_HOOKS
|
||||
anyfi_disable()
|
||||
{
|
||||
local device="$1"
|
||||
local type vif vifs
|
||||
|
||||
# Reload the wireless config to get the assigned ifnames right
|
||||
config_load wireless
|
||||
config_get type "$device" type
|
||||
vifs=$(anyfi_get_vifs "$device")
|
||||
|
||||
# STOP anyfid on this device (if anyfid is running)
|
||||
if [ -e $RUNDIR/anyfid_$device.pid ]; then
|
||||
echo "$device: stopping anyfid"
|
||||
anyfi_stop_daemon $RUNDIR/anyfid_$device.pid
|
||||
anyfi_${type}_release_iflist $device
|
||||
anyfi_${type}_release_monitor $device
|
||||
fi
|
||||
|
||||
# FOREACH Wi-Fi interface of this device (with myfid running)
|
||||
for vif in $vifs; do
|
||||
local name="$(anyfi_vif_get_name $vif)"
|
||||
local pidfile="$RUNDIR/myfid_$name.pid"
|
||||
|
||||
if [ -e $pidfile ]; then
|
||||
echo "$name: stopping myfid"
|
||||
anyfi_stop_daemon $pidfile
|
||||
fi
|
||||
done
|
||||
}
|
||||
86
anyfi/files/lib/network/anyfi_broadcom.sh
Normal file
86
anyfi/files/lib/network/anyfi_broadcom.sh
Normal file
@@ -0,0 +1,86 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2013-2014 Anyfi Networks AB.
|
||||
# Anyfi.net setup functions for Broadcom wl driver.
|
||||
|
||||
# Get monitor name interface based for a device.
|
||||
# anyfi_dev_monitor_name <device>
|
||||
anyfi_broadcom_name_monitor() {
|
||||
local device="$1"
|
||||
|
||||
# Map wlX => radiotapX
|
||||
echo "$device" | sed 's/^.*\([0-9]\)$/radiotap\1/'
|
||||
}
|
||||
|
||||
# Get BSS index of the last wl interface that is used (=up)
|
||||
# wl0.2 => 2
|
||||
# wl0 => (empty)
|
||||
anyfi_broadcom_get_wlindex() {
|
||||
ifconfig | grep -o "^$1\..." | cut -d'.' -f2 | sort -n | tail -n 1
|
||||
}
|
||||
|
||||
# Allocate virtual Wi-Fi interfaces for anyfid.
|
||||
# anyfi_broadcom_alloc_iflist <device> <bssids>
|
||||
anyfi_broadcom_alloc_iflist() {
|
||||
local device="$1"
|
||||
local bssids="$2"
|
||||
local count=0
|
||||
local wlindex num
|
||||
|
||||
# Enable MBSS mode if not already enabled
|
||||
if [ "$(wlctl -i $device mbss)" = 0 ]; then
|
||||
wlctl -i $device down
|
||||
wlctl -i $device mbss 1
|
||||
wlctl -i $device up
|
||||
fi
|
||||
|
||||
wlindex=$(anyfi_broadcom_get_wlindex $device)
|
||||
|
||||
# Create WLAN interfaces and let the driver assign the BSSIDs
|
||||
for num in $(seq $bssids); do
|
||||
local idx=$(($wlindex + $num))
|
||||
local wlif=$device.$idx
|
||||
|
||||
# Do the 'wlctl' dance to make the driver assign proper BSSIDs
|
||||
wlctl -i $device bss -C $idx up > /dev/null || break
|
||||
wlctl -i $device ssid -C $idx "dummy" > /dev/null
|
||||
wlctl -i $device bss -C $idx up > /dev/null
|
||||
wlctl -i $device bss -C $idx down > /dev/null
|
||||
wlctl -i $device ssid -C $idx "" > /dev/null
|
||||
|
||||
local bssid=$(wlctl -i $wlif cur_etheraddr | cut -d' ' -f2)
|
||||
ifconfig $wlif hw ether $bssid > /dev/null
|
||||
count=$(($count + 1))
|
||||
done
|
||||
|
||||
[ "$count" -gt 0 ] && echo $device.$(($wlindex + 1))/$count
|
||||
}
|
||||
|
||||
# Release virtual Wi-Fi interfaces allocated for anyfid.
|
||||
# anyfi_broadcom_release_iflist <device>
|
||||
anyfi_broadcom_release_iflist() {
|
||||
true
|
||||
}
|
||||
|
||||
# Allocate a monitor interface for anyfid.
|
||||
# anyfi_broadcom_alloc_monitor <device>
|
||||
anyfi_broadcom_alloc_monitor() {
|
||||
local device="$1"
|
||||
local monitor=$(anyfi_broadcom_name_monitor $device)
|
||||
|
||||
wlctl -i $device monitor 0 || return 1
|
||||
wlctl -i $device monitor 3 || return 1
|
||||
ifconfig $monitor down || return 1
|
||||
ifconfig $monitor up || return 1
|
||||
echo $monitor
|
||||
}
|
||||
|
||||
# Release the monitor interface for anyfid.
|
||||
# anyfi_broadcom_release_monitor <device>
|
||||
anyfi_broadcom_release_monitor() {
|
||||
local device="$1"
|
||||
local monitor=$(anyfi_broadcom_name_monitor $device)
|
||||
|
||||
ifconfig $monitor down 2> /dev/null
|
||||
wlctl -i $device monitor 0 2> /dev/null
|
||||
}
|
||||
58
anyfi/files/sbin/anyfi-probe
Executable file
58
anyfi/files/sbin/anyfi-probe
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Check if a WLAN driver type is supported by Anyfi.net radio software."
|
||||
echo "Usage: $0 {mac80211|...}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
number() {
|
||||
echo $2 | sed -e 's/[^0-9]/ /g' | cut -d' ' -f $1
|
||||
}
|
||||
|
||||
major() {
|
||||
number 1 $1
|
||||
}
|
||||
|
||||
minor() {
|
||||
number 2 $1
|
||||
}
|
||||
|
||||
case $1 in
|
||||
mac80211)
|
||||
COMPAT_VER=$(opkg list-installed kmod-mac80211 | cut -d'+' -f2)
|
||||
KERNEL_VER=$(uname -r)
|
||||
|
||||
# Future kernels > 3.x are OK
|
||||
[ "$(major $KERNEL_VER)" -gt 3 ] && return 0
|
||||
|
||||
# The required commit 86c228a7627f3f2776893da47592234140fbfba8
|
||||
# for mac80211 support was introduced in kernel 3.12.
|
||||
[ "$(major $KERNEL_VER)" -eq 3 ] && \
|
||||
[ "$(minor $KERNEL_VER)" -ge 12 ] && return 0
|
||||
|
||||
[ "$(major $COMPAT_VER)" -gt 2013 ] && return 0
|
||||
[ "$(major $COMPAT_VER)" -eq 2013 ] && \
|
||||
[ "$(minor $COMPAT_VER)" -ge 11 ] && return 0
|
||||
|
||||
cat <<EOF
|
||||
Support for mac80211 requires Linux kernel >= 3.12 or
|
||||
compat-wireless >= 2013-11-05. Please update your system.
|
||||
EOF
|
||||
;;
|
||||
|
||||
broadcom)
|
||||
return 0
|
||||
;;
|
||||
|
||||
*)
|
||||
cat<<EOF
|
||||
WLAN driver \"$1\" is not supported by the Anyfi.net radio software.
|
||||
Improved drivers with Anyfi.net support are available for Broadcom,
|
||||
Qualcomm Atheros, Ralink and Realtek chipsets. Please contact
|
||||
support@anyfi.net for updated drivers, reference integrations and
|
||||
commercial integration services.
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
exit 1
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 iopsys Software Solutions AB. All rights reserved.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*/
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ated
|
||||
PKG_VERSION:=1.2.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=f614cba983d827d5185c60a6a5a35530621d44d2
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/mediatek/ated.git
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
# support parallel build
|
||||
#PKG_BUILD_PARALLEL:=1
|
||||
|
||||
#re create configure scripts if not present.
|
||||
#PKG_FIXUP:=autoreconf
|
||||
|
||||
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
|
||||
# this way we don't need to pick out the resulting files from the build dir.
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ated
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Daemon for handling wifi calibration
|
||||
URL:=
|
||||
DEPENDS:= libc
|
||||
endef
|
||||
|
||||
define Package/ated/description
|
||||
Daemon for handling wifi calibration
|
||||
endef
|
||||
|
||||
#TARGET_CFLAGS += -I$(LINUX_DIR)/include -I$(LINUX_DIR)/arch/mips/include
|
||||
|
||||
MAKE_FLAGS += \
|
||||
v=2 \
|
||||
m=3
|
||||
|
||||
|
||||
#TARGET_CPPFLAGS := \
|
||||
# -I$(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx \
|
||||
# -I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
|
||||
# $(TARGET_CPPFLAGS)
|
||||
|
||||
# we donot wwant to have any install.
|
||||
define Build/Install/Default
|
||||
endef
|
||||
|
||||
define Package/ated/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ated $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ated))
|
||||
@@ -1,65 +0,0 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bashdb
|
||||
PKG_VERSION:=4.4-0.92
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
#PKG_SOURCE_URL:=http://sourceforge.net/projects/bashdb/files/bashdb/$(PKG_VERSION)
|
||||
PKG_SOURCE_URL:=@SF/bashdb/
|
||||
PKG_MD5SUM:=b72c17870bfab2fd791b1f6de4d79f9e
|
||||
#PKG_CAT:=zcat
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=none
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Bash script debugging utility.
|
||||
URL:=http://sourceforge.net/projects/bashdb/
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Bash script debugging utility.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
CFLAGS="$(TARGET_CFLAGS) -DLINUX $(TARGET_CPPFLAGS) \
|
||||
-I./src" \
|
||||
LIBS="$(TARGET_LDFLAGS)" \
|
||||
DESTDIR="$(PKG_INSTALL_DIR)"
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bashdb $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/usr/share
|
||||
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/*.sh $(1)/usr/share/$(PKG_NAME)/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/*.inc $(1)/usr/share/$(PKG_NAME)/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/init
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/init/*.sh $(1)/usr/share/$(PKG_NAME)/init/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/command
|
||||
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/command/show_sub
|
||||
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/command/set_sub
|
||||
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/command/info_sub
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/command/*.sh $(1)/usr/share/$(PKG_NAME)/command/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/command/show_sub/*.sh $(1)/usr/share/$(PKG_NAME)/command/show_sub/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/command/set_sub/*.sh $(1)/usr/share/$(PKG_NAME)/command/set_sub/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/command/info_sub/*.sh $(1)/usr/share/$(PKG_NAME)/command/info_sub/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/lib
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/*.sh $(1)/usr/share/$(PKG_NAME)/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bashdb))
|
||||
@@ -1,27 +0,0 @@
|
||||
if PACKAGE_libbbfdm
|
||||
|
||||
config LIBBBFDM_VENDOR_PREFIX
|
||||
string "Vendor Prefix"
|
||||
default "X_IOPSYS_EU_"
|
||||
|
||||
config BBF_TR181
|
||||
bool "Compile with tr181 device features"
|
||||
default y
|
||||
|
||||
config BBF_TR104
|
||||
bool "Compile with tr104 voice features"
|
||||
default y
|
||||
|
||||
config BBF_TR143
|
||||
bool "Compile with tr143 diagnostics features"
|
||||
default y
|
||||
|
||||
config BBF_TR157
|
||||
bool "Compile with tr157 bulkdata collector features"
|
||||
default y
|
||||
|
||||
config BBF_TR064
|
||||
bool "Compile with tr064 features"
|
||||
default n
|
||||
|
||||
endif
|
||||
87
bbf/Makefile
87
bbf/Makefile
@@ -1,87 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2019 Iopsys
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libbbfdm
|
||||
PKG_VERSION:=1.0-2019-10-01
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bbf.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=b3bae9df19df35075ac52f53758288d8e0573790
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/libbbfdm
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Library for broadband-forum data model
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libtrace
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/config
|
||||
source "$(SOURCE)/Config_bbfdm.in"
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/description
|
||||
Test description will update later.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -DCUSTOM_PREFIX=\\\"$(CONFIG_LIBBBFDM_VENDOR_PREFIX)\\\"
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-D_GNU_SOURCE -D_AADJ
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR181),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr181
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR104),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr104
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR143),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr143
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR157),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr157
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR064),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr064
|
||||
endif
|
||||
|
||||
define Package/libbbfdm/install
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbfdm.so* $(1)/lib/
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/dmmap $(1)/etc/bbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/functions $(1)/usr/share/bbfdm
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/include/libbbfdm
|
||||
$(CP) $(PKG_BUILD_DIR)/*.h $(1)/usr/include/libbbfdm/
|
||||
$(CP) $(PKG_BUILD_DIR)/dmtree/tr181/*.h $(1)/usr/include/libbbfdm/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbfdm.{a,so*} $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libbbfdm))
|
||||
@@ -1,42 +0,0 @@
|
||||
#
|
||||
# Copright (C) 2018 The Internet Foundation In Sweden
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bbk_cli
|
||||
PKG_SOURCE_VERSION:=7b810a696c78b746185c11282bdbe3fb7f8c5d4b
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/dotse/bbk.git
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bbk_cli
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libpthread +libstdcpp
|
||||
TITLE:=Bredbandskollen CLI - A bandwidth measurement tool
|
||||
endef
|
||||
|
||||
define Package/bbk_cli/description
|
||||
To measure connection speed in an environment that is missing a web browser,
|
||||
for example, in a server, you can use our command line interface bbk_cli,
|
||||
which is available for some of the most common operating systems.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/src/cli CROSS_COMPILE="$(TARGET_CROSS)"
|
||||
endef
|
||||
|
||||
define Package/bbk_cli/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/cli/cli $(1)/sbin/bbk_cli
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bbk_cli))
|
||||
@@ -1,25 +0,0 @@
|
||||
diff --git a/src/framework/engine.h b/src/framework/engine.h
|
||||
index 57a48ad..9e1bc36 100644
|
||||
--- a/src/framework/engine.h
|
||||
+++ b/src/framework/engine.h
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
+#include <sys/select.h>
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
diff --git a/src/framework/mk.inc b/src/framework/mk.inc
|
||||
index 793e211..13275be 100644
|
||||
--- a/src/framework/mk.inc
|
||||
+++ b/src/framework/mk.inc
|
||||
@@ -7,7 +7,7 @@ OS:=$(shell uname)
|
||||
CXXFLAGS += -O2 -W -Wall -I$(DIRLEVEL)
|
||||
|
||||
ifeq ($(OS),Linux)
|
||||
-CXX = g++
|
||||
+CXX = $(CROSS_COMPILE)g++
|
||||
endif
|
||||
|
||||
ifeq ($(OS),Darwin)
|
||||
@@ -1,46 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2007-2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bootchart2
|
||||
PKG_VERSION:=0.14.7
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/mmeeks/bootchart.git
|
||||
PKG_SOURCE_VERSION:=3ab81137cafe25c2ca4bc3a5f322a63646f9ce8d
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=none
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bootchart2
|
||||
SECTION:=base
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Bootchart2
|
||||
URL:=https://github.com/mmeeks/bootchart
|
||||
endef
|
||||
|
||||
define Package/bootchart2/description
|
||||
Bootchart is a tool for performance analysis and visualization of the GNU/Linux boot process.
|
||||
endef
|
||||
|
||||
define Package/bootchart2/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bootchart-collector $(1)/sbin
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,bootchart2))
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
do_bootchart()
|
||||
{
|
||||
[ -f /dev/null ] || mknod /dev/null c 1 3
|
||||
mkdir -p /lib/bootchart/tmpfs
|
||||
echo "starting bootchart"
|
||||
/sbin/bootchart_run_preinit boot &
|
||||
}
|
||||
|
||||
boot_hook_add preinit_essential do_bootchart
|
||||
@@ -1,7 +0,0 @@
|
||||
|
||||
bootchart_rootfs_pivot()
|
||||
{
|
||||
mount -o move /rom/lib/bootchart/tmpfs /lib/bootchart/tmpfs
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root bootchart_rootfs_pivot
|
||||
@@ -1,59 +0,0 @@
|
||||
#! /bin/sh
|
||||
# this is intended to be started in preinit.
|
||||
# 11_bootchart, starts it
|
||||
# 72_bootchart, fixup mount point after pivot
|
||||
#
|
||||
# program can be killed early with
|
||||
# bootchart_run_preinit stop
|
||||
|
||||
trap "stop; exit 0;" SIGINT SIGTERM
|
||||
|
||||
STOP_AFTER=250
|
||||
HZ=50
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "you need to specify start or stop"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
start()
|
||||
{
|
||||
/sbin/bootchart-collector $HZ &
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
echo "bootchart DUMP"
|
||||
|
||||
mkdir /tmp/bootchart
|
||||
/sbin/bootchart-collector --dump /tmp/bootchart
|
||||
cd /tmp/bootchart
|
||||
tar -zcf /tmp/bootchart.tgz header *.log
|
||||
cd /
|
||||
rm -rf /tmp/bootchart
|
||||
}
|
||||
|
||||
case $1 in
|
||||
boot) # secret option for preinit
|
||||
start
|
||||
sleep $STOP_AFTER
|
||||
# test to see if someone has manually killed us
|
||||
if [ -f /tmp/bootchart.tgz ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
stop
|
||||
;;
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
*)
|
||||
echo "you need to specify start or stop, not $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
diff --git a/pybootchartgui/draw.py b/pybootchartgui/draw.py
|
||||
index 7c3f60c..5c9f046 100644
|
||||
--- a/pybootchartgui/draw.py
|
||||
+++ b/pybootchartgui/draw.py
|
||||
@@ -63,6 +63,7 @@ AXIS_FONT_SIZE = 11
|
||||
LEGEND_FONT_SIZE = 12
|
||||
|
||||
# CPU load chart color.
|
||||
+CPU_SYS_COLOR = (0.65, 0.13, 0.36, 1.0)
|
||||
CPU_COLOR = (0.40, 0.55, 0.70, 1.0)
|
||||
# IO wait chart color.
|
||||
IO_COLOR = (0.76, 0.48, 0.48, 0.5)
|
||||
@@ -300,21 +301,19 @@ def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w):
|
||||
# render bar legend
|
||||
ctx.set_font_size(LEGEND_FONT_SIZE)
|
||||
|
||||
- draw_legend_box(ctx, "CPU (user+sys)", CPU_COLOR, off_x, curr_y+20, leg_s)
|
||||
- draw_legend_box(ctx, "I/O (wait)", IO_COLOR, off_x + 120, curr_y+20, leg_s)
|
||||
+ draw_legend_box(ctx, "CPU (user)", CPU_COLOR, off_x, curr_y+20, leg_s)
|
||||
+ draw_legend_box(ctx, "CPU (sys)", CPU_SYS_COLOR, off_x + 120, curr_y+20, leg_s)
|
||||
+ draw_legend_box(ctx, "I/O (wait)", IO_COLOR, off_x + 120 + 120 , curr_y+20, leg_s)
|
||||
|
||||
# render I/O wait
|
||||
chart_rect = (off_x, curr_y+30, w, bar_h)
|
||||
if clip_visible (clip, chart_rect):
|
||||
draw_box_ticks (ctx, chart_rect, sec_w)
|
||||
draw_annotations (ctx, proc_tree, trace.times, chart_rect)
|
||||
- draw_chart (ctx, IO_COLOR, True, chart_rect, \
|
||||
- [(sample.time, sample.user + sample.sys + sample.io) for sample in trace.cpu_stats], \
|
||||
- proc_tree, None)
|
||||
+ draw_chart (ctx, IO_COLOR, True, chart_rect, [(sample.time, sample.user + sample.sys + sample.io) for sample in trace.cpu_stats], proc_tree, None)
|
||||
# render CPU load
|
||||
- draw_chart (ctx, CPU_COLOR, True, chart_rect, \
|
||||
- [(sample.time, sample.user + sample.sys) for sample in trace.cpu_stats], \
|
||||
- proc_tree, None)
|
||||
+ draw_chart (ctx, CPU_SYS_COLOR, True, chart_rect, [(sample.time, sample.user + sample.sys) for sample in trace.cpu_stats], proc_tree, None)
|
||||
+ draw_chart (ctx, CPU_COLOR, True, chart_rect, [(sample.time, sample.user ) for sample in trace.cpu_stats], proc_tree, None)
|
||||
|
||||
curr_y = curr_y + 30 + bar_h
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2018 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=catv
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=none
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/catv
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=CATV
|
||||
endef
|
||||
|
||||
define Package/catv/description
|
||||
CATV configuration utility
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./files/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/catv/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,catv))
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
config service 'catv'
|
||||
option enable 'no'
|
||||
option filter '3'
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
#
|
||||
# Copyright (C) 2015 inteno.org
|
||||
#
|
||||
|
||||
START=71
|
||||
USE_PROCD=1
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
start_service() {
|
||||
local enable=0
|
||||
local filter=0
|
||||
|
||||
config_load catv
|
||||
config_get_bool enable catv enable 0
|
||||
config_get filter catv filter
|
||||
if [ $enable -eq 0 ]; then
|
||||
ubus call catv set-enable "{\"enable\":\"off\"}"
|
||||
else
|
||||
ubus call catv set-enable "{\"enable\":\"on\"}"
|
||||
fi
|
||||
ubus call catv set-filter "{\"filter\":\"$filter\"}"
|
||||
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger catv
|
||||
}
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
#
|
||||
# Copyright (C) 2019 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=crashlog
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=none
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2019 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.3.0
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=2c8990fd5275d469e8ab6c7a99e17fe0a56052ea
|
||||
PKG_NAME:=dectmngr2
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
RSTRIP:=true
|
||||
export BUILD_DIR
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/dectmngr2
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Dectmngr2
|
||||
URL:=
|
||||
DEPENDS:= +natalie-dect-h bcmkernel +libubox +ubus +libpicoevent
|
||||
endef
|
||||
|
||||
define Package/dectmngr2/description
|
||||
Dectmngr2
|
||||
endef
|
||||
|
||||
|
||||
define Package/dectmngr2/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/dect/
|
||||
$(INSTALL_DIR) $(1)/etc/config/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults/
|
||||
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dectmngr2 $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/target.bin $(1)/etc/dect/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/nvs_default $(1)/etc/dect/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/dect $(1)/etc/init.d/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/dectmngr-wrapper.sh $(1)/usr/sbin/
|
||||
$(CP) ./files/dect.config $(1)/etc/config/dect
|
||||
$(CP) ./files/etc/uci-defaults/* $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,dectmngr2))
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
config dect 'dect'
|
||||
option radio 'auto'
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
# Workaround for product DG400 which has an
|
||||
# incorrect value in nvram from factory.
|
||||
|
||||
if [ -e "/proc/nvram/BoardId" ]; then
|
||||
boardid=$(cat /proc/nvram/BoardId)
|
||||
ulBoardStuffOption=$(cat /proc/nvram/ulBoardStuffOption)
|
||||
|
||||
if [ "$boardid" = "DG400R0" -a "$ulBoardStuffOption" = "0xffffffff" ]; then
|
||||
echo "0xfffffff2" >/proc/nvram/ulBoardStuffOption
|
||||
|
||||
db -q batch <<-EOT
|
||||
set hw.board.hasDect=1
|
||||
commit hw.board
|
||||
EOT
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2018 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dslmngr
|
||||
PKG_VERSION:=1.0.0
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=7522faab4142fe2c0ac8cbf71bb0cc5bd49f0750
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dslmngr.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
endif
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_mips),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
|
||||
TARGET_PLATFORM=MEDIATEK
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_linksys),y)
|
||||
TARGET_PLATFORM=MARVELL
|
||||
else ifeq ($(CONFIG_TARGET_intel_mips),y)
|
||||
TARGET_PLATFORM=INTEL
|
||||
else
|
||||
$(info Unexpected CONFIG_TARGET)
|
||||
endif
|
||||
|
||||
export TARGET_PLATFORM
|
||||
|
||||
define Package/dslmngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=XDSL status and configration utility
|
||||
DEPENDS:=+libdsl +libuci +libubox +ubus +libpthread +libnl-genl +easy-soc-libs
|
||||
endef
|
||||
|
||||
define Package/dslmngr/description
|
||||
This package can be used to configure and provide status about
|
||||
the XDSL subsystem through UBUS.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
FPIC="$(FPIC)"
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
rsync -r --exclude=.* ~/git/dslmngr/ $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
|
||||
endef
|
||||
|
||||
define Package/dslmngr/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dslmngr $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,dslmngr))
|
||||
@@ -1,51 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2019 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=easy-qos
|
||||
PKG_VERSION:=1.1
|
||||
PKG_RELEASE:=0
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=none
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/easy-qos
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Easy QoS
|
||||
DEPENDS:=@(TARGET_intel_mips||TARGET_iopsys_brcm63xx_arm||TARGET_iopsys_brcm63xx_mips)
|
||||
endef
|
||||
|
||||
define Package/easy-qos/description
|
||||
This package contains Easy QoS utility
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./files/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/easy-qos/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(CP) ./files/etc/config/easy_qos $(1)/etc/config/
|
||||
ifeq ($(CONFIG_TARGET_intel_mips),y)
|
||||
$(CP) ./files/etc/init.d/easy_qos.classcfg $(1)/etc/init.d/easy_qos
|
||||
else
|
||||
$(CP) ./files/etc/init.d/easy_qos.iptables $(1)/etc/init.d/easy_qos
|
||||
endif
|
||||
$(CP) ./files/etc/uci-defaults/* $(1)/etc/uci-defaults/
|
||||
$(CP) ./files/etc/firewall.easyqos $(1)/etc/firewall.easyqos
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,easy-qos))
|
||||
@@ -1 +0,0 @@
|
||||
/etc/init.d/easy_qos reload
|
||||
@@ -1,165 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
RULE_LIST="/tmp/easy_qos_rule.list"
|
||||
BRIDGE_INTF=""
|
||||
|
||||
[ -f /etc/profile.d/intel.sh ] && {
|
||||
. /etc/profile.d/intel.sh
|
||||
sh /etc/profile.d/intel.sh
|
||||
}
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t easy_qos_class -p debug
|
||||
}
|
||||
|
||||
exec_log() {
|
||||
${@} |grep -i successful
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
log "Failed to create ${@}";
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
get_priority() {
|
||||
local prio=$(echo $1|tr [A-Z] [a-z]);
|
||||
case "${prio}" in
|
||||
"lowest")
|
||||
echo 8;;
|
||||
"low")
|
||||
echo 7;;
|
||||
"besteffort")
|
||||
echo 6;;
|
||||
"normal")
|
||||
echo 5;;
|
||||
"video")
|
||||
echo 4;;
|
||||
"medium")
|
||||
echo 3;;
|
||||
"high")
|
||||
echo 2;;
|
||||
"highest")
|
||||
echo 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
is_lan_bridge() {
|
||||
local _section=$1
|
||||
local _type
|
||||
local _is_lan
|
||||
|
||||
config_get _type "$section" "type"
|
||||
config_get _is_lan "$section" "is_lan"
|
||||
|
||||
if [ "${_type}" == "bridge" -a "${_is_lan}" == "1" ]; then
|
||||
BRIDGE_INTF="br-${_section}"
|
||||
fi
|
||||
}
|
||||
|
||||
get_bridge_interface() {
|
||||
config_load network
|
||||
config_foreach is_lan_bridge interface
|
||||
}
|
||||
|
||||
validate_rule_section()
|
||||
{
|
||||
uci_validate_section easy_qos rule "${1}" \
|
||||
'priority:string:none' \
|
||||
'macaddr:string:none' \
|
||||
'proto:string:none' \
|
||||
'port:list(uinteger):none' \
|
||||
'comment:string:none'
|
||||
}
|
||||
|
||||
# Clear existing rules before applying new rules
|
||||
clear_existing_rules() {
|
||||
# execute the delete rules written onto a file then delete the file
|
||||
[ -f ${RULE_LIST} ] || return 0
|
||||
|
||||
while read line
|
||||
do
|
||||
log "Deleting old classification rules"
|
||||
exec_log classcfg -D ${line} -i ${BRIDGE_INTF}
|
||||
done <${RULE_LIST}
|
||||
sync
|
||||
|
||||
[ -f ${RULE_LIST} ] && rm ${RULE_LIST}
|
||||
}
|
||||
|
||||
# classcfg -M local_dhcp -i lo -p udp --dport 67:67 --dport 68:68 -j mark --mark 1
|
||||
create_rule() {
|
||||
local proto=$1; shift
|
||||
local mac_addr=$1; shift
|
||||
local mark=$1; shift
|
||||
local ports=$1;
|
||||
local cmd="";
|
||||
# Rule name is uniqe, so we take hash of all the input as rule_name
|
||||
local rule_name="$(echo ${mac_addr}${proto}${mark}${ports} |md5sum |head -c 30)"
|
||||
|
||||
cmd="-j mark --mark ${mark}";
|
||||
|
||||
if [ "${mac_addr}" != "none" ]; then
|
||||
cmd="--smac ${mac_addr} ${cmd}";
|
||||
fi
|
||||
if [ "${ports}" != "none" ]; then
|
||||
IFS=","
|
||||
for port in ${ports};
|
||||
do
|
||||
cmd="--dport ${port}:${port} ${cmd}";
|
||||
done
|
||||
IFS=' '
|
||||
fi
|
||||
if [ "${proto}" != "none" ]; then
|
||||
cmd="-p ${proto} $cmd"
|
||||
fi
|
||||
cmd="-i ${BRIDGE_INTF} $cmd"
|
||||
cmd="-A ${rule_name} $cmd"
|
||||
|
||||
# Store the rule_names for cleanup on reload
|
||||
exec_log classcfg ${cmd}
|
||||
[ $? -eq 0 ] && \
|
||||
echo ${rule_name} >> ${RULE_LIST}
|
||||
}
|
||||
|
||||
manage_rule() {
|
||||
local cfg="$1"
|
||||
local priority macaddr proto port comment prio_num port_list
|
||||
|
||||
validate_rule_section "${1}" || {
|
||||
log "Validation of section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
prio_num=$(get_priority ${priority})
|
||||
port_list=$(echo ${port}|sed 's/ /,/g')
|
||||
|
||||
if [ -n "${prio_num}" ]; then
|
||||
if [ "${proto}" == "none" -o "${proto}" == "tcpudp" ]; then
|
||||
create_rule tcp ${macaddr} ${prio_num} ${port_list}
|
||||
create_rule udp ${macaddr} ${prio_num} ${port_list}
|
||||
else
|
||||
create_rule ${proto} ${macaddr} ${prio_num} ${port_list}
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
get_bridge_interface
|
||||
clear_existing_rules
|
||||
config_load easy_qos
|
||||
config_foreach manage_rule rule
|
||||
}
|
||||
|
||||
start_service() {
|
||||
[ -x /opt/intel/usr/sbin/classcfg ] || exit 0
|
||||
reload_service
|
||||
log "Easy QoS class installed"
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "easy_qos" "network"
|
||||
}
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t easy_qos.ebtable -p debug
|
||||
}
|
||||
|
||||
exec_log() {
|
||||
${@}
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
log "Failed to create ${@}";
|
||||
fi
|
||||
}
|
||||
|
||||
get_priority() {
|
||||
local prio=$(echo $1|tr [A-Z] [a-z]);
|
||||
case "${prio}" in
|
||||
"lowest")
|
||||
echo 0;;
|
||||
"low")
|
||||
echo 1;;
|
||||
"besteffort")
|
||||
echo 2;;
|
||||
"normal")
|
||||
echo 3;;
|
||||
"video")
|
||||
echo 4;;
|
||||
"medium")
|
||||
echo 5;;
|
||||
"high")
|
||||
echo 6;;
|
||||
"highest")
|
||||
echo 7;;
|
||||
esac
|
||||
}
|
||||
|
||||
validate_rule_section()
|
||||
{
|
||||
uci_validate_section easy_qos rule "${1}" \
|
||||
'priority:string' \
|
||||
'macaddr:string' \
|
||||
'proto:string:none' \
|
||||
'port:list(uinteger)' \
|
||||
'comment:string:none'
|
||||
}
|
||||
|
||||
# Clear existing rules before applying new rules
|
||||
clear_existing_rules() {
|
||||
local rule=$(ebtables -t broute -L BROUTING|grep -m 1 mark)
|
||||
while [ -n "${rule}" ]; do
|
||||
exec_log ebtables -t broute -D BROUTING ${rule}
|
||||
rule=$(ebtables -t broute -L BROUTING|grep -m 1 mark)
|
||||
done
|
||||
}
|
||||
|
||||
create_rule() {
|
||||
local protocol=$1; shift
|
||||
local mac=$1; shift
|
||||
local mark="0x$1"; shift
|
||||
local forward_port=$1;
|
||||
local cmd="";
|
||||
local protocol_number
|
||||
|
||||
cmd="-j mark --mark-or ${mark}";
|
||||
if [ -n "${forward_port}" ]; then
|
||||
cmd="--ip-destination-port ${forward_port} ${cmd}";
|
||||
fi
|
||||
|
||||
case "${protocol}" in
|
||||
"tcp")
|
||||
protocol_number=6;;
|
||||
"udp")
|
||||
protocol_number=17;;
|
||||
"dccp")
|
||||
protocol_number=33;;
|
||||
"sctp")
|
||||
protocol_number=132;;
|
||||
*)
|
||||
log "Protocol ${protocol} not supported in ebtables"
|
||||
return;;
|
||||
esac
|
||||
|
||||
cmd="--ip-proto ${protocol_number} $cmd"
|
||||
cmd="-p ip $cmd"
|
||||
|
||||
cmd="-s ${mac} $cmd"
|
||||
exec_log ebtables -t broute -A BROUTING ${cmd}
|
||||
}
|
||||
|
||||
manage_rule() {
|
||||
local cfg="$1"
|
||||
local priority macaddr proto port comment prio_num protocol
|
||||
|
||||
validate_rule_section "${1}" || {
|
||||
log "Validation of section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
protocol=$(echo ${proto}|tr [A-Z] [a-z])
|
||||
prio_num=$(get_priority ${priority})
|
||||
if [ -n "${macaddr}" -a -n "${prio_num}" ]; then
|
||||
for p in ${port}; do
|
||||
if [ "${protocol}" == "none" -o "${protocol}" == "tcpudp" ]; then
|
||||
create_rule tcp ${macaddr} ${prio_num} ${p}
|
||||
create_rule udp ${macaddr} ${prio_num} ${p}
|
||||
else
|
||||
create_rule ${protocol} ${macaddr} ${prio_num} ${p}
|
||||
fi
|
||||
done
|
||||
# Create rule for all ports if port is not mentioned in uci
|
||||
if [ -z "${port}" ]; then
|
||||
if [ "${protocol}" == "none" -o "${protocol}" == "tcpudp" ]; then
|
||||
create_rule tcp ${macaddr} ${prio_num}
|
||||
create_rule udp ${macaddr} ${prio_num}
|
||||
else
|
||||
create_rule ${protocol} ${macaddr} ${prio_num}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
# Do not apply rules if ebtables is not present in system
|
||||
[ -x /usr/sbin/ebtables ] || return;
|
||||
|
||||
clear_existing_rules
|
||||
config_load easy_qos
|
||||
config_foreach manage_rule rule
|
||||
}
|
||||
|
||||
start_service() {
|
||||
reload_service
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "easy_qos"
|
||||
}
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
CLIENT_LIST="/tmp/easy_qos_client.list"
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t easy_qos -p debug
|
||||
}
|
||||
|
||||
exec_log() {
|
||||
${@}
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
log "Failed to create ${@}";
|
||||
fi
|
||||
}
|
||||
|
||||
get_priority() {
|
||||
local prio=$(echo $1|tr [A-Z] [a-z]);
|
||||
case "${prio}" in
|
||||
"lowest")
|
||||
echo 0;;
|
||||
"low")
|
||||
echo 1;;
|
||||
"besteffort")
|
||||
echo 2;;
|
||||
"normal")
|
||||
echo 3;;
|
||||
"video")
|
||||
echo 4;;
|
||||
"medium")
|
||||
echo 5;;
|
||||
"high")
|
||||
echo 6;;
|
||||
"highest")
|
||||
echo 7;;
|
||||
esac
|
||||
}
|
||||
|
||||
clean_client_entries() {
|
||||
[ -f ${CLIENT_LIST} ] && rm ${CLIENT_LIST}
|
||||
}
|
||||
|
||||
map_client_entries() {
|
||||
local clients ip mac host
|
||||
|
||||
json_load "$(ubus call router.network 'clients')"
|
||||
json_get_keys keys
|
||||
|
||||
for key in ${keys};
|
||||
do
|
||||
json_select ${key}
|
||||
json_get_vars ipaddr macaddr hostname
|
||||
clients="${macaddr} ${ipaddr} ${hostname};${clients}"
|
||||
json_select ..
|
||||
done
|
||||
|
||||
json_init
|
||||
|
||||
# json_add_array "clients"
|
||||
IFS=";"
|
||||
for client in ${clients};
|
||||
do
|
||||
macaddr=$(echo ${client} | cut -d" " -f1)
|
||||
json_add_object "${macaddr//:/_}"
|
||||
json_add_string "ip" "$(echo ${client} | cut -d" " -f2)"
|
||||
json_add_string "macaddr" "$(echo ${client} | cut -d" " -f1)"
|
||||
json_add_string "host" "$(echo ${client} | cut -d" " -f3)"
|
||||
json_close_object
|
||||
done
|
||||
|
||||
IFS=' '
|
||||
echo `json_dump` > ${CLIENT_LIST}
|
||||
json_cleanup
|
||||
}
|
||||
|
||||
# Find the IP of a corresponding mac from arp table
|
||||
get_ipaddress() {
|
||||
local clients ip mac host
|
||||
|
||||
json_load "$(cat ${CLIENT_LIST})"
|
||||
json_get_keys keys
|
||||
|
||||
# jshn seems a bit iffy on having : in key, replace by _
|
||||
json_select "${1//:/_}" 2 > /dev/null
|
||||
json_get_var ip ip
|
||||
|
||||
echo "$ip"
|
||||
}
|
||||
|
||||
validate_rule_section()
|
||||
{
|
||||
uci_validate_section easy_qos rule "${1}" \
|
||||
'priority:string' \
|
||||
'macaddr:string' \
|
||||
'proto:string:none' \
|
||||
'port:list(uinteger)' \
|
||||
'comment:string:none'
|
||||
}
|
||||
|
||||
# Clear existing rules before applying new rules
|
||||
clear_existing_rules() {
|
||||
local rule=$(iptables -t mangle -S OUTPUT|grep -m 1 MARK |sed 's/-A/-D/1')
|
||||
while [ -n "${rule}" ]; do
|
||||
exec_log iptables -t mangle ${rule}
|
||||
rule=$(iptables -t mangle -S OUTPUT|grep -m 1 MARK |sed 's/-A/-D/1')
|
||||
done
|
||||
}
|
||||
|
||||
check_and_create() {
|
||||
iptables -t mangle -C OUTPUT ${@} 2>/dev/null
|
||||
# Create rule if not exists
|
||||
if [ ${?} -ne 0 ]; then
|
||||
exec_log iptables -t mangle -A OUTPUT ${@}
|
||||
else
|
||||
log "Rule exists for ${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
create_rule() {
|
||||
local proto=$1; shift
|
||||
local src_ip=$1; shift
|
||||
local mark="0x$1/0x$1"; shift
|
||||
local ports=$1;
|
||||
local cmd="";
|
||||
|
||||
cmd="-j MARK --set-xmark ${mark}";
|
||||
if [ -n "${ports}" ]; then
|
||||
cmd="--match multiport --dports ${ports} ${cmd}";
|
||||
fi
|
||||
|
||||
if [ "${proto}" == "icmp" ]; then
|
||||
cmd="-p icmp -m icmp --icmp-type 8 $cmd"
|
||||
elif [ "${proto}" == "all" ]; then
|
||||
cmd="-p all $cmd"
|
||||
else
|
||||
cmd="-p ${proto} -m ${proto} $cmd"
|
||||
fi
|
||||
cmd="-s ${src_ip} $cmd"
|
||||
|
||||
check_and_create ${cmd}
|
||||
}
|
||||
|
||||
manage_rule() {
|
||||
local cfg="$1"
|
||||
local priority macaddr proto port comment prio_num ip port_list
|
||||
|
||||
validate_rule_section "${1}" || {
|
||||
log "Validation of section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
prio_num=$(get_priority ${priority})
|
||||
ip=$(get_ipaddress ${macaddr})
|
||||
port_list=$(echo ${port}|sed 's/ /,/g')
|
||||
|
||||
if [ -n "${ip}" -a -n "${prio_num}" ]; then
|
||||
if [ "${proto}" == "none" -o "${proto}" == "tcpudp" ]; then
|
||||
create_rule tcp ${ip} ${prio_num} ${port_list}
|
||||
create_rule udp ${ip} ${prio_num} ${port_list}
|
||||
else
|
||||
create_rule ${proto} ${ip} ${prio_num} ${port_list}
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
clear_existing_rules
|
||||
map_client_entries
|
||||
config_load easy_qos
|
||||
config_foreach manage_rule rule
|
||||
clean_client_entries
|
||||
}
|
||||
|
||||
start_service() {
|
||||
reload_service
|
||||
echo "Easy QoS installed">/dev/console;
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "easy_qos"
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# Add firewall include
|
||||
uci -q batch <<-EOT
|
||||
delete firewall.easyqos
|
||||
set firewall.easyqos=include
|
||||
set firewall.easyqos.path=/etc/firewall.easyqos
|
||||
set firewall.easyqos.reload=1
|
||||
uci del_list firewall.easyqos._access_w="root"
|
||||
uci add_list firewall.easyqos._access_w="root"
|
||||
commit firewall
|
||||
EOT
|
||||
@@ -1,10 +0,0 @@
|
||||
if (PACKAGE_libwifix)
|
||||
menu "configurations"
|
||||
|
||||
config LIBWIFIX_DEBUG
|
||||
depends on PACKAGE_libwifix
|
||||
bool "Enable wifi debugging"
|
||||
default n
|
||||
|
||||
endmenu
|
||||
endif
|
||||
@@ -1,108 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2019 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=easy-soc-libs.deprecated
|
||||
PKG_VERSION:=1.0.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=b88afddd2f4cb216bfcd190f9096c138299c28e2
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/easy-soc-libs.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/easy-soc-libs.deprecated
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=IOPSYS easy SoC libraries (deprecated)
|
||||
SUBMENU:=IOPSYS easy SoC libraries (deprecated)
|
||||
DEPENDS:=+libopenssl
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/libwifix/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/libwifix
|
||||
$(call Package/easy-soc-libs.deprecated)
|
||||
TITLE:= WiFi library for wifix (deprecated)
|
||||
DEPENDS+=+libnl +libnl-route
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_mips),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCONFIG_BCM963138 \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx
|
||||
KERNEL_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCONFIG_BCM963138 \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
|
||||
TARGET_PLATFORM=MEDIATEK
|
||||
TARGET_CFLAGS +=-DIOPSYS_MEDIATEK
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_linksys),y)
|
||||
TARGET_PLATFORM=MARVELL
|
||||
TARGET_CFLAGS +=-DIOPSYS_MARVELL
|
||||
else ifeq ($(CONFIG_TARGET_intel_mips),y)
|
||||
TARGET_PLATFORM=INTEL
|
||||
TARGET_CFLAGS +=-DIOPSYS_INTEL
|
||||
else
|
||||
$(info Unexpected CONFIG_TARGET)
|
||||
endif
|
||||
|
||||
export TARGET_PLATFORM
|
||||
|
||||
ifdef CONFIG_LIBWIFIX_DEBUG
|
||||
TARGET_CFLAGS += -DIOP_LLA_LIBS_DEBUG
|
||||
endif
|
||||
|
||||
subdirs := \
|
||||
$(if $(CONFIG_PACKAGE_libwifix),libwifix)
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/openssl \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CFLAGS="$(TARGET_CFLAGS) -Wall -I./" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
FPIC="$(FPIC)" \
|
||||
PLATFORM="$(TARGET_PLATFORM)" \
|
||||
subdirs="$(subdirs)"
|
||||
|
||||
define Build/InstallDev/libwifix
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifix/wifi.h $(1)/usr/include/wifix.h
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifix/libwifi*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(call Build/Compile/Default)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(foreach dir,$(subdirs),$(call Build/InstallDev/$(dir),$(1),$(2));)
|
||||
endef
|
||||
|
||||
define Package/libwifix/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifix/libwifi*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libwifix))
|
||||
@@ -1,23 +0,0 @@
|
||||
if (PACKAGE_libwifi || PACKAGE_libdsl || PACKAGE_libethernet)
|
||||
menu "configurations"
|
||||
|
||||
config IOP_LLA_LIBS_DEBUG
|
||||
bool "Enable debugging support"
|
||||
default n
|
||||
|
||||
config LIBWIFI_DEBUG
|
||||
depends on PACKAGE_libwifi
|
||||
bool "Enable wifi debugging"
|
||||
default n
|
||||
|
||||
config LIBDSL_DEBUG
|
||||
depends on PACKAGE_libdsl
|
||||
bool "Enable xdsl debugging"
|
||||
default n
|
||||
|
||||
config LIBDSL_TEST
|
||||
depends on PACKAGE_libdsl
|
||||
bool "Libdsl test program"
|
||||
default n
|
||||
endmenu
|
||||
endif
|
||||
@@ -1,164 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2019 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=easy-soc-libs
|
||||
PKG_VERSION:=2.4.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=30f5527ae724d54537c803127e11992d1a5ae154
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/easy-soc-libs.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
endif
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/easy-soc-libs
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=IOPSYS easy SoC libraries
|
||||
SUBMENU:=IOPSYS easy SoC libraries
|
||||
DEPENDS:=+libopenssl
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/libwifi/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/libwifi
|
||||
$(call Package/easy-soc-libs)
|
||||
TITLE:= WiFi library (libwifi)
|
||||
DEPENDS+=+libnl +libnl-route
|
||||
endef
|
||||
|
||||
define Package/libethernet
|
||||
$(call Package/easy-soc-libs)
|
||||
TITLE:= Ethernet library (libethernet)
|
||||
DEPENDS+=+TARGET_iopsys_ramips:swconfig
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_mips),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCONFIG_BCM963138 \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx
|
||||
KERNEL_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCONFIG_BCM963138 \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
|
||||
TARGET_PLATFORM=MEDIATEK
|
||||
TARGET_CFLAGS +=-DIOPSYS_MEDIATEK
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_linksys),y)
|
||||
TARGET_PLATFORM=MARVELL
|
||||
TARGET_CFLAGS +=-DIOPSYS_MARVELL
|
||||
else ifeq ($(CONFIG_TARGET_intel_mips),y)
|
||||
TARGET_PLATFORM=INTEL
|
||||
TARGET_CFLAGS +=-DIOPSYS_INTEL
|
||||
else
|
||||
$(info Unexpected CONFIG_TARGET)
|
||||
endif
|
||||
|
||||
export TARGET_PLATFORM
|
||||
|
||||
ifdef CONFIG_IOP_LLA_LIBS_DEBUG
|
||||
TARGET_CFLAGS += -DIOP_LLA_LIBS_DEBUG
|
||||
endif
|
||||
|
||||
define Package/libdsl
|
||||
$(call Package/easy-soc-libs)
|
||||
TITLE:= XDSL library (libdsl)
|
||||
DEPENDS+=+TARGET_intel_mips:dsl-cpe-api-vrx +TARGET_intel_mips:dsl-cpe-fapi +TARGET_intel_mips:kmod-ppa-drv
|
||||
endef
|
||||
|
||||
subdirs := \
|
||||
$(if $(CONFIG_PACKAGE_libwifi),libwifi) \
|
||||
$(if $(CONFIG_PACKAGE_libdsl),libdsl) \
|
||||
$(if $(CONFIG_PACKAGE_libethernet),libethernet)
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/openssl \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CFLAGS="$(TARGET_CFLAGS) -Wall -I./" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
FPIC="$(FPIC)" \
|
||||
PLATFORM="$(TARGET_PLATFORM)" \
|
||||
subdirs="$(subdirs)"
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
rsync -r --exclude=.* ~/git/easy-soc-libs/ $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/InstallDev/libwifi
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/wifi.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Build/InstallDev/libdsl
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libdsl/xdsl.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libdsl/libdsl.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Build/InstallDev/libethernet
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libethernet/ethernet.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libethernet/libethernet.so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(call Build/Compile/Default)
|
||||
ifeq ($(CONFIG_LIBDSL_TEST),y)
|
||||
$(MAKE) -C "$(PKG_BUILD_DIR)/libdsl/test" $(MAKE_FLAGS)
|
||||
endif
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(foreach dir,$(subdirs),$(call Build/InstallDev/$(dir),$(1),$(2));)
|
||||
endef
|
||||
|
||||
define Package/libwifi/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libethernet/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libethernet/libethernet.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libdsl/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(CP) $(PKG_BUILD_DIR)/libdsl/libdsl.so* $(1)/usr/lib/
|
||||
ifeq ($(CONFIG_LIBDSL_TEST),y)
|
||||
$(CP) $(PKG_BUILD_DIR)/libdsl/test/libdsl_test $(1)/usr/bin/
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libwifi))
|
||||
$(eval $(call BuildPackage,libdsl))
|
||||
$(eval $(call BuildPackage,libethernet))
|
||||
46
endptcfg-open/Makefile
Normal file
46
endptcfg-open/Makefile
Normal file
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# Copyright (C) 2006-2008 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=endptcfg-open
|
||||
PKG_VERSION:=15-06-24
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://ihgsp.inteno.se/ihgsp/consumer/
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
|
||||
define Package/endptcfg-open
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Broadcom endpoint driver configuration application pre compiled for open SDK
|
||||
URL:=
|
||||
endef
|
||||
|
||||
define Package/endptcfg-open/description
|
||||
Broadcom endpoint driver configuration application pre compiled for open SDK
|
||||
endef
|
||||
|
||||
|
||||
|
||||
define Package/endptcfg-open/install
|
||||
mkdir -p $(1)/usr/bin/
|
||||
ifeq ($(CONFIG_BCM_CHIP_ID),"63138")
|
||||
$(CP) $(PKG_BUILD_DIR)/endptcfg_arm $(1)/usr/bin/endptcfg
|
||||
|
||||
else
|
||||
$(CP) $(PKG_BUILD_DIR)/endptcfg_mips $(1)/usr/bin/endptcfg
|
||||
endif
|
||||
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,endptcfg-open))
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
config ENDPT_OPEN
|
||||
bool "Use pre-compiled version for Open SDK"
|
||||
default n
|
||||
@@ -1,69 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2018 IOPSYS Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=0.2
|
||||
PKG_SOURCE_VERSION:=631e61b7ab5d86f2f4c86756a117badff9fb0f2c
|
||||
|
||||
|
||||
ifeq ($(CONFIG_ENDPT_OPEN),y)
|
||||
BRCM_KERNEL_PROFILE=$(shell echo $(CONFIG_BCM_KERNEL_PROFILE) | sed s/\"//g)
|
||||
PKG_SOURCE:=endptmngr-$(BRCM_KERNEL_PROFILE)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://download.iopsys.eu/iopsys/opensdk/
|
||||
PKG_NAME:=endptmngr-open
|
||||
else
|
||||
PKG_SOURCE_URL:=git@dev.iopsys.eu:iopsys/endptmngr
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_NAME:=endptmngr
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
endif
|
||||
|
||||
RSTRIP:=true
|
||||
export BUILD_DIR
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/endptmngr/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/endptmngr
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Brcmslic
|
||||
URL:=
|
||||
DEPENDS:= +libubox +ubus +libpicoevent +PACKAGE_bcmkernel:bcmkernel +PACKAGE_bcmopen:bcmopen
|
||||
endef
|
||||
|
||||
define Package/endptmngr/description
|
||||
endptmngr
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_ENDPT_OPEN),y)
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
endif
|
||||
|
||||
|
||||
define Package/endptmngr/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
cp $(PKG_BUILD_DIR)/files/etc/init.d/* $(1)/etc/init.d/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/endptmngr $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,endptmngr))
|
||||
@@ -1,61 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=fatrace
|
||||
PKG_VERSION:=0.12
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=98af6019a4a1b478a6fa35f74528cb3cd404ae40
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://git.launchpad.net/fatrace
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPL-3.0
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
# support parallel build
|
||||
#PKG_BUILD_PARALLEL:=1
|
||||
|
||||
#re create configure scripts if not present.
|
||||
#PKG_FIXUP:=autoreconf
|
||||
|
||||
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
|
||||
# this way we don't need to pick out the resulting files from the build dir.
|
||||
PKG_INSTALL:=1
|
||||
|
||||
PKG_CONFIG_DEPENDS := CONFIG_KERNEL_FANOTIFY
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fatrace
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Report system wide file access events
|
||||
URL:=
|
||||
DEPENDS := +@KERNEL_FANOTIFY
|
||||
endef
|
||||
|
||||
define Package/fatrace/description
|
||||
Report system wide file access events.
|
||||
endef
|
||||
|
||||
MAKE_INSTALL_FLAGS += PREFIX="/"
|
||||
|
||||
define Package/fatrace/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/fatrace $(1)/sbin/
|
||||
# $(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fatrace))
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
diff --git a/fatrace.c b/fatrace.c
|
||||
index 1c0899a..b7d1560 100644
|
||||
--- a/fatrace.c
|
||||
+++ b/fatrace.c
|
||||
@@ -44,7 +44,8 @@
|
||||
* http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=1e2ee49f7
|
||||
* O_LARGEFILE is usually 0, so hardcode it here
|
||||
*/
|
||||
-#define KERNEL_O_LARGEFILE 00100000
|
||||
+//#define KERNEL_O_LARGEFILE 00100000
|
||||
+#define KERNEL_O_LARGEFILE O_LARGEFILE
|
||||
|
||||
/* command line options */
|
||||
static char* option_output = NULL;
|
||||
@@ -1,12 +0,0 @@
|
||||
diff --git a/fatrace.c b/fatrace.c
|
||||
index b7d1560..6179272 100644
|
||||
--- a/fatrace.c
|
||||
+++ b/fatrace.c
|
||||
@@ -149,6 +149,7 @@ print_event(const struct fanotify_event_metadata *data,
|
||||
printf ("%li.%06li ", event_time->tv_sec, event_time->tv_usec);
|
||||
}
|
||||
printf ("%s(%i): %s %s\n", procname, data->pid, mask2str (data->mask), pathname);
|
||||
+ fflush(stdout);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1,54 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2016 Nikil Mehta <nikil.mehta@gmail.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fping
|
||||
PKG_VERSION:=4.0
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://fping.org/dist/
|
||||
PKG_HASH:=67eb4152b98ad34f99d2eec4e1098a0bb52caf13c0c89cd147349d08190fe8ce
|
||||
|
||||
PKG_MAINTAINER:=Nikil Mehta <nikil.mehta@gmail.com>
|
||||
PKG_LICENSE:=BSD-4-Clause
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fping
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=sends ICMP ECHO_REQUEST packets to network hosts
|
||||
URL:=http://fping.org/
|
||||
endef
|
||||
|
||||
|
||||
define Package/fping/description
|
||||
fping is a ping like program which uses the Internet Control Message Protocol
|
||||
(ICMP) echo request to determine if a target host is responding. fping
|
||||
differs from ping in that you can specify any number of targets on the command
|
||||
line, or specify a file containing the lists of targets to ping. Instead of
|
||||
sending to one target until it times out or replies, fping will send out a
|
||||
ping packet and move on to the next target in a round-robin fashion.
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS+= \
|
||||
--enable-ipv4 \
|
||||
--enable-ipv6
|
||||
|
||||
TARGET_CFLAGS += -std=gnu99
|
||||
|
||||
define Package/fping/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fping $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fping))
|
||||
@@ -1,62 +0,0 @@
|
||||
# Copyright (c) 2017 Genexis B.V.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=gryphon-led-kernel-module
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/$(PKG_NAME)
|
||||
SUBMENU:=LED modules
|
||||
TITLE:=LED driver for Gryphon
|
||||
FILES:=$(PKG_BUILD_DIR)/$(PKG_NAME).$(LINUX_KMOD_SUFFIX)
|
||||
KCONFIG:=CONFIG_PACKAGE_kmod-gryphon-led-kernel-module=y
|
||||
AUTOLOAD:=$(call AutoLoad,60,$(PKG_NAME))
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_URL:=
|
||||
endef
|
||||
|
||||
define KernelPackage/$(PKG_NAME)/description
|
||||
This package contains the LED driver for Gryphon devices.
|
||||
endef
|
||||
|
||||
EXTRA_KCONFIG:= CONFIG_RGB_LED=m
|
||||
|
||||
MODULE_INCLUDE=-I$(PKG_BUILD_DIR)
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)/kdevlinks/
|
||||
$(CP) -s `pwd`/src/* $(PKG_BUILD_DIR)/kdevlinks/
|
||||
$(CP) src/* $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C "$(LINUX_DIR)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
SUBDIRS="$(PKG_BUILD_DIR)" \
|
||||
EXTRA_CFLAGS="-DKERNEL_MODULE $(BUILDFLAGS) -I$(LINUX_DIR)/include -include generated/autoconf.h $(MODULE_INCLUDE)" \
|
||||
modules
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,$(PKG_NAME)))
|
||||
@@ -1,26 +0,0 @@
|
||||
# Copyright (c) 2017 Genexis B.V.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
|
||||
MODULE_NAME = gryphon-led-kernel-module
|
||||
|
||||
obj-m := $(MODULE_NAME).o
|
||||
|
||||
GENEXIS_FILES= \
|
||||
main.o \
|
||||
sk9822.o \
|
||||
sk9822_bitbang.o
|
||||
|
||||
$(MODULE_NAME)-objs := $(GENEXIS_FILES)
|
||||
@@ -1,253 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Genexis B.V.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#define DEBUG 1
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/printk.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#include "sk9822.h"
|
||||
|
||||
#define DRIVER_NAME "canyon_led"
|
||||
#define DRIVER_AUTHOR "Genexis B.V."
|
||||
#define DRIVER_DESC "Canyon LED driver for SK9822"
|
||||
#define DRIVER_VERSION "1"
|
||||
|
||||
/**
|
||||
* sysfs interfaces
|
||||
*/
|
||||
|
||||
static ssize_t get_led_color(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
/* [ln] todo: dummy implementation */
|
||||
int len;
|
||||
|
||||
len = sprintf(buf, "%d\n", 123);
|
||||
if (len <= 0) {
|
||||
dev_err(dev, "sk9822: Invalid sprintf len: %d\n", len);
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set complete LED strip to a specific color
|
||||
* @retval count number of bytes written
|
||||
* @retval -EMSGSIZE if the message is too big
|
||||
* @retval -EIO for all other errors (e.g. leds cannot be configured)
|
||||
*/
|
||||
static ssize_t set_led_color(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
int ret = 0;
|
||||
size_t buflen = count;
|
||||
struct sk9822_leds *sk9822 = dev_get_drvdata(dev);
|
||||
|
||||
if (IS_ERR(sk9822)) {
|
||||
printk(KERN_ERR "Platform get drvdata returned NULL\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* strip newline */
|
||||
if ((count > 0) && (buf[count-1] == '\n')) {
|
||||
buflen--;
|
||||
}
|
||||
|
||||
if (buflen != 6) { // RRGGBB\0
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
|
||||
// Update the LED array here
|
||||
ret = sk9822_set_color_str(sk9822, buf);
|
||||
if (ret != 0) {
|
||||
printk(KERN_ERR "Failed to set led color\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
// Now push to the HW
|
||||
ret = sk9822_update(sk9822);
|
||||
if (ret != 0) {
|
||||
printk(KERN_ERR "Failed to update led\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
static DEVICE_ATTR(led_color, S_IRUGO | S_IWUSR, get_led_color, set_led_color);
|
||||
|
||||
static struct attribute *sk9822_dev_attrs[] = {
|
||||
&dev_attr_led_color.attr,
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct attribute_group sk9822_dev_attr_group = {
|
||||
.name = "sk9822",
|
||||
.attrs = sk9822_dev_attrs,
|
||||
};
|
||||
|
||||
/**
|
||||
* device prope and removal
|
||||
*/
|
||||
|
||||
static int canyon_led_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret;
|
||||
struct sk9822_leds *leds;
|
||||
|
||||
leds = devm_kzalloc(&pdev->dev, sizeof(*leds), GFP_KERNEL);
|
||||
if (!leds) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
leds->dev = &pdev->dev;
|
||||
leds->led_brightness = SK9822_DEFAULT_BRIGHTNESS;
|
||||
|
||||
ret = of_property_read_u16(pdev->dev.of_node, "led-count", &leds->led_count);
|
||||
if (ret < 0) {
|
||||
dev_warn(&pdev->dev, "Could not read led-count property\n");
|
||||
leds->led_count = SK9822_DEFAULT_NUM_LEDS;
|
||||
}
|
||||
|
||||
leds->led_colors = devm_kzalloc(&pdev->dev,
|
||||
(sizeof(cRGB) * leds->led_count), GFP_KERNEL);
|
||||
if (!leds->led_colors) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
||||
platform_set_drvdata(pdev, leds);
|
||||
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 16, 0)
|
||||
leds->clock_gpio = gpiod_get_index(&pdev->dev, "led", 0);
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
|
||||
leds->clock_gpio = gpiod_get_index(&pdev->dev, "led", 0, GPIOD_OUT_HIGH);
|
||||
#else
|
||||
dev_warn(&pdev->dev, "Kernel version Not supported\n");
|
||||
exit(1);
|
||||
#endif
|
||||
|
||||
gpiod_direction_output(leds->clock_gpio, 1);
|
||||
if (IS_ERR(leds->clock_gpio)) {
|
||||
dev_err(&pdev->dev, "Failed to acquire clock GPIO %ld\n",
|
||||
PTR_ERR(leds->clock_gpio));
|
||||
leds->clock_gpio = NULL;
|
||||
return PTR_ERR(leds->clock_gpio);
|
||||
} else {
|
||||
printk(KERN_INFO "Got clock gpio\n");
|
||||
gpiod_set_value(leds->clock_gpio, 0);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 16, 0)
|
||||
leds->data_gpio = gpiod_get_index(&pdev->dev, "led", 1);
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
|
||||
leds->data_gpio = gpiod_get_index(&pdev->dev, "led", 1, GPIOD_OUT_HIGH);
|
||||
#else
|
||||
dev_warn(&pdev->dev, "Kernel version Not supported\n");
|
||||
exit(1);
|
||||
#endif
|
||||
|
||||
gpiod_direction_output(leds->data_gpio, 1);
|
||||
if (IS_ERR(leds->data_gpio)) {
|
||||
dev_err(&pdev->dev, "Failed to acquire data GPIO %ld\n",
|
||||
PTR_ERR(leds->data_gpio));
|
||||
leds->data_gpio = NULL;
|
||||
return PTR_ERR(leds->data_gpio);
|
||||
} else {
|
||||
printk(KERN_INFO "Got data gpio\n");
|
||||
gpiod_set_value(leds->data_gpio, 0);
|
||||
}
|
||||
|
||||
printk(KERN_INFO "Attempt to set filefs stuff\n");
|
||||
ret = sysfs_create_group(&pdev->dev.kobj, &sk9822_dev_attr_group);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "sysfs creation failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if 0
|
||||
printk(KERN_INFO "Flash LEDs to verify they work\n");
|
||||
sk9822_set_color_str(leds, "00FF00");
|
||||
sk9822_update(leds);
|
||||
msleep(200);
|
||||
sk9822_set_color_str(leds, "000000");
|
||||
sk9822_update(leds);
|
||||
#endif
|
||||
|
||||
printk(KERN_INFO "canyon led successfully probed\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int canyon_led_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct sk9822_leds *leds;
|
||||
|
||||
sysfs_remove_group(&pdev->dev.kobj, &sk9822_dev_attr_group);
|
||||
|
||||
leds = platform_get_drvdata(pdev);
|
||||
if (IS_ERR(leds)) {
|
||||
printk(KERN_ERR "Platform get drvdata returned NULL\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (leds->clock_gpio) {
|
||||
gpiod_put(leds->clock_gpio);
|
||||
}
|
||||
|
||||
if (leds->data_gpio) {
|
||||
gpiod_put(leds->data_gpio);
|
||||
}
|
||||
|
||||
printk(KERN_NOTICE "Bye, bye\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* platform driver metadata
|
||||
*/
|
||||
|
||||
static const struct of_device_id canyon_led_of_ids[] = {
|
||||
{ .compatible = "canyon,led" },
|
||||
{ }
|
||||
};
|
||||
|
||||
static struct platform_driver canyon_led = {
|
||||
.probe = &canyon_led_probe,
|
||||
.remove = &canyon_led_remove,
|
||||
.driver = {
|
||||
.name = DRIVER_NAME,
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = canyon_led_of_ids,
|
||||
},
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(of, canyon_led_of_ids);
|
||||
module_platform_driver(canyon_led);
|
||||
MODULE_AUTHOR(DRIVER_AUTHOR);
|
||||
MODULE_DESCRIPTION(DRIVER_DESC);
|
||||
MODULE_VERSION(DRIVER_VERSION);
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Genexis B.V.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include "sk9822.h"
|
||||
#include "sk9822_bitbang.h"
|
||||
|
||||
cRGB __hexs_to_rgb(const char *hex)
|
||||
{
|
||||
cRGB rgb;
|
||||
int r, g, b;
|
||||
|
||||
sscanf(hex, "%02x%02x%02x", &r, &g, &b);
|
||||
// This needs sanity checking
|
||||
rgb.r = r;
|
||||
rgb.g = g;
|
||||
rgb.b = b;
|
||||
return rgb;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief update the color over the given device struct to the provided HEX color
|
||||
*/
|
||||
int sk9822_set_color_str(struct sk9822_leds *sk9822, const char *hex)
|
||||
{
|
||||
int i;
|
||||
cRGB color = __hexs_to_rgb(hex);
|
||||
|
||||
for (i = 0; i < sk9822->led_count; i++) {
|
||||
sk9822->led_colors[i] = color;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief write device struct to the device
|
||||
*/
|
||||
int sk9822_update(struct sk9822_leds *sk9822)
|
||||
{
|
||||
uint16_t i;
|
||||
uint16_t led_count = sk9822->led_count;
|
||||
|
||||
// Start Frame
|
||||
sk9822_bb_write(sk9822, 0x00);
|
||||
sk9822_bb_write(sk9822, 0x00);
|
||||
sk9822_bb_write(sk9822, 0x00);
|
||||
sk9822_bb_write(sk9822, 0x00);
|
||||
|
||||
for (i = 0; i < led_count; i++) {
|
||||
cRGB *p = &sk9822->led_colors[i];
|
||||
sk9822_bb_write(sk9822, 0xe0+sk9822->led_brightness); // Maximum global brightness
|
||||
sk9822_bb_write(sk9822, p->b);
|
||||
sk9822_bb_write(sk9822, p->g);
|
||||
sk9822_bb_write(sk9822, p->r);
|
||||
}
|
||||
|
||||
// End frame
|
||||
sk9822_bb_write(sk9822, 0xff);
|
||||
sk9822_bb_write(sk9822, 0xff);
|
||||
sk9822_bb_write(sk9822, 0xff);
|
||||
sk9822_bb_write(sk9822, 0xff);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Genexis B.V.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef SK9822_H_
|
||||
#define SK9822_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define SK9822_DEFAULT_NUM_LEDS 32 // U16, used if DT param fails
|
||||
#define SK9822_DEFAULT_BRIGHTNESS 15 // 5-bit brightness, 0-31
|
||||
|
||||
typedef struct {
|
||||
uint8_t b;
|
||||
uint8_t g;
|
||||
uint8_t r;
|
||||
} cRGB; // BGR (SK9822 Standard)
|
||||
|
||||
struct sk9822_leds {
|
||||
struct device *dev;
|
||||
struct gpio_desc *clock_gpio;
|
||||
struct gpio_desc *data_gpio;
|
||||
|
||||
cRGB *led_colors;
|
||||
uint8_t led_brightness;
|
||||
uint16_t led_count;
|
||||
};
|
||||
|
||||
int sk9822_set_color_str(struct sk9822_leds *sk9822, const char *hex);
|
||||
int sk9822_update(struct sk9822_leds *sk9822);
|
||||
|
||||
#endif /* SK9822_H_ */
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Genexis B.V.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include "sk9822.h"
|
||||
|
||||
/**
|
||||
* @brief Bitbang write operation CLOCK+DATA
|
||||
*
|
||||
* Assumed state before call: CLOCK- Low, DATA- High
|
||||
*/
|
||||
void sk9822_bb_write(struct sk9822_leds *sk9822, uint8_t c)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < 8 ; i++) {
|
||||
if (!(c&0x80)) {
|
||||
gpiod_set_value(sk9822->data_gpio, 0); // set data low
|
||||
} else {
|
||||
gpiod_set_value(sk9822->data_gpio, 1); // set data high
|
||||
}
|
||||
|
||||
gpiod_set_value(sk9822->clock_gpio, 1); // set clock high, data sampled here
|
||||
c <<= 1;
|
||||
udelay(1); // stretch clock
|
||||
gpiod_set_value(sk9822->clock_gpio, 0); // set clock low
|
||||
}
|
||||
|
||||
// State after call: SCK Low, Data high
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Genexis B.V.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _SK9822_BB_H_
|
||||
#define _SK9822_BB_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#include "sk9822.h"
|
||||
|
||||
void sk9822_bb_write(struct sk9822_leds *sk9822, uint8_t c);
|
||||
|
||||
#endif /* _SK9822_BB_H_ */
|
||||
874
ice-client/Makefile
Normal file
874
ice-client/Makefile
Normal file
@@ -0,0 +1,874 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
# We use the foldername as main package name
|
||||
PKG_NAME:=ice-client
|
||||
|
||||
CFMODULES:=$(filter CONFIG_PACKAGE_$(PKG_NAME)-%,$(.VARIABLES))
|
||||
CFMODULES:=$(subst CONFIG_PACKAGE_$(PKG_NAME)-,,$(CFMODULES))
|
||||
$(info Building package: $(PKG_NAME))
|
||||
$(info Building with additional modules: $(CFMODULES))
|
||||
export CFMODULES
|
||||
|
||||
export HOME_DIR:=$(TOPDIR)
|
||||
|
||||
export PLATFORM_INCLUDE:=platforms/iopsys/build.mk
|
||||
|
||||
export DATE:=$(shell date +%Y-%m-%d-%H-%M-%S)
|
||||
export LOGIN:=$(shell whoami)
|
||||
BASE_PKG_VERSION:=3.4.0
|
||||
PKG_RELEASE:=RC6
|
||||
PKG_VERSION:=$(BASE_PKG_VERSION)-$(PKG_RELEASE)_$(DATE)_$(LOGIN)
|
||||
export PKG_VERSION
|
||||
|
||||
###########################--RELEASE--################################
|
||||
|
||||
PKG_SOURCE_URL:=ssh://git@iopsys.inteno.se/ice-client.git
|
||||
PKG_SOURCE_VERSION:=e860a7697ac8d6029cd1f75e1df9885e1d4131f5
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(BASE_PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(BASE_PKG_VERSION)-$(PKG_RELEASE).tar.gz
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(BASE_PKG_VERSION)
|
||||
|
||||
|
||||
###########################--RELEASE--################################
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ice-client/Default
|
||||
CATEGORY:=Utilities
|
||||
URL:=http://inteno.se/
|
||||
DEPENDS:= ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=ice-client
|
||||
MENU:=1
|
||||
DEPENDS:=+libopenssl +libstdcpp +libubus +ubus +ubusd +jshn +libubox +libpthread +libjson-c
|
||||
endef
|
||||
|
||||
###########################--DEVELOPMENT--################################
|
||||
# Development settings
|
||||
# Uncomment stuff Build/Prepare
|
||||
#
|
||||
# Plus make sure to comment and provide the following lines above
|
||||
# #PKG_SOURCE_URL:=ssh://git@iopsys.inteno.se/ice-client.git
|
||||
# #PKG_SOURCE_VERSION:=a11bf64e6b1054803b52750aabd71bf440ff6e16
|
||||
# #PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(BASE_PKG_VERSION)
|
||||
# #PKG_SOURCE:=$(PKG_NAME)-$(BASE_PKG_VERSION)-$(PKG_RELEASE).tar.gz
|
||||
#
|
||||
# PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(BASE_PKG_VERSION)
|
||||
#
|
||||
#
|
||||
# These settings allow you to specify a soruce folder where your source code is located
|
||||
# This avoids having to tar-zip or fetch from git each time
|
||||
# Changes can be done in your sources while the build is performed somewhere else
|
||||
# If you forget some settings, your source folder will be deleted!!! So be carefull and
|
||||
# check in or backup your sources first before doing this.
|
||||
#
|
||||
#define Build/Prepare
|
||||
# rm -rf $(PKG_BUILD_DIR)
|
||||
# ln -s /home/erik/Desktop/ice-client $(PKG_BUILD_DIR)
|
||||
## ln -s /home/erik/Desktop/checkCompilation/iopsys-client $(PKG_BUILD_DIR)
|
||||
#endef
|
||||
|
||||
###########################--DEVELOPMENT--################################
|
||||
|
||||
|
||||
#
|
||||
# Specify where and how to install the program. Since we only have one file,
|
||||
# the helloworld executable, install it by copying it to the /bin directory on
|
||||
# the router. The $(1) variable represents the root directory on the router running
|
||||
# OpenWrt. The $(INSTALL_DIR) variable contains a command to prepare the install
|
||||
# directory if it does not already exist. Likewise $(INSTALL_BIN) contains the
|
||||
# command to copy the binary file from its current location (in our case the build
|
||||
# directory) to the install directory.
|
||||
|
||||
define Build/Configure
|
||||
echo $(BASE_PKG_VERSION)-$(PKG_RELEASE) > $(PKG_BUILD_DIR)/core/version.txt
|
||||
echo $(DATE) > $(PKG_BUILD_DIR)/core/date.txt
|
||||
echo $(LOGIN) > $(PKG_BUILD_DIR)/core/login.txt
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) config
|
||||
endef
|
||||
|
||||
define Build/Clean
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) clean
|
||||
endef
|
||||
|
||||
define Package/ice-client/preinst
|
||||
#!/bin/sh
|
||||
echo "backup current config"
|
||||
cp /etc/iopsys/server.ini /tmp/iopsysserver.ini
|
||||
cp /etc/config/ice /tmp/ice.back
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client/install
|
||||
$(INSTALL_DIR) $(1)/bin
|
||||
$(CP) $(PKG_BUILD_DIR)/core/ice $(1)/bin
|
||||
$(CP) $(PKG_BUILD_DIR)/modules/system/ubusevent/obj/iopsys/ubusevent $(1)/bin
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/{systemService.so.1.0.1,libconfStore.so.1,networkService.so.1.0.1,packageService.so.1.0.1,monitorService.so.1.0.1,iperfService.so.1.0.1,logService.so.1.0.1} $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/bin/ifs/iperf/execute
|
||||
$(INSTALL_DIR) $(1)/bin/ifs/iperf/progress
|
||||
$(INSTALL_DIR) $(1)/bin/ifs/iperf/result
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/scheduleiperf.sh $(1)/bin/ifs/iperf/execute
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/etc/config/ice $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/iopsys
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/server.ini $(1)/etc/iopsys
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/modify.ini $(1)/etc/iopsys
|
||||
$(INSTALL_DIR) $(1)/etc/iopsys/certificates
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/cert_server_ca.pem $(1)/etc/iopsys/certificates
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/inteno_root_ca.pem $(1)/etc/iopsys/certificates
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/ice-client $(1)/etc/init.d/ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client/postinst
|
||||
#!/bin/sh
|
||||
echo "Enabling rc.d symlink for iopsys"
|
||||
cp /tmp/iopsysserver.ini /etc/iopsys/server.ini
|
||||
rm -f /tmp/iopsysserver.ini
|
||||
cp /tmp/ice.back /etc/config/ice
|
||||
rm -f /tmp/ice.back
|
||||
if [ -f "/etc/rc.d/S99ice-client" ]; then
|
||||
/etc/init.d/ice-client start
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# Additional modules
|
||||
|
||||
# Camerawatch
|
||||
define Package/ice-client-camerawatch
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=Camerawatch
|
||||
DEPENDS+= +libjpeg
|
||||
endef
|
||||
|
||||
define Package/ice-client-camerawatch/description
|
||||
Camerawatch module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-camerawatch/prerm
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
/bin/echo "system moduleRemove topic=cameramanager" > /tmp/cfin
|
||||
/bin/sleep 3
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-camerawatch/preinst
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
/bin/echo "system moduleRemove topic=cameramanager" > /tmp/cfin
|
||||
/bin/sleep 3
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-camerawatch/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/etc/iopsys
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/camerawatch.so.1.0.1 $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define Package/ice-client-camerawatch/postinst
|
||||
#!/bin/sh
|
||||
read -t 1 <>/tmp/cfout
|
||||
if [ -f /tmp/ice.pid ]; then
|
||||
/bin/echo "system moduleAdd file=camerawatch.so.1.0.1" package="ice-client-camerawatch" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# Guest
|
||||
define Package/ice-client-guest
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=Guest
|
||||
DEPENDS+=
|
||||
endef
|
||||
|
||||
define Package/ice-client-guest/description
|
||||
Guest module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-guest/prerm
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
/bin/echo "system moduleRemove topic=guestMgr" > /tmp/cfin
|
||||
/bin/sleep 3
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-guest/preinst
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
/bin/echo "system moduleRemove topic=guestMgr" > /tmp/cfin
|
||||
/bin/sleep 3
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-guest/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/guestService.so.1.0.1 $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define Package/ice-client-guest/postinst
|
||||
#!/bin/sh
|
||||
read -t 1 <>/tmp/cfout
|
||||
if [ -f /tmp/ice.pid ]; then
|
||||
/bin/echo "system moduleAdd file=guestService.so.1.0.1" package="ice-client-guest" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# OpenVPN
|
||||
define Package/ice-client-openvpn
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=OpenVPN
|
||||
DEPENDS+= +openvpn
|
||||
endef
|
||||
|
||||
define Package/ice-client-openvpn/description
|
||||
OpenVPN module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-openvpn/prerm
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
/bin/echo "system moduleRemove topic=ovpnMgr" > /tmp/cfin
|
||||
/bin/sleep 3
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-openvpn/preinst
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
/bin/echo "system moduleRemove topic=ovpnMgr" > /tmp/cfin
|
||||
/bin/sleep 3
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-openvpn/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/ovpnService.so.1.0.1 $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define Package/ice-client-openvpn/postinst
|
||||
#!/bin/sh
|
||||
read -t 1 <>/tmp/cfout
|
||||
if [ -f /tmp/ice.pid ]; then
|
||||
/bin/echo "system moduleAdd file=ovpnService.so.1.0.1" package="ice-client-openvpn" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# Anyfi
|
||||
define Package/ice-client-anyfi
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=AnyFi
|
||||
DEPENDS+=
|
||||
endef
|
||||
|
||||
define Package/ice-client-anyfi/description
|
||||
AnyFi module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-anyfi/prerm
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
/bin/echo "system moduleRemove topic=anyfiMgr" > /tmp/cfin
|
||||
/bin/sleep 3
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-anyfi/preinst
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
/bin/echo "system moduleRemove topic=anyfiMgr" > /tmp/cfin
|
||||
/bin/sleep 3
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-anyfi/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/anyfiService.so.1.0.1 $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define Package/ice-client-anyfi/postinst
|
||||
#!/bin/sh
|
||||
read -t 1 <>/tmp/cfout
|
||||
if [ -f /tmp/ice.pid ]; then
|
||||
/bin/echo "system moduleAdd file=anyfiService.so.1.0.1" package="ice-client-anyfi" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# Netrounds
|
||||
define Package/ice-client-netrounds
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=Netrounds
|
||||
DEPENDS+=
|
||||
endef
|
||||
|
||||
define Package/ice-client-netrounds/description
|
||||
Netrounds module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-netrounds/prerm
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
/bin/echo "system moduleRemove topic=netroundsMgr" > /tmp/cfin
|
||||
/bin/sleep 3
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-netrounds/preinst
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
/bin/echo "system moduleRemove topic=netroundsMgr" > /tmp/cfin
|
||||
/bin/sleep 3
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-netrounds/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/netroundsService.so.1.0.1 $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define Package/ice-client-netrounds/postinst
|
||||
#!/bin/sh
|
||||
read -t 1 <>/tmp/cfout
|
||||
if [ -f /tmp/ice.pid ]; then
|
||||
/bin/echo "system moduleAdd file=netroundsService.so.1.0.1" package="ice-client-netrounds" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# Logreader
|
||||
define Package/ice-client-logreader
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=LogReader
|
||||
DEPENDS+=
|
||||
endef
|
||||
|
||||
define Package/ice-client-logreader/description
|
||||
Logread module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-logreader/prerm
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
/bin/echo "system moduleRemove topic=log" > /tmp/cfin
|
||||
/bin/sleep 3
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-logreader/preinst
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
/bin/echo "system moduleRemove topic=log" > /tmp/cfin
|
||||
/bin/sleep 3
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-logreader/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/logService.so.1.0.1 $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define Package/ice-client-logreader/postinst
|
||||
#!/bin/sh
|
||||
read -t 1 <>/tmp/cfout
|
||||
if [ -f /tmp/ice.pid ]; then
|
||||
echo "system moduleAdd file=logService.so.1.0.1" package="ice-client-logreader" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
# fileme
|
||||
define Package/ice-client-fileme
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=FileMe
|
||||
DEPENDS+= +lighttpd +samba2-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-fileme/description
|
||||
FileMe module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-fileme/prerm
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=fileMeMgr" > /tmp/cfin
|
||||
/bin/sleep 2
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-fileme/preinst
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=fileMeMgr" > /tmp/cfin
|
||||
/bin/sleep 2
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-fileme/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/filemeService.so.1.0.1 $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/etc/iopsys/fileme/lighttpd/conf.d
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/fileme/mime.conf $(1)/etc/iopsys/fileme/lighttpd
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/fileme/conf.d/10-webdav.conf $(1)/etc/iopsys/fileme/lighttpd/conf.d
|
||||
$(INSTALL_DIR) $(1)/etc/iopsys/fileme/docroot/dav
|
||||
$(INSTALL_DIR) $(1)/etc/iopsys/fileme/docroot/shares
|
||||
endef
|
||||
|
||||
define Package/ice-client-fileme/postinst
|
||||
#!/bin/sh
|
||||
read -t 1 <>/tmp/cfout
|
||||
if [ -f /tmp/ice.pid ]; then
|
||||
echo "system moduleAdd file=filemeService.so.1.0.1" package="ice-client-fileme" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# example
|
||||
define Package/ice-client-example
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=example
|
||||
DEPENDS+=
|
||||
endef
|
||||
|
||||
define Package/ice-client-example/description
|
||||
example module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-example/prerm
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=example" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-example/preinst
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=example" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-example/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/exampleService.so.1.0.1 $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define Package/ice-client-example/postinst
|
||||
#!/bin/sh
|
||||
read -t 1 <>/tmp/cfout
|
||||
if [ -f /tmp/ice.pid ]; then
|
||||
echo "system moduleAdd file=exampleService.so.1.0.1" package="ice-client-example" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# iperf
|
||||
define Package/ice-client-iperf
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=iperf
|
||||
DEPENDS+=
|
||||
endef
|
||||
|
||||
define Package/ice-client-iperf/description
|
||||
iperf module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-iperf/prerm
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=iperfMgr" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-iperf/preinst
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=iperfMgr" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-iperf/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/iperfService.so.1.0.1 $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/bin/ifs/iperf/execute
|
||||
$(INSTALL_DIR) $(1)/bin/ifs/iperf/progress
|
||||
$(INSTALL_DIR) $(1)/bin/ifs/iperf/result
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/scheduleiperf.sh $(1)/bin/ifs/iperf/execute
|
||||
endef
|
||||
|
||||
define Package/ice-client-iperf/postinst
|
||||
#!/bin/sh
|
||||
read -t 1 <>/tmp/cfout
|
||||
if [ -f /tmp/ice.pid ]; then
|
||||
echo "system moduleAdd file=iperfService.so.1.0.1" package="ice-client-iperf" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# rshell
|
||||
define Package/ice-client-rshell
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=rshell
|
||||
DEPENDS+=
|
||||
endef
|
||||
|
||||
define Package/ice-client-rshell/description
|
||||
rshell module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-rshell/prerm
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=rshellMgr" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-rshell/preinst
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=rshellMgr" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-rshell/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/rshellService.so.1.0.1 $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define Package/ice-client-rshell/postinst
|
||||
#!/bin/sh
|
||||
read -t 1 <>/tmp/cfout
|
||||
if [ -f /tmp/ice.pid ]; then
|
||||
echo "system moduleAdd file=rshellService.so.1.0.1" package="ice-client-rshell" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# rework
|
||||
define Package/ice-client-rework
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=rework
|
||||
DEPENDS+=
|
||||
endef
|
||||
|
||||
define Package/ice-client-rework/description
|
||||
rework module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-rework/prerm
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=rework" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-rework/preinst
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=rework" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-rework/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/reworkService.so.1.0.1 $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/bin
|
||||
$(CP) $(PKG_BUILD_DIR)/modules/rework/sshpass-1.05/obj/iopsys/sshpass $(1)/bin
|
||||
endef
|
||||
|
||||
define Package/ice-client-rework/postinst
|
||||
#!/bin/sh
|
||||
read -t 1 <>/tmp/cfout
|
||||
if [ -f /tmp/ice.pid ]; then
|
||||
echo "system moduleAdd file=reworkService.so.1.0.1" package="ice-client-rework" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# sip
|
||||
define Package/ice-client-sip
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=sip
|
||||
DEPENDS+=
|
||||
endef
|
||||
|
||||
define Package/ice-client-sip/description
|
||||
sip module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-sip/prerm
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=sip" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-sip/preinst
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=sip" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-sip/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/sipService.so.1.0.1 $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define Package/ice-client-sip/postinst
|
||||
#!/bin/sh
|
||||
read -t 1 <>/tmp/cfout
|
||||
if [ -f /tmp/ice.pid ]; then
|
||||
echo "system moduleAdd file=sipService.so.1.0.1" package="ice-client-sip" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# monitor
|
||||
define Package/ice-client-monitor
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=monitor
|
||||
DEPENDS+=
|
||||
endef
|
||||
|
||||
define Package/ice-client-monitor/description
|
||||
monitor module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-monitor/prerm
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=monitor" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-monitor/preinst
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=monitor" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-monitor/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/monitorService.so.1.0.1 $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define Package/ice-client-monitor/postinst
|
||||
#!/bin/sh
|
||||
read -t 1 <>/tmp/cfout
|
||||
if [ -f /tmp/ice.pid ]; then
|
||||
echo "system moduleAdd file=monitorService.so.1.0.1" package="ice-client-monitor" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# gigaset
|
||||
define Package/ice-client-gigaset
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=gigaset
|
||||
DEPENDS+=
|
||||
endef
|
||||
|
||||
define Package/ice-client-gigaset/description
|
||||
gigaset module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-gigaset/prerm
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=gigaset" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-gigaset/preinst
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=gigaset" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-gigaset/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/gigasetService.so.1.0.1 $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define Package/ice-client-gigaset/postinst
|
||||
#!/bin/sh
|
||||
read -t 1 <>/tmp/cfout
|
||||
if [ -f /tmp/ice.pid ]; then
|
||||
echo "system moduleAdd file=gigasetService.so.1.0.1" package="ice-client-gigaset" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# This line executes the necessary commands to compile our program.
|
||||
# The above define directives specify all the information needed, but this
|
||||
# line calls BuildPackage which in turn actually uses this information to
|
||||
# build a package.
|
||||
$(eval $(call BuildPackage,ice-client))
|
||||
$(eval $(call BuildPackage,ice-client-guest))
|
||||
$(eval $(call BuildPackage,ice-client-camerawatch))
|
||||
$(eval $(call BuildPackage,ice-client-openvpn))
|
||||
$(eval $(call BuildPackage,ice-client-anyfi))
|
||||
$(eval $(call BuildPackage,ice-client-netrounds))
|
||||
$(eval $(call BuildPackage,ice-client-logreader))
|
||||
$(eval $(call BuildPackage,ice-client-fileme))
|
||||
$(eval $(call BuildPackage,ice-client-example))
|
||||
$(eval $(call BuildPackage,ice-client-iperf))
|
||||
$(eval $(call BuildPackage,ice-client-rshell))
|
||||
$(eval $(call BuildPackage,ice-client-rework))
|
||||
$(eval $(call BuildPackage,ice-client-sip))
|
||||
$(eval $(call BuildPackage,ice-client-monitor))
|
||||
$(eval $(call BuildPackage,ice-client-gigaset))
|
||||
@@ -1,46 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2019 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icgroupd
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=0
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=
|
||||
|
||||
PKG_MAINTAINER:=Inteno Broadband AB
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/icgroupd
|
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
TITLE:=Inteno cgroup daemon
|
||||
DEPENDS:=+uci +busybox
|
||||
endef
|
||||
|
||||
define Package/icgroupd/description
|
||||
This package contains Intenos cgroup daemon and associated
|
||||
configuration and startup scripts.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/icgroupd/install
|
||||
$(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d $(1)/etc/config
|
||||
|
||||
$(INSTALL_CONF) ./files/cgroups.config $(1)/etc/config/cgroups
|
||||
$(INSTALL_BIN) ./files/cgroups.init $(1)/etc/init.d/cgroups
|
||||
$(INSTALL_BIN) ./files/cgroupd $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,icgroupd))
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
CGBASEDIR=$1
|
||||
CGCONFIG=$2
|
||||
[ -n "$CGBASEDIR" -a -n "$CGCONFIG" ] || exit 1
|
||||
|
||||
[ -r /lib/functions.sh ] || exit 1
|
||||
. /lib/functions.sh
|
||||
|
||||
CGPROCMAP=/tmp/cgprocmap
|
||||
CGPERIOD=3s
|
||||
|
||||
DBGLOG=/tmp/cgroupd.log
|
||||
DEBUG=0
|
||||
|
||||
|
||||
add_to_procmap () {
|
||||
local name_grp=$1
|
||||
local name grp
|
||||
|
||||
name=$(echo $name_grp |awk -F= '{print $1}')
|
||||
grp=$(echo $name_grp |awk -F= '{print $2}')
|
||||
|
||||
echo "($name) $grp" >> $CGPROCMAP
|
||||
}
|
||||
|
||||
# Read configuration file and create process:group look-up table
|
||||
# in /tmp file
|
||||
read_config () {
|
||||
local enab
|
||||
|
||||
config_load $CGCONFIG
|
||||
|
||||
config_get enab cgroups enabled "1"
|
||||
[ $enab -eq 0 ] && exit 1
|
||||
|
||||
config_get CGDEFGROUP cgroups defgroup "_undef_"
|
||||
[ "$CGDEFGROUP" == "_undef_" ] && exit 1
|
||||
[ "$DEBUG" == "1" ] && echo "default $CGDEFGROUP" >> $DBGLOG
|
||||
|
||||
echo -n '' > $CGPROCMAP
|
||||
config_list_foreach procmap procmap add_to_procmap
|
||||
[ "$DEBUG" == "1" ] && cat $CGPROCMAP >> $DBGLOG
|
||||
}
|
||||
|
||||
# Move all process except init from cgroup root to cgroups according
|
||||
# to /tmp look-up table
|
||||
move_wild_procs () {
|
||||
local wild_procs=$(cat $CGBASEDIR/cgroup.procs)
|
||||
local pid name grp
|
||||
|
||||
for pid in $wild_procs; do
|
||||
|
||||
[ $pid -eq 1 ] && continue
|
||||
if [ -d /proc/$pid ]; then
|
||||
|
||||
name=$(awk '{print $2}' /proc/$pid/stat)
|
||||
grp=$(awk "\$1==\"$name\" {print \$2}" $CGPROCMAP)
|
||||
|
||||
[ "$grp" == "." ] && continue
|
||||
[ -n "$grp" ] || grp=$CGDEFGROUP
|
||||
|
||||
[ "$DEBUG" == "1" ] && \
|
||||
echo "Moving proc $pid $name to $grp" >> $DBGLOG
|
||||
echo $pid > $CGBASEDIR/$grp/cgroup.procs
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
[ "$DEBUG" == "1" ] && echo "$0 started $(date)" >> $DBGLOG
|
||||
read_config
|
||||
while true; do
|
||||
move_wild_procs
|
||||
sleep $CGPERIOD
|
||||
done
|
||||
@@ -1,48 +0,0 @@
|
||||
config cgroups cgroups
|
||||
option enabled 1
|
||||
option defgroup iopsys/normal
|
||||
|
||||
config cgroup _root_
|
||||
# list option cpu.rt_runtime_us=50000
|
||||
list option memory.move_charge_at_immigrate=1
|
||||
|
||||
config cgroup iopsys
|
||||
list option cpu.shares=4096
|
||||
# list option cpu.rt_runtime_us=40000
|
||||
list option memory.limit_in_bytes=-1
|
||||
list option memory.move_charge_at_immigrate=1
|
||||
|
||||
config cgroup iopsys_normal
|
||||
list option cpu.shares=1024
|
||||
# list option cpu.rt_runtime_us=10000
|
||||
list option memory.limit_in_bytes=-1
|
||||
list option memory.move_charge_at_immigrate=1
|
||||
|
||||
config cgroup iopsys_high
|
||||
list option cpu.shares=4096
|
||||
# list option cpu.rt_runtime_us=30000
|
||||
list option memory.limit_in_bytes=-1
|
||||
list option memory.move_charge_at_immigrate=1
|
||||
|
||||
config cgroup 3prt
|
||||
list option cpu.shares=1024
|
||||
# list option cpu.rt_runtime_us=10000
|
||||
list option memory.limit_in_bytes=75M
|
||||
list option memory.move_charge_at_immigrate=1
|
||||
|
||||
config cgroup 3prt_normal
|
||||
list option cpu.shares=1024
|
||||
# list option cpu.rt_runtime_us=2500
|
||||
list option memory.limit_in_bytes=75M
|
||||
list option memory.move_charge_at_immigrate=1
|
||||
|
||||
config cgroup 3prt_high
|
||||
list option cpu.shares=4096
|
||||
# list option cpu.rt_runtime_us=7500
|
||||
list option memory.limit_in_bytes=75M
|
||||
list option memory.move_charge_at_immigrate=1
|
||||
|
||||
config procmap procmap
|
||||
list procmap kthreadd=.
|
||||
list procmap minidlna=3prt/normal
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=01
|
||||
USE_PROCD=1
|
||||
PROCD_DEBUG=1
|
||||
NAME=cgroupd
|
||||
|
||||
CGBASEDIR=/sys/fs/cgroup
|
||||
CGCONFIG="cgroups"
|
||||
|
||||
DBGLOG=/tmp/cginit.log
|
||||
DEBUG=0
|
||||
|
||||
|
||||
cgroupinit_set_knob_value () {
|
||||
local knob_val=$1
|
||||
local dir=$2
|
||||
local knob val
|
||||
|
||||
knob=$(echo $knob_val |awk -F= '{print $1}')
|
||||
val=$(echo $knob_val |awk -F= '{print $2}')
|
||||
/bin/echo $val > $CGBASEDIR/$dir/$knob
|
||||
[ "$DEBUG" == "1" ] && \
|
||||
echo "/bin/echo $val > $CGBASEDIR/$dir/$knob (ret=$?)" >> $DBGLOG
|
||||
}
|
||||
|
||||
cgroupinit_create_group () {
|
||||
local cgrp=$1
|
||||
local dir
|
||||
|
||||
[ "$DEBUG" == "1" ] && echo "Create group $cgrp:" >> $DBGLOG
|
||||
if [ "$cgrp" == "_root_" ]; then
|
||||
dir=.
|
||||
else
|
||||
dir=$(echo $cgrp |tr '_' '/')
|
||||
|
||||
if [ ! -d $CGBASEDIR/$dir ]; then
|
||||
mkdir $CGBASEDIR/$dir
|
||||
[ "$DEBUG" == "1" ] && \
|
||||
echo "mkdir $CGBASEDIR/$dir (ret=$?)" >> $DBGLOG
|
||||
fi
|
||||
fi
|
||||
|
||||
config_list_foreach $cgrp option cgroupinit_set_knob_value $dir
|
||||
}
|
||||
|
||||
cgroupinit_configure_cgroups () {
|
||||
local enab defgrp
|
||||
|
||||
[ "$DEBUG" == "1" ] && echo "$0 started $(date)" >> $DBGLOG
|
||||
config_load $CGCONFIG
|
||||
|
||||
config_get enab cgroups enabled "1"
|
||||
[ $enab -eq 0 ] && return 1
|
||||
|
||||
config_get defgrp cgroups defgroup "_undef_"
|
||||
[ "$defgrp" == "_undef_" ] && return 1
|
||||
|
||||
if ! grep -q " $CGBASEDIR cgroup " /proc/mounts; then
|
||||
mount -t cgroup -o nodev,noexec,nosuid cgroup $CGBASEDIR
|
||||
[ $? -eq 0 ] || return 1
|
||||
fi
|
||||
|
||||
config_foreach cgroupinit_create_group cgroup
|
||||
return 0
|
||||
}
|
||||
|
||||
start_service () {
|
||||
cgroupinit_configure_cgroups
|
||||
[ $? -eq 0 ] || return
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command /sbin/cgroupd $CGBASEDIR $CGCONFIG
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service () {
|
||||
local cgdir procs prc
|
||||
|
||||
for cgdir in $(find $CGBASEDIR -type d -mindepth 1 -depth); do
|
||||
procs=$(cat $cgdir/cgroup.procs)
|
||||
for prc in $procs; do
|
||||
echo $prc > $CGBASEDIR/cgroup.procs
|
||||
done
|
||||
rmdir $cgdir
|
||||
done
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger $CGCONFIG
|
||||
}
|
||||
|
||||
@@ -22,6 +22,5 @@ config CWMP_DEBUG
|
||||
config CWMP_DEVEL_DEBUG
|
||||
bool "Compile with development debug options"
|
||||
default n
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
128
icwmp/Makefile
Executable file → Normal file
128
icwmp/Makefile
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2019 iopsys Software Solutions AB
|
||||
# Copyright (C) 2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
@@ -8,17 +8,19 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=4.0-2019-10-01
|
||||
PKG_VERSION:=3.0-2015-11-10
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git
|
||||
ifeq ($(CONFIG_BCM_OPEN),y)
|
||||
PKG_SOURCE_URL:=http://ihgsp.inteno.se/git/freecwmp.git
|
||||
else
|
||||
PKG_SOURCE_URL:=ssh://git@iopsys.inteno.se/freecwmp.git
|
||||
endif
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=ed781436f96f2dc3cf58b35adc640c6f9f6783d1
|
||||
PKG_SOURCE_VERSION:=8d34c241548a21b6462df5d16906824685fe916c
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_CWMP_ACS_MULTI \
|
||||
@@ -32,46 +34,11 @@ CWMP_REVISION=$(shell svnversion ./src/ -n|cut -f2 -d:)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/icwmp_stun
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-069 stun Client
|
||||
DEPENDS:=+libubus +libuci +libubox +libjson-c +libopenssl +libblobmsg-json
|
||||
endef
|
||||
|
||||
define Package/icwmp_xmpp
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-069 xmpp feature
|
||||
DEPENDS:=+libuci +libubox +libexpat +libstrophe
|
||||
endef
|
||||
|
||||
define Package/icwmp_twamp
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-069 twamp feature
|
||||
DEPENDS:=+libuci
|
||||
endef
|
||||
|
||||
define Package/icwmp_udpechoserver
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-069 udpechoserver feature
|
||||
DEPENDS:=+libuci
|
||||
endef
|
||||
|
||||
define Package/icwmp_bulkdata
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-069 BulkData Collection
|
||||
DEPENDS:=+libubus +libuci +libubox +libjson-c +libcurl +curl +libblobmsg-json +libbbfdm
|
||||
endef
|
||||
|
||||
define Package/icwmp/Default
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=CWMP client
|
||||
DEPENDS:=+libuci +libmicroxml +libubox +jshn +libubus +libblobmsg-json +libpthread +ubusd +shflags +getopt +zlib +libjson-c +libopenssl +curl +libbbfdm +(PACKAGE_libtr098):libtr098
|
||||
DEPENDS:=+libuci +libmicroxml +libubox +jshn +libubus +libblobmsg-json +libpthread +ubusd +shflags +getopt
|
||||
endef
|
||||
|
||||
define Package/icwmp/description
|
||||
@@ -93,7 +60,7 @@ define Package/icwmp-zstream
|
||||
endef
|
||||
|
||||
define Package/icwmp-zstream/config
|
||||
source "$(SOURCE)/Config_cwmp.in"
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
USE_LOCAL=$(shell ls ./src/ 2>/dev/null >/dev/null && echo 1)
|
||||
@@ -103,13 +70,9 @@ define Build/Prepare
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
|
||||
TARGET_CFLAGS += -DEX400
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-D_GNU_SOURCE -D_AADJ
|
||||
|
||||
|
||||
ifneq ($(CWMP_REVISION)_,_)
|
||||
ifneq ($(CWMP_REVISION),exported)
|
||||
ifneq ($(CWMP_REVISION),Unversioned directory)
|
||||
@@ -126,7 +89,7 @@ CONFIGURE_ARGS += \
|
||||
--with-uci-include-path=$(STAGING_DIR)/usr/include \
|
||||
--with-libubox-include-path=$(STAGING_DIR)/usr/include \
|
||||
--with-libubus-include-path=$(STAGING_DIR)/usr/include
|
||||
|
||||
|
||||
ifeq ($(BUILD_VARIANT),zstream)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-http=zstream \
|
||||
@@ -158,23 +121,13 @@ CONFIGURE_ARGS += \
|
||||
--enable-devel
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_libtr098),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr098
|
||||
endif
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr181
|
||||
|
||||
define Package/icwmp-$(BUILD_VARIANT)/install
|
||||
$(INSTALL_DIR) $(1)/etc/icwmpd
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/icwmpd $(1)/usr/sbin
|
||||
ifeq ($(CONFIG_PACKAGE_libtr098),y)
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/icwmp_tr098d $(1)/usr/sbin
|
||||
endif
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/dmmap $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/firewall.cwmp $(1)/etc/firewall.cwmp
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
@@ -186,54 +139,9 @@ ifeq ($(CONFIG_CWMP_SCRIPTS_FULL),y)
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/functions $(1)/usr/share/icwmp
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/icwmp.sh $(1)/usr/sbin/icwmp
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/iwepkeygen $(1)/usr/sbin/iwepkeygen
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/watchicwmpd.sh $(1)/usr/sbin/watchicwmpd
|
||||
endif
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
define Package/icwmp_stun/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/icwmp_stund $(1)/usr/sbin/icwmp_stund
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmp_stund $(1)/etc/init.d/icwmp_stund
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp_stun $(1)/etc/config
|
||||
endef
|
||||
|
||||
define Package/icwmp_xmpp/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/icwmp_xmppd $(1)/usr/sbin/icwmp_xmppd
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmp_xmppd $(1)/etc/init.d/icwmp_xmppd
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp_xmpp $(1)/etc/config
|
||||
$(CP) ./xmpp-files/* $(1)/
|
||||
endef
|
||||
|
||||
define Package/icwmp_udpechoserver/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/icwmp_udpechoserverd $(1)/usr/sbin/icwmp_udpechoserverd
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmp_udpechoserverd $(1)/etc/init.d/icwmp_udpechoserverd
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp_udpechoserver $(1)/etc/config
|
||||
endef
|
||||
|
||||
define Package/icwmp_twamp/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/icwmp_twampd $(1)/usr/sbin/icwmp_twampd
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmp_twampd $(1)/etc/init.d/icwmp_twampd
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp_twamp $(1)/etc/config
|
||||
endef
|
||||
|
||||
define Package/icwmp_bulkdata/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/icwmp_bulkdatad $(1)/usr/sbin/icwmp_bulkdatad
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmp_bulkdatad $(1)/etc/init.d/icwmp_bulkdatad
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp_bulkdata $(1)/etc/config
|
||||
endef
|
||||
|
||||
define Package/icwmp-$(BUILD_VARIANT)/postinst
|
||||
@@ -255,10 +163,6 @@ define Package/icwmp-$(BUILD_VARIANT)/prerm
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,icwmp-curl))
|
||||
$(eval $(call BuildPackage,icwmp_stun))
|
||||
$(eval $(call BuildPackage,icwmp_xmpp))
|
||||
$(eval $(call BuildPackage,icwmp_udpechoserver))
|
||||
$(eval $(call BuildPackage,icwmp_twamp))
|
||||
$(eval $(call BuildPackage,icwmp_bulkdata))
|
||||
$(eval $(call BuildPackage,icwmp-zstream))
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
[ "$ACTION" == "ifup" ] || exit 0
|
||||
|
||||
[ -f /etc/config/cwmp ] || exit 0
|
||||
|
||||
handle_icwmp_restart() {
|
||||
[ -f /tmp/switching_mode ] && exit 0
|
||||
[ -f /tmp/wificontrol.txt -a -f /tmp/netmode-conf.pid ] && exit 0
|
||||
|
||||
[ "$INTERFACE" == "loopback" ] && exit 0
|
||||
|
||||
local defwan=$(uci -q get cwmp.cpe.default_wan_interface)
|
||||
[ -n "$defwan" -a "$(uci -q get network.$defwan)" == "interface" -a "$defwan" != "$INTERFACE" ] && exit 0
|
||||
|
||||
local islan="$(uci -q get network.$INTERFACE.is_lan)"
|
||||
[ "$islan" == "1" ] && exit 0
|
||||
|
||||
local proto="$(uci -q get network.$INTERFACE.proto)"
|
||||
[ "$proto" == "none" ] && exit 0
|
||||
|
||||
local ifname="$(uci -q get network.$INTERFACE.ifname)"
|
||||
[ "${ifname:0:1}" == "@" ] && exit 0
|
||||
|
||||
mkdir -p /tmp/ipv4
|
||||
|
||||
network_flush_cache
|
||||
|
||||
local previpaddr=""
|
||||
local curipaddr=""
|
||||
local ipaddrfile=/tmp/ipv4/$INTERFACE-ipaddr
|
||||
previpaddr=$(cat $ipaddrfile 2>/dev/null)
|
||||
network_get_ipaddr curipaddr $INTERFACE
|
||||
[ -n "$curipaddr" ] && echo $curipaddr > $ipaddrfile || rm -f $ipaddrfile
|
||||
|
||||
local prevgateway=""
|
||||
local curgateway=""
|
||||
local gatewayfile=/tmp/ipv4/$INTERFACE-gateway
|
||||
prevgateway=$(cat $gatewayfile 2>/dev/null)
|
||||
network_get_gateway curgateway $INTERFACE
|
||||
[ -n "$curgateway" ] && echo $curgateway > $gatewayfile || rm -f $gatewayfile
|
||||
|
||||
local prevsubnets=""
|
||||
local cursubnets=""
|
||||
local subnetsfile=/tmp/ipv4/$INTERFACE-subnets
|
||||
prevsubnets=$(cat $subnetsfile 2>/dev/null)
|
||||
network_get_subnets cursubnets $INTERFACE
|
||||
[ -n "$cursubnets" ] && echo $cursubnets > $subnetsfile || rm -f $subnetsfile
|
||||
|
||||
local prevdnsservers=""
|
||||
local curdnsservers=""
|
||||
local dnsserverfile=/tmp/ipv4/$INTERFACE-dnsservers
|
||||
prevdnsservers=$(cat $dnsserverfile 2>/dev/null)
|
||||
network_get_dnsserver curdnsservers $INTERFACE
|
||||
[ -n "$curdnsservers" ] && echo $curdnsservers > $dnsserverfile || rm -f $dnsserverfile
|
||||
|
||||
local prevdev=""
|
||||
local curdev=""
|
||||
local devfile=/tmp/ipv4/$INTERFACE-dev
|
||||
prevdev=$(cat $devfile 2>/dev/null)
|
||||
network_get_device curdev $INTERFACE
|
||||
[ -n "$curdev" ] && echo $curdev > $devfile || rm -f $devfile
|
||||
|
||||
local prevopt43url=""
|
||||
local curopt43url=""
|
||||
local opt43urlfile=/tmp/ipv4/$INTERFACE-opt43url
|
||||
prevopt43url=$(cat $opt43urlfile 2>/dev/null)
|
||||
curopt43url="$(uci -P /var/state -q get cwmp.acs.dhcp_url)"
|
||||
[ -n "$curopt43url" ] && echo $curopt43url > $opt43urlfile || rm -f $opt43urlfile
|
||||
|
||||
[ \
|
||||
"$prevdev" == "$curdev" -a \
|
||||
"$previpaddr" = "$curipaddr" -a \
|
||||
"$prevgateway" = "$curgateway" -a \
|
||||
"$prevsubnets" = "$cursubnets" -a \
|
||||
"$prevdnsservers" = "$curdnsservers" \
|
||||
] && {
|
||||
[ "$prevopt43url" = "$curopt43url" ] && exit 0
|
||||
[ -z "$prevopt43url" ] && exit 0
|
||||
}
|
||||
|
||||
/etc/init.d/icwmpd reload &
|
||||
}
|
||||
|
||||
handle_icwmp_restart
|
||||
@@ -1,54 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
set_cwmp_reqopts() {
|
||||
### Ask for DHCP Option 43 only if CWMP is enabled ###
|
||||
local wan=$(uci -q get cwmp.cpe.default_wan_interface)
|
||||
local dhcp_discovery=$(uci -q get cwmp.acs.dhcp_discovery)
|
||||
local discovery=0
|
||||
case $dhcp_discovery in
|
||||
enable|1) discovery=1 ;;
|
||||
esac
|
||||
|
||||
local newreqopts=
|
||||
local baseopts=
|
||||
local reqopts="$(uci -q get network.$wan.reqopts)"
|
||||
local proto="$(uci -q get network.$wan.proto)"
|
||||
local tropts="43"
|
||||
local oldreqopts="$reqopts"
|
||||
local ropt iopt
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
43) ;;
|
||||
*) baseopts="$baseopts $ropt" ;;
|
||||
esac
|
||||
done
|
||||
ropt=""
|
||||
reqopts="$baseopts $tropts"
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
43) [ $discovery -eq 1 ] && newreqopts="$newreqopts $ropt" ;;
|
||||
*) newreqopts="$newreqopts $ropt" ;;
|
||||
esac
|
||||
done
|
||||
if [ "$proto" == "dhcp" ]; then
|
||||
newreqopts="$(echo $newreqopts | tr ' ' '\n' | sort -n | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//')"
|
||||
oldreqopts="$(echo $oldreqopts | tr ' ' '\n' | sort -n | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//')"
|
||||
[ "$newreqopts" == "$oldreqopts" ] && return
|
||||
uci -q set network.$wan.reqopts="$newreqopts"
|
||||
uci commit network
|
||||
fi
|
||||
}
|
||||
|
||||
regenerate_ssl_link(){
|
||||
local cert_dir="/etc/ssl/certs"
|
||||
local all_file=$(ls $cert_dir/*.pem)
|
||||
for cfile in $all_file
|
||||
do
|
||||
ln -s $cfile $cert_dir/$(openssl x509 -hash -noout -in $cfile).0
|
||||
done
|
||||
}
|
||||
|
||||
set_cwmp_reqopts
|
||||
regenerate_ssl_link
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -f /etc/config/cwmp_xmpp ] || exit 0
|
||||
|
||||
[ "$ACTION" == "ifup" ] || exit 0
|
||||
[ "$INTERFACE" == "loopback" ] && exit 0
|
||||
|
||||
local defwan=$(uci -q get cwmp.cpe.default_wan_interface)
|
||||
[ -n "$defwan" -a "$(uci -q get network.$defwan)" == "interface" -a "$defwan" != "$INTERFACE" ] && exit 0
|
||||
|
||||
local islan="$(uci -q get network.$INTERFACE.is_lan)"
|
||||
[ "$islan" == "1" ] && exit 0
|
||||
|
||||
local proto="$(uci -q get network.$INTERFACE.proto)"
|
||||
[ "$proto" == "none" ] && exit 0
|
||||
|
||||
local ifname="$(uci -q get network.$INTERFACE.ifname)"
|
||||
[ "${ifname:0:1}" == "@" ] && exit 0
|
||||
|
||||
/etc/init.d/icwmp_xmppd reload &
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2018 iopsys Software Solutions AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ifbt
|
||||
PKG_VERSION:=0.2
|
||||
|
||||
PKG_SOURCE_VERSION:=f6edff47b6c0a154ab892301acf767d19ac8ad73
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ifbt.git
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=README
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_mips),y)
|
||||
TARGET_PLATFORM:=-DIOPSYS_BROADCOM
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
TARGET_PLATFORM:=-DIOPSYS_BROADCOM
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_linksys),y)
|
||||
TARGET_PLATFORM:=-DIOPSYS_MARVELL
|
||||
else ifeq ($(CONFIG_TARGET_intel_mips),y)
|
||||
TARGET_PLATFORM:=-DIOPSYS_INTEL
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
|
||||
TARGET_PLATFORM:=-DIOPSYS_MEDIATEK
|
||||
else
|
||||
$(info (UNEXPECTED CONFIG TARGET))
|
||||
endif
|
||||
|
||||
export TARGET_PLATFORM
|
||||
|
||||
define Package/ifbt
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libwifi +libjson-c
|
||||
TITLE:=Fast BSS Transition
|
||||
endef
|
||||
|
||||
define Package/ifbt/description
|
||||
ifbt is Iopsys application for fast BSS transition
|
||||
endef
|
||||
|
||||
define Package/ifbt/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ifbt $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ifbt))
|
||||
39
ifsi/Makefile
Normal file
39
ifsi/Makefile
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# Copyright (C) 2015 Inteno
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ifsi
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
LDFLAGS+= \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/lib
|
||||
|
||||
define Package/ifsi
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+ubus +libubox
|
||||
TITLE:=Inteno Functional Script Interface
|
||||
endef
|
||||
|
||||
define Package/ifsi/description
|
||||
Inteno Functional Script Interface
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Package/ifsi/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ifsi $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ifsi))
|
||||
17
ifsi/src/Makefile
Normal file
17
ifsi/src/Makefile
Normal file
@@ -0,0 +1,17 @@
|
||||
CC = gcc
|
||||
CFLAGS = -g -Wall
|
||||
LOCLIBS =
|
||||
LIBS = -lubus -lubox -lblobmsg_json
|
||||
OBJS = ifsi.o
|
||||
SRCS = ifsi.c
|
||||
LIBSRCS =
|
||||
ISRCS =
|
||||
|
||||
all: ifsi
|
||||
|
||||
ifsi: ${OBJS}
|
||||
${CC} ${LDFLAGS} ${LIBSRCS} -o ifsi ${OBJS} ${LIBS}
|
||||
|
||||
clean:
|
||||
rm -f ifsi *.o
|
||||
|
||||
74
ifsi/src/ifsi.c
Normal file
74
ifsi/src/ifsi.c
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* ifsi -- Inteno functional script interface
|
||||
*
|
||||
* Copyright (C) 2012-2013 Inteno Broadband Technology AB. All rights reserved.
|
||||
*
|
||||
* Author: dev@inteno.se
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <libubox/blobmsg.h>
|
||||
#include <libubox/blobmsg_json.h>
|
||||
#include <libubox/uloop.h>
|
||||
|
||||
#include <libubus.h>
|
||||
|
||||
static struct ubus_context *ctx;
|
||||
static struct ubus_event_handler event_listener;
|
||||
static struct blob_buf b;
|
||||
|
||||
|
||||
static void receive_event(struct ubus_context *ctx, struct ubus_event_handler *ev,
|
||||
const char *type, struct blob_attr *msg)
|
||||
{
|
||||
char *str;
|
||||
uint32_t id;
|
||||
|
||||
str = blobmsg_format_json(msg, true);
|
||||
fprintf(stdout, "I got %s event %s\n", type, str);
|
||||
free(str);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *ubus_socket = NULL;
|
||||
int ret;
|
||||
|
||||
uloop_init();
|
||||
|
||||
ctx = ubus_connect(ubus_socket);
|
||||
if (!ctx) {
|
||||
fprintf(stderr, "Failed to connect to ubus\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
ubus_add_uloop(ctx);
|
||||
|
||||
event_listener.cb = receive_event;
|
||||
ret = ubus_register_event_handler(ctx, &event_listener, "*");
|
||||
if (ret)
|
||||
fprintf(stderr, "Couldn't register to router events\n");
|
||||
|
||||
uloop_run();
|
||||
|
||||
ubus_free(ctx);
|
||||
uloop_done();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2018 iopsys
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=imonitor
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
PKG_SOURCE_PROTO=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/imonitor.git
|
||||
PKG_SOURCE_VERSION:=532f4900862bcb45d8cd4bf37555fabda81750b6
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=${PKG_NAME}-${PKG_VERSION}
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/imonitor
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=iopsysWrt process supervisor
|
||||
DEPENDS:=+ubox +uci +ubus +rpcd +rpcd-mod-file
|
||||
endef
|
||||
|
||||
define Package/imonitor/description
|
||||
imonitor is a process supervisor or a process control system similar to the Supervisor (http://supervisord.org/)
|
||||
endef
|
||||
|
||||
define Package/imonitor/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/imonitor $(1)/usr/bin/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,imonitor))
|
||||
@@ -1,9 +0,0 @@
|
||||
config monitor
|
||||
option app 'test'
|
||||
option test 'echo test'
|
||||
option stream 'stdout'
|
||||
option string_match 'TEST'
|
||||
option execute 'echo executing test'
|
||||
option interval '10'
|
||||
option nr_tests '2'
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
#
|
||||
# Start the imonitor
|
||||
#
|
||||
|
||||
START=99
|
||||
STOP=01
|
||||
|
||||
USE_PROCD=1
|
||||
NAME=imonitor
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command "imonitor"
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop imonitor
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2016 iopsys
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=inbd
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=53ca7f58edb87976b5897ccaf487bb0cbbf39d07
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/inbd
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
# support parallel build
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
#re create configure scripts if not present.
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
|
||||
# this way we don't need to pick out the resulting files from the build dir.
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/inbd
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=iopsys Netlink Bridge Daemon
|
||||
URL:=
|
||||
DEPENDS:=+libuci +libubus +libblobmsg-json +libnl-genl
|
||||
endef
|
||||
|
||||
define Package/inbd/description
|
||||
Application handling netlink messages from kernel and sending them out on ubus.
|
||||
endef
|
||||
|
||||
define Package/inbd/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inbd $(1)/usr/bin/
|
||||
cp $(PKG_BUILD_DIR)/files/etc/init.d/inbd $(1)/etc/init.d/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,inbd))
|
||||
@@ -1,60 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=inotify-tools
|
||||
PKG_VERSION:=3.14
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=1df9af4d6cd0f4af4b1b19254bcf056aed4ae395
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/rvoicilas/inotify-tools.git
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
# support parallel build
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
#re create configure scripts if not present.
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
|
||||
# this way we don't need to pick out the resulting files from the build dir.
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/inotify-tools
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Tools to trace filesystem events.
|
||||
URL:=
|
||||
endef
|
||||
|
||||
define Package/inotify-tools/description
|
||||
Tools to trace filesystem events.
|
||||
endef
|
||||
|
||||
define Package/inotify-tools/install
|
||||
$(INSTALL_DIR) $(1)/usr
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/usr/lib/
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libinotifytools.so.0.4.1 $(1)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libinotifytools.so.0 $(1)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libinotifytools.so $(1)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inotifywait $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inotifywatch $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,inotify-tools))
|
||||
@@ -1,13 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
# is the real root mounted ?
|
||||
if [ ! -f /tmp/inotify_real_root/etc/preinit ]
|
||||
then
|
||||
ubivol=$( cat /proc/cmdline | sed -e "s/.*root=\(ubi:rootfs_.\).*/\1/" )
|
||||
mkdir /tmp/inotify_real_root
|
||||
mount -t ubifs $ubivol /tmp/inotify_real_root
|
||||
fi
|
||||
|
||||
inotifywait -r -m -e modify -e create -e attrib -e delete -e move /tmp/inotify_real_root
|
||||
|
||||
|
||||
52
inteno-configs/Makefile
Normal file
52
inteno-configs/Makefile
Normal file
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# Copyright (C) 2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=inteno-configs
|
||||
|
||||
PKG_VERSION:=1.0
|
||||
PKG_SOURCE_URL:=git@iopsys.inteno.se:inteno-configs.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=e6836dbc3dde40eba661b3c37d5f5d0cc6f2e5d0
|
||||
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
######################################
|
||||
|
||||
define NewConfig
|
||||
define Package/$(1)/install
|
||||
$(INSTALL_DIR) $$(1)/etc/config
|
||||
$(INSTALL_DIR) $$(1)/etc/uci-defaults
|
||||
$(CP) $(PKG_BUILD_DIR)/$(1)/etc/config/* $$(1)/etc/config/ | true
|
||||
$(CP) $(PKG_BUILD_DIR)/$(1)/etc/uci-defaults/* $$(1)/etc/uci-defaults | true
|
||||
endef
|
||||
|
||||
define Package/$(1)
|
||||
SECTION:=configs
|
||||
CATEGORY:=Configurations
|
||||
TITLE:=$(1)
|
||||
endef
|
||||
|
||||
endef
|
||||
|
||||
|
||||
define AddConfig
|
||||
$(eval $(call NewConfig,$(1)))
|
||||
$(eval $(call BuildPackage,$(1)))
|
||||
endef
|
||||
|
||||
######################################
|
||||
|
||||
$(eval $(call AddConfig,conf-common-inteno))
|
||||
$(eval $(call AddConfig,conf-caiman-inteno))
|
||||
|
||||
|
||||
35
iop/Makefile
35
iop/Makefile
@@ -1,35 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2019 iopsys
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=iop
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=0
|
||||
PKG_LICENSE:=GPLv2
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/iop
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=iop utilities
|
||||
endef
|
||||
|
||||
define Package/iop/description
|
||||
This package contains iopsysWrt SDK utilities
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/iop/install
|
||||
true
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,iop))
|
||||
198
iop/config
198
iop/config
@@ -1,198 +0,0 @@
|
||||
CONFIG_BUILD_NLS=y
|
||||
CONFIG_BUSYBOX_CUSTOM=y
|
||||
CONFIG_CCACHE=y
|
||||
CONFIG_DEBUG=y
|
||||
CONFIG_DEVEL=y
|
||||
CONFIG_PACKAGE_6in4=y
|
||||
CONFIG_PACKAGE_6rd=y
|
||||
CONFIG_PACKAGE_6to4=y
|
||||
CONFIG_PACKAGE_alsa-lib=y
|
||||
CONFIG_PACKAGE_chat=y
|
||||
CONFIG_PACKAGE_comgt=y
|
||||
CONFIG_PACKAGE_comgt-directip=y
|
||||
CONFIG_PACKAGE_comgt-ncm=y
|
||||
CONFIG_PACKAGE_crashlog=y
|
||||
CONFIG_PACKAGE_ddns-scripts=y
|
||||
CONFIG_PACKAGE_ds-lite=y
|
||||
CONFIG_PACKAGE_easy-qos=y
|
||||
CONFIG_PACKAGE_gdb=m
|
||||
CONFIG_PACKAGE_getopt=y
|
||||
CONFIG_PACKAGE_glib2=y
|
||||
CONFIG_PACKAGE_icwmp-curl=y
|
||||
CONFIG_PACKAGE_ifbt=y
|
||||
CONFIG_PACKAGE_imonitor=y
|
||||
CONFIG_PACKAGE_inbd=y
|
||||
CONFIG_PACKAGE_iopupgrade=y
|
||||
CONFIG_PACKAGE_ip-full=y
|
||||
CONFIG_PACKAGE_iperf3=y
|
||||
CONFIG_PACKAGE_ipset=y
|
||||
CONFIG_PACKAGE_iptables=y
|
||||
CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
|
||||
CONFIG_PACKAGE_iptables-mod-filter=y
|
||||
CONFIG_PACKAGE_iptables-mod-ipopt=y
|
||||
# CONFIG_PACKAGE_iwatchdog is not set
|
||||
CONFIG_PACKAGE_juci=y
|
||||
CONFIG_PACKAGE_juci-config-backup=y
|
||||
CONFIG_PACKAGE_juci-ddns=y
|
||||
CONFIG_PACKAGE_juci-diagnostics=y
|
||||
CONFIG_PACKAGE_juci-dnsmasq-dhcp=y
|
||||
CONFIG_PACKAGE_juci-dropbear=y
|
||||
CONFIG_PACKAGE_juci-easyqos=y
|
||||
CONFIG_PACKAGE_juci-event=y
|
||||
CONFIG_PACKAGE_juci-firewall-fw3=y
|
||||
CONFIG_PACKAGE_juci-icwmp=y
|
||||
CONFIG_PACKAGE_juci-igmpinfo=y
|
||||
CONFIG_PACKAGE_juci-minidlna=y
|
||||
CONFIG_PACKAGE_juci-mod-status=y
|
||||
CONFIG_PACKAGE_juci-mod-system=y
|
||||
CONFIG_PACKAGE_juci-mwan3=y
|
||||
CONFIG_PACKAGE_juci-netmode=y
|
||||
CONFIG_PACKAGE_juci-network-device=y
|
||||
CONFIG_PACKAGE_juci-network-dsl=y
|
||||
CONFIG_PACKAGE_juci-network-netifd=y
|
||||
CONFIG_PACKAGE_juci-network-port=y
|
||||
CONFIG_PACKAGE_juci-openvpn=y
|
||||
CONFIG_PACKAGE_juci-owsd=y
|
||||
CONFIG_PACKAGE_juci-realtime-graphs=y
|
||||
CONFIG_PACKAGE_juci-samba=y
|
||||
CONFIG_PACKAGE_juci-snmpd=y
|
||||
CONFIG_PACKAGE_juci-sysupgrade=y
|
||||
CONFIG_PACKAGE_juci-upnp=y
|
||||
CONFIG_PACKAGE_juci-usb=y
|
||||
CONFIG_PACKAGE_juci-voice-client=y
|
||||
CONFIG_PACKAGE_juci-wifilife=y
|
||||
CONFIG_PACKAGE_juci-wireless=y
|
||||
CONFIG_PACKAGE_juci-theme-iopsys=y
|
||||
CONFIG_PACKAGE_kmod-siit=y
|
||||
CONFIG_PACKAGE_libcgroup-daemon=y
|
||||
CONFIG_PACKAGE_libcgroup=y
|
||||
# CONFIG_PACKAGE_libcgroup-utils is not set
|
||||
CONFIG_PACKAGE_libdaemon=y
|
||||
CONFIG_PACKAGE_libffmpeg-mini=y
|
||||
CONFIG_PACKAGE_libgmp=y
|
||||
CONFIG_PACKAGE_libreadline=y
|
||||
CONFIG_PACKAGE_loop-detector=m
|
||||
CONFIG_PACKAGE_minidlna=y
|
||||
CONFIG_PACKAGE_miniupnpd=y
|
||||
CONFIG_PACKAGE_mwan3=y
|
||||
CONFIG_PACKAGE_nand-utils=y
|
||||
CONFIG_PACKAGE_ndisc6=y
|
||||
CONFIG_PACKAGE_netmode=y
|
||||
CONFIG_PACKAGE_ntfs-3g=y
|
||||
CONFIG_PACKAGE_ntpd=y
|
||||
CONFIG_PACKAGE_obuspa=y
|
||||
CONFIG_PACKAGE_odhcp6c=y
|
||||
CONFIG_PACKAGE_odhcpd=y
|
||||
CONFIG_PACKAGE_openssl-util=y
|
||||
CONFIG_OPENSSL_WITH_COMPRESSION=y
|
||||
CONFIG_PACKAGE_openvpn-easy-rsa=y
|
||||
CONFIG_PACKAGE_openvpn-openssl=y
|
||||
CONFIG_PACKAGE_peripheral_manager=y
|
||||
CONFIG_PACKAGE_port-management=y
|
||||
CONFIG_PACKAGE_power-management=y
|
||||
CONFIG_PACKAGE_ppp-mod-pppoa=y
|
||||
CONFIG_PACKAGE_ppp-mod-pppoe=y
|
||||
CONFIG_PACKAGE_ppp-mod-pppol2tp=y
|
||||
CONFIG_PACKAGE_ppp-mod-pptp=y
|
||||
CONFIG_PACKAGE_ppp-multilink=y
|
||||
# CONFIG_PACKAGE_ppp is not set
|
||||
# CONFIG_PACKAGE_qos-scripts is not set
|
||||
CONFIG_PACKAGE_questd=y
|
||||
CONFIG_PACKAGE_rdisc6=y
|
||||
CONFIG_PACKAGE_rdnssd=y
|
||||
CONFIG_PACKAGE_relayd=y
|
||||
CONFIG_PACKAGE_resolveip=y
|
||||
CONFIG_PACKAGE_rpcd=y
|
||||
CONFIG_PACKAGE_rulengd=y
|
||||
CONFIG_PACKAGE_samba3=y
|
||||
CONFIG_PACKAGE_samba3-nmbd=y
|
||||
CONFIG_PACKAGE_snmpd=y
|
||||
CONFIG_PACKAGE_strace=y
|
||||
CONFIG_PACKAGE_tc=y
|
||||
CONFIG_PACKAGE_tcpdump=y
|
||||
CONFIG_PACKAGE_terminfo=y
|
||||
CONFIG_PACKAGE_tptest=y
|
||||
CONFIG_PACKAGE_traceroute6=y
|
||||
CONFIG_PACKAGE_umbim=y
|
||||
CONFIG_PACKAGE_uqmi=y
|
||||
CONFIG_PACKAGE_usb-modeswitch=y
|
||||
CONFIG_PACKAGE_usbreset=y
|
||||
CONFIG_PACKAGE_uspd=y
|
||||
CONFIG_PACKAGE_wget=y
|
||||
CONFIG_PACKAGE_wwan=y
|
||||
CONFIG_PACKAGE_libwifi=y
|
||||
CONFIG_PACKAGE_wifilife=y
|
||||
CONFIG_PACKAGE_wifimngr=y
|
||||
CONFIG_PACKAGE_libwifix=y
|
||||
CONFIG_PACKAGE_wifixd=y
|
||||
CONFIG_PACKAGE_xl2tpd=y
|
||||
CONFIG_PACKAGE_zoneinfo-core=y
|
||||
CONFIG_PACKAGE_zoneinfo-europe=y
|
||||
CONFIG_TARGET_CUSTOMER="IOPSYS"
|
||||
CONFIG_TARGET_ROOTFS_TARGZ=y
|
||||
# CONFIG_USE_SSTRIP is not set
|
||||
CONFIG_USE_STRIP=y
|
||||
CONFIG_BUILD_LOG=y
|
||||
CONFIG_BUSYBOX_CONFIG_ADDUSER=y
|
||||
CONFIG_BUSYBOX_CONFIG_ARPING=y
|
||||
CONFIG_BUSYBOX_CONFIG_ASH_RANDOM_SUPPORT=y
|
||||
CONFIG_BUSYBOX_CONFIG_CTTYHACK=y
|
||||
CONFIG_BUSYBOX_CONFIG_DELUSER=y
|
||||
# CONFIG_BUSYBOX_CONFIG_DEVMEM is not set
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_UDHCP_8021Q=y
|
||||
CONFIG_BUSYBOX_CONFIG_FIRST_SYSTEM_ID=100
|
||||
CONFIG_BUSYBOX_CONFIG_HTTPD=y
|
||||
# CONFIG_BUSYBOX_CONFIG_INSMOD is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_MODINFO is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_MODPROBE is not set
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_MODPROBE_BLACKLIST=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_CHECK_TAINTED_MODULE=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_MODUTILS_ALIAS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_MODUTILS_SYMBOLS=y
|
||||
CONFIG_BUSYBOX_CONFIG_DEFAULT_MODULES_DIR="/lib/modules"
|
||||
CONFIG_BUSYBOX_CONFIG_DEFAULT_DEPMOD_FILE="modules.dep"
|
||||
CONFIG_BUSYBOX_CONFIG_LAST_SYSTEM_ID=999
|
||||
CONFIG_BUSYBOX_CONFIG_LOGIN=y
|
||||
# CONFIG_BUSYBOX_CONFIG_LSMOD is not set
|
||||
CONFIG_BUSYBOX_CONFIG_LSPCI=y
|
||||
CONFIG_BUSYBOX_CONFIG_LSUSB=y
|
||||
CONFIG_BUSYBOX_CONFIG_MICROCOM=y
|
||||
# CONFIG_BUSYBOX_CONFIG_RMMOD is not set
|
||||
CONFIG_BUSYBOX_CONFIG_STTY=y
|
||||
CONFIG_BUSYBOX_CONFIG_TFTP=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_CHECK_TAINTED_MODULE=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_AUTH_MD5=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_BASIC_AUTH=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_CGI=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_ERROR_PAGES=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_GZIP=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_PROXY=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_RANGES=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_SETUID=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_USE_SENDFILE=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y
|
||||
# CONFIG_BUSYBOX_CONFIG_FEATURE_NOLOGIN is not set
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_SECURETTY=y
|
||||
# CONFIG_BUSYBOX_CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_TFTP_GET=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_TFTP_PUT=y
|
||||
# CONFIG_BUSYBOX_CONFIG_WGET is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_LOGIN_SCRIPTS is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_LOGIN_SESSION_AS_CHILD is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_PAM is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_TFTP_DEBUG is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_NTPD is not set
|
||||
CONFIG_LIBCURL_CRYPTO_AUTH=y
|
||||
# CONFIG_LIBCURL_MBEDTLS is not set
|
||||
CONFIG_LIBCURL_OPENSSL=y
|
||||
CONFIG_OPENVPN_openssl_ENABLE_IPROUTE2=y
|
||||
# CONFIG_SAMBA3_CONFIG_NO_PRINTING is not set
|
||||
# CONFIG_SIGNED_PACKAGES is not set
|
||||
CONFIG_KERNEL_DEVTMPFS=y
|
||||
CONFIG_KERNEL_DEVTMPFS_MOUNT=y
|
||||
# CONFIG_BUSYBOX_CONFIG_IP is not set
|
||||
LOCAL_MIRROR="http://download.iopsys.eu/iopsys/mirror/"
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
# Bash completion for IOPSYS "./iop" utility
|
||||
# Source this file into the curent shell or copy it into
|
||||
# /usr/share/bash-completion/completions/ and start a new shell
|
||||
# for automatic availability.
|
||||
|
||||
_iop_get_profiles()
|
||||
{
|
||||
find feeds/targets/iopsys-*/ -name '*.diff' \
|
||||
|awk -F'/' '{print$NF}' \
|
||||
|awk -F. '{print$1}'
|
||||
}
|
||||
|
||||
_iop_get_models()
|
||||
{
|
||||
find feeds/targets/iopsys-*/ -mindepth 1 -maxdepth 1 -type d \
|
||||
|awk -F'/' '{print$NF}' \
|
||||
|egrep '^(cg|dg|eg|vg|vox)[0-9]'
|
||||
}
|
||||
|
||||
_iop_get_model_customers()
|
||||
{
|
||||
local model=$1
|
||||
find customerconfigs/$prev -mindepth 1 -maxdepth 1 -type d \
|
||||
|awk -F'/' '{print$NF}'
|
||||
}
|
||||
|
||||
_iop()
|
||||
{
|
||||
local cur prev iopcmds
|
||||
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
iopcmds="bootstrap cfe_upgrade cfe_upgrade_latest extract_core \
|
||||
feeds_update genconfig generate_tarballs install_key \
|
||||
scp_changes setup_host ssh_install_key status \
|
||||
update_package update_feed_branches ssh_upgrade"
|
||||
|
||||
if [ $COMP_CWORD -eq 1 ] ; then
|
||||
|
||||
# Complete the primary iop command
|
||||
COMPREPLY=($(compgen -W "${iopcmds}" -- ${cur}))
|
||||
return 0
|
||||
|
||||
else
|
||||
|
||||
# Complete the arguments to "iopcmds"
|
||||
local cmd="${COMP_WORDS[1]}"
|
||||
case "$cmd" in
|
||||
|
||||
extract_core)
|
||||
if [ "$prev" == "-e" ] ; then
|
||||
_filedir -d
|
||||
else
|
||||
COMPREPLY=( $(compgen -W "-e -h" -- ${cur}) )
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
|
||||
genconfig)
|
||||
if [ "$prev" == "-p" ] ; then
|
||||
local profiles=$(_iop_get_profiles)
|
||||
COMPREPLY=( $(compgen -W "juci $profiles" -- ${cur}) )
|
||||
elif [[ $cur == -* ]] ; then
|
||||
COMPREPLY=( $(compgen -W "-c -h -p -s -t -u -v" -- ${cur}) )
|
||||
else
|
||||
local models=$(_iop_get_models)
|
||||
if echo $models |grep -qw -- $prev ; then
|
||||
local customers=$(_iop_get_model_customers $prev)
|
||||
COMPREPLY=( $(compgen -W "$customers" -- ${cur}) )
|
||||
else
|
||||
COMPREPLY=( $(compgen -W "$models" -- ${cur}) )
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
ssh_upgrade)
|
||||
if [ "$prev" == "-f" ] ; then
|
||||
_filedir
|
||||
else
|
||||
COMPREPLY=( $(compgen -W "-f -t -i -n -x -b" -- ${cur}) )
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# No arguments or arguments not supported yet
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
complete -F _iop ./iop
|
||||
complete -F _iop iop
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function disable_add_config () {
|
||||
local COPTION="$1"
|
||||
|
||||
HAVE_OPTION=`grep $COPTION .config | wc -l`
|
||||
HAVE_OPTION_DISABLED=`grep "# $COPTION" .config | wc -l`
|
||||
if [ "$HAVE_OPTION" = "1" ]
|
||||
then
|
||||
if [ "$HAVE_OPTION_DISABLED" = "0" ]
|
||||
then
|
||||
sed -i -e "s,$COPTION=y,# $COPTION is not set,g" .config
|
||||
fi
|
||||
else
|
||||
echo "# $COPTION is not set" >> .config
|
||||
fi
|
||||
}
|
||||
|
||||
function enable_option () {
|
||||
local COPTION="$1"
|
||||
# cat .config| grep DSL
|
||||
sed -i -e "s,# $COPTION is not set,$COPTION=y,g" .config
|
||||
# cat .config| grep DSL
|
||||
}
|
||||
|
||||
function annexconfig {
|
||||
|
||||
v() {
|
||||
[ "$VERBOSE" -ge 1 ] && echo "$@"
|
||||
}
|
||||
|
||||
local ANNEX="$1"
|
||||
|
||||
disable_add_config CONFIG_TARGET_NO_DSL
|
||||
disable_add_config CONFIG_TARGET_DSL_ANNEX_A
|
||||
disable_add_config CONFIG_TARGET_DSL_ANNEX_B
|
||||
disable_add_config CONFIG_TARGET_DSL_ANNEX_C
|
||||
disable_add_config CONFIG_TARGET_DSL_SADSL
|
||||
disable_add_config CONFIG_TARGET_DSL_GFAST
|
||||
|
||||
|
||||
if [ "$ANNEX" = "no" ]
|
||||
then
|
||||
echo "No DSL"
|
||||
enable_option CONFIG_TARGET_NO_DSL
|
||||
elif [ "$ANNEX" = "a" ]
|
||||
then
|
||||
echo "Annex A"
|
||||
enable_option CONFIG_TARGET_DSL_ANNEX_A
|
||||
elif [ "$ANNEX" = "b" ]
|
||||
then
|
||||
echo "Annex B"
|
||||
enable_option CONFIG_TARGET_DSL_ANNEX_B
|
||||
elif [ "$ANNEX" = "c" ]
|
||||
then
|
||||
echo "Annex C"
|
||||
enable_option CONFIG_TARGET_DSL_ANNEX_C
|
||||
elif [ "$ANNEX" = "sadsl" ]
|
||||
then
|
||||
echo "sadsl"
|
||||
enable_option CONFIG_TARGET_DSL_SADSL
|
||||
elif [ "$ANNEX" = "gfast" ]
|
||||
then
|
||||
echo "G.fast"
|
||||
enable_option CONFIG_TARGET_DSL_GFAST
|
||||
else
|
||||
echo "Only option no,a,b,c,sadsl,gfast supported"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
register_command "annexconfig" "Select configuration annex"
|
||||
@@ -1,60 +0,0 @@
|
||||
#!/bin/sh
|
||||
# build_branch
|
||||
#./iop build_branch <branch> <board> [<customer>]
|
||||
|
||||
function build_branch_usage {
|
||||
echo "usage: $0 build_branch <branch> <board> [<customer>]"
|
||||
echo "example: $0 build_branch devel-new ex400 DEV"
|
||||
echo "example: $0 build_branch_sysupgrade devel-new ex400 DEV 192.168.1.1 -n"
|
||||
set +x
|
||||
exit 1
|
||||
}
|
||||
|
||||
function branch_exists {
|
||||
local branch=$1
|
||||
[ -z "$branch" ] && return 1
|
||||
git branch | grep -q $branch && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
function build_branch {
|
||||
set -x
|
||||
local branch=$1
|
||||
local board=$2
|
||||
local customer=$3
|
||||
[ "$customer" == "INT" ] && customer=""
|
||||
|
||||
if ! branch_exists $branch ; then
|
||||
echo "Branch $branch not found"
|
||||
build_branch_usage
|
||||
fi
|
||||
|
||||
time {
|
||||
git fetch origin || build_branch_usage
|
||||
git fetch --all -p || build_branch_usage
|
||||
git checkout $branch || build_branch_usage
|
||||
git pull || exit 1
|
||||
./iop feeds_update || build_branch_usage
|
||||
./iop genconfig -c $board $customer || build_branch_usage
|
||||
make -j 8 || build_branch_usage
|
||||
set +x
|
||||
}
|
||||
}
|
||||
|
||||
function build_branch_sysupgrade {
|
||||
set -x
|
||||
local branch=$1 ; shift
|
||||
local board=$1 ; shift
|
||||
local customer=$1 ; shift
|
||||
local ip=$1 ; shift
|
||||
local opts=$*
|
||||
|
||||
time {
|
||||
./iop build_branch $branch $board $customer
|
||||
[ "$?" == "0" ] && ./iop ssh_sysupgrade_latest $ip $opts
|
||||
}
|
||||
set +x
|
||||
}
|
||||
|
||||
register_command "build_branch" "<branch> <board> [<customer>] Build a <branch> for a <board> [with a <customer> profile]"
|
||||
register_command "build_branch_sysupgrade" "<branch> <board> <customer>|INT <ip> [<opts>] Build a <branch> for a <board> [with a <customer> profile] and sysupgrade [with <opts>] it on the router at <ip>"
|
||||
@@ -1,42 +0,0 @@
|
||||
# this is a developer helper script to install firmware on a remote host running in CFE mode
|
||||
|
||||
function usage {
|
||||
echo "usage: $0 cfe_upgrade <host> <file>"
|
||||
}
|
||||
|
||||
function cfe_upgrade {
|
||||
if [ -z "$1" ] ; then
|
||||
usage
|
||||
echo "Error: host required"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$2" ] ; then
|
||||
usage
|
||||
echo "Error: firmware filename required"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -e $2 ] ; then
|
||||
usage
|
||||
echo "Error: firmware file does not exist"
|
||||
exit 1
|
||||
fi
|
||||
IMAGE=`basename $2`
|
||||
echo "CFE upgrade host: $1 with file $IMAGE"
|
||||
[ "$2" ] && [ -e "$2" ] && curl -i -F filedata=@$2 http://$1/upload.cgi && echo "upgrade done!"
|
||||
}
|
||||
|
||||
register_command "cfe_upgrade" "<host> <file> Install firmware on remote host in CFE mode"
|
||||
|
||||
function cfe_upgrade_latest {
|
||||
if [ -z "$1" ] ; then
|
||||
echo "usage: $0 cfe_upgrade_latest <host>"
|
||||
echo "Error: host required"
|
||||
exit 1
|
||||
fi
|
||||
{ cd `dirname $0`
|
||||
IMAGE=`ls -Art bin/*/*.w | tail -n1`
|
||||
[ "$IMAGE" ] && [ -e "$IMAGE" ] && ./iop cfe_upgrade $1 $IMAGE
|
||||
}
|
||||
}
|
||||
|
||||
register_command "cfe_upgrade_latest" "<host> Install latest firmware on remote host in CFE mode"
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
function compile {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Please give a valid package as first argument."
|
||||
return 1
|
||||
fi
|
||||
|
||||
local cpath pck
|
||||
local lpath=$(find package/ -type l -name $1)
|
||||
local dpath=$(find package/ -type d -name $1)
|
||||
|
||||
for pck in $lpath $dpath; do
|
||||
if [ -n "$(ls $pck/Makefile 2>/dev/null)" ]; then
|
||||
cpath=$pck
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$cpath" ]; then
|
||||
make $cpath/compile V=$2
|
||||
else
|
||||
echo "Package $1 does not exist. Make sure you have installed the necessary feed."
|
||||
fi
|
||||
}
|
||||
|
||||
register_command "compile" "Compile a specific package: ./iop compile <PACKAGE_NAME> [0-99]; i.e ./iop compile netifd 99"
|
||||
@@ -1,134 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function extract_core {
|
||||
initial_commit=1427738ac4b77f474999ae21af1a8b916468df36
|
||||
patch_dir=extract_core_patches
|
||||
topdir=$(pwd)
|
||||
|
||||
# Paths to packages that should be exported.
|
||||
paths+='package/network/services/dnsmasq '
|
||||
paths+='package/network/config/firewall '
|
||||
paths+='package/network/config/netifd '
|
||||
paths+='package/network/config/qos-scripts '
|
||||
paths+='package/utils/busybox '
|
||||
paths+='package/base-files '
|
||||
paths+='package/system/procd '
|
||||
paths+='package/system/rpcd '
|
||||
paths+='package/network/services/openvpn '
|
||||
|
||||
function print_usage {
|
||||
echo "Usage: $0 extract_core"
|
||||
echo " -p <path-to-package> | default"
|
||||
echo " -r <import-repo>"
|
||||
echo " -b <import-branch>"
|
||||
echo ""
|
||||
echo "Example: $0 extract_core"
|
||||
echo " -p package/utils/busybox"
|
||||
echo " -r feeds/lede_core"
|
||||
echo " -b devel"
|
||||
}
|
||||
|
||||
function orphan_branch {
|
||||
local branch=$1
|
||||
|
||||
git checkout --orphan $branch
|
||||
git rm -rf --cached *
|
||||
git rm -rf --cached .empty
|
||||
rm -rf *
|
||||
rm -rf .empty
|
||||
}
|
||||
|
||||
function export_core {
|
||||
local path=$1
|
||||
|
||||
echo "Extracting ${path} from core to ${import_repo}:${import_branch}"
|
||||
|
||||
# Generate patches from start of openwrt repo.
|
||||
mkdir -p $patch_dir
|
||||
repo=$(basename $path)
|
||||
dir=$(dirname $path)
|
||||
git format-patch $initial_commit $path -o $patch_dir
|
||||
|
||||
# Remove dirname from patches to commit the packages to the
|
||||
# top directory in the destination repo.
|
||||
ls $patch_dir | while read line; do
|
||||
sdir=$(echo "$dir/" | sed 's/\//\\\//g')
|
||||
sed -i "s/$sdir//g" $patch_dir/$line
|
||||
done
|
||||
|
||||
cd $import_repo
|
||||
|
||||
if [ -n "$(git rev-parse -q --verify remotes/origin/$repo)" ]; then
|
||||
# Create temporary branch to apply patches on.
|
||||
# We need to do this as git am does not like it
|
||||
# when patches have already been applied.
|
||||
orphan_branch tmp
|
||||
git am $topdir/$patch_dir/*
|
||||
|
||||
# Rebase and merge.
|
||||
git rebase origin/$repo
|
||||
git checkout --track -b $repo origin/$repo
|
||||
git merge tmp
|
||||
git br -d tmp
|
||||
else
|
||||
# Remote branch does not exist for packet so create it.
|
||||
orphan_branch $repo
|
||||
git am $topdir/$patch_dir/*
|
||||
fi
|
||||
|
||||
git push origin $repo
|
||||
|
||||
# Merge the package branch into the main branch.
|
||||
git checkout $import_branch
|
||||
git merge $repo -m "Syncing $repo"
|
||||
git push origin $import_branch
|
||||
git br -d $repo
|
||||
|
||||
rm -rf $topdir/$patch_dir
|
||||
cd $topdir
|
||||
}
|
||||
|
||||
# Execute user command
|
||||
while getopts "p:r:b:h" opt; do
|
||||
case $opt in
|
||||
p)
|
||||
export_path=${OPTARG}
|
||||
;;
|
||||
r)
|
||||
import_repo=${OPTARG}
|
||||
;;
|
||||
b)
|
||||
import_branch=${OPTARG}
|
||||
;;
|
||||
h)
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
\?)
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -n "$export_path" ] || [ ! -n "$import_repo" ] || [ ! -n "$import_branch" ]; then
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$export_path" == "default" ]; then
|
||||
echo "Extracting default packages:"
|
||||
for p in $paths; do
|
||||
export_core $p
|
||||
|
||||
done
|
||||
else
|
||||
export_core $export_path
|
||||
fi
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
register_command "extract_core" "Extract core package to separate feed"
|
||||
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function extract_top {
|
||||
tmp_dir=extract_top_tmp
|
||||
|
||||
# Paths to packages that should be ignored.
|
||||
paths+='package/network/services/dnsmasq '
|
||||
paths+='package/network/config/firewall '
|
||||
paths+='package/network/config/netifd '
|
||||
paths+='package/network/config/qos-scripts '
|
||||
paths+='package/utils/busybox '
|
||||
paths+='package/base-files '
|
||||
paths+='package/system/procd '
|
||||
paths+='package/system/rpcd '
|
||||
paths+='package/network/services/openvpn '
|
||||
|
||||
function extract {
|
||||
|
||||
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
git format-patch $start_commit -o $tmp_dir #> /dev/null
|
||||
|
||||
ls $tmp_dir |
|
||||
while read file; do
|
||||
# Remove feed patches.
|
||||
# echo $file | grep -i Update-feed > /dev/null && \
|
||||
# rm $tmp_dir/$file && continue
|
||||
cat $tmp_dir/$file | grep "+++ b/feeds.conf" > /dev/null && \
|
||||
rm $tmp_dir/$file && continue
|
||||
|
||||
# Remove core patches.
|
||||
for path in $paths; do
|
||||
cat $tmp_dir/$file | grep $path > /dev/null && \
|
||||
rm $tmp_dir/$file && break
|
||||
done
|
||||
done
|
||||
|
||||
git checkout -b ${current_branch}-new $start_commit
|
||||
git am $tmp_dir/*
|
||||
git checkout $current_branch
|
||||
rm -rf $tmp_dir
|
||||
}
|
||||
|
||||
function print_usage {
|
||||
|
||||
echo "Usage:"
|
||||
echo " $0 -s <start_commit>"
|
||||
}
|
||||
|
||||
# Execute user command
|
||||
while getopts "s:" opt; do
|
||||
case $opt in
|
||||
s)
|
||||
start_commit=${OPTARG}
|
||||
;;
|
||||
\?)
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -n "$start_commit" ]; then
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
extract
|
||||
|
||||
}
|
||||
|
||||
register_command "extract_top" "Extract commits made to top repo"
|
||||
@@ -1,62 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
function feeds_update {
|
||||
|
||||
developer=0
|
||||
override=1
|
||||
start=$(date -u +'%s');
|
||||
while getopts "n" opt; do
|
||||
case $opt in
|
||||
n)
|
||||
override=0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
git remote -v | grep -q http || developer=1
|
||||
|
||||
cp .config .genconfig_config_bak
|
||||
|
||||
#if -d argument is passed, clone feeds with ssh instead of http
|
||||
if [ $developer == 1 ]; then
|
||||
./scripts/feeds update -g
|
||||
else
|
||||
./scripts/feeds update
|
||||
fi
|
||||
./scripts/feeds update -ai
|
||||
|
||||
# replace core packages with iopsys versions
|
||||
if [ $override == 1 ]; then
|
||||
./scripts/feeds install -f -p lede_core -a
|
||||
fi
|
||||
|
||||
# targets need to be installed explicitly
|
||||
targets="iopsys-brcm63xx-mips iopsys-brcm63xx-arm iopsys-ramips intel_mips"
|
||||
for target in $targets
|
||||
do
|
||||
rm -f target/linux/$target
|
||||
./scripts/feeds install -p targets $target
|
||||
done
|
||||
|
||||
# install all packages
|
||||
./scripts/feeds install -a
|
||||
|
||||
# remove broken symlinks ( for packages that are no longer in the feed )
|
||||
find -L package/feeds -maxdepth 2 -type l -delete
|
||||
|
||||
cp .genconfig_config_bak .config
|
||||
make defconfig
|
||||
|
||||
# record when we last run this script
|
||||
touch tmp/.iop_bootstrap
|
||||
|
||||
# always return true
|
||||
exit 0
|
||||
}
|
||||
|
||||
register_command "feeds_update" "Update feeds to point to commit hashes from feeds.conf"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,445 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function genconfig {
|
||||
export CLEAN=0
|
||||
export IMPORT=1
|
||||
export SRCTREEOVERR=0
|
||||
export FILEDIR="files/"
|
||||
export THEMEDIR="themes"
|
||||
CURRENT_CONFIG_FILE=".current_config_file"
|
||||
export CONFIGPATH="package/feeds/iopsys/iop"
|
||||
CUSTPATH="customerconfigs"
|
||||
export CUSTCONF="customerconfigs/customers"
|
||||
export VERBOSE=0
|
||||
export DEVELOPER=0
|
||||
target="bogus"
|
||||
config_path=""
|
||||
brcm63xx_mips="target/linux/iopsys-brcm63xx-mips"
|
||||
brcm63xx_arm="target/linux/iopsys-brcm63xx-arm"
|
||||
ramips="target/linux/iopsys-ramips"
|
||||
intel_mips="target/linux/intel_mips"
|
||||
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
Yellow='\033[0;33m' # Yellow
|
||||
|
||||
function find_last {
|
||||
egrep "^[ #]*${1}[ =]" $2 | tail -n1
|
||||
}
|
||||
|
||||
function is_new {
|
||||
for opt in $conf_warned
|
||||
do
|
||||
if [ "$opt" == "$1" ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
# option not found return true
|
||||
return 0
|
||||
}
|
||||
|
||||
function verify_config {
|
||||
IFS=$'\n'
|
||||
org=$(<.genconfig.config)
|
||||
unset IFS
|
||||
local num
|
||||
local conf_opt
|
||||
local conf_org
|
||||
local conf_new
|
||||
|
||||
#echo "lines to check $tot_lines"
|
||||
num=0
|
||||
for line in $org
|
||||
do
|
||||
conf_opt=$(echo $line | grep CONFIG_ | sed 's|.*\(CONFIG_[^ =]*\)[ =].*|\1|')
|
||||
if [ -n "${conf_opt}" ]
|
||||
then
|
||||
conf_org=$(find_last ${conf_opt} .genconfig.config)
|
||||
conf_new=$(find_last ${conf_opt} .config)
|
||||
if [ "$conf_org" != "$conf_new" ]
|
||||
then
|
||||
if is_new $conf_opt
|
||||
then
|
||||
echo -e "config option [${Red}$conf_opt${Color_Off}] is not set correctly in .config"
|
||||
echo -e "got value [${Yellow}$conf_new${Color_Off}] but wanted [${Yellow}$conf_org${Color_Off}]"
|
||||
echo "This is a real problem somebody needs to investigate"
|
||||
echo ""
|
||||
conf_warned="$conf_warned $conf_opt"
|
||||
fi
|
||||
else
|
||||
true
|
||||
# for debug to see all options
|
||||
#echo -e "wanted [$conf_org] got [$conf_new]"
|
||||
fi
|
||||
fi
|
||||
num=$((num+1))
|
||||
done
|
||||
}
|
||||
|
||||
# Takes a board name and returns the target name in global var $target
|
||||
set_target() {
|
||||
local profile=$1
|
||||
|
||||
|
||||
[ -e $brcm63xx_mips/genconfig ] &&
|
||||
iopsys_brcm63xx_mips=$(cd $brcm63xx_mips; ./genconfig)
|
||||
[ -e $brcm63xx_arm/genconfig ] &&
|
||||
iopsys_brcm63xx_arm=$(cd $brcm63xx_arm; ./genconfig)
|
||||
[ -e $ramips/genconfig ] &&
|
||||
iopsys_ramips=$(cd $ramips; ./genconfig)
|
||||
[ -e $intel_mips/genconfig ] &&
|
||||
iopsys_intel_mips=$(cd $intel_mips; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in iopsys_brcm63xx_mips iopsys_brcm63xx_arm iopsys_ramips iopsys_intel_mips; do
|
||||
echo "$list based boards:"
|
||||
for b in ${!list}; do
|
||||
echo -e "\t$b"
|
||||
done
|
||||
done
|
||||
return
|
||||
fi
|
||||
|
||||
for p in $iopsys_brcm63xx_mips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_brcm63xx_mips"
|
||||
config_path="$brcm63xx_mips/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_brcm63xx_arm; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_brcm63xx_arm"
|
||||
config_path="$brcm63xx_arm/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_ramips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_ramips"
|
||||
config_path="$ramips/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_intel_mips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="intel_mips"
|
||||
config_path="$intel_mips/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
git remote -v | grep -q http || {
|
||||
DEVELOPER=1
|
||||
|
||||
bcmAllowed=0
|
||||
endptAllowed=0
|
||||
natalieAllowed=0
|
||||
mediatekAllowed=0
|
||||
wifilifeAllowed=0
|
||||
|
||||
git ls-remote git@dev.iopsys.eu:broadcom/bcmcreator.git -q 2>/dev/null && bcmAllowed=1
|
||||
git ls-remote git@dev.iopsys.eu:mediatek/linux.git -q 2>/dev/null && mediatekAllowed=1
|
||||
git ls-remote git@dev.iopsys.eu:dialog/natalie-dect-12.26.git -q 2>/dev/null && natalieAllowed=1
|
||||
git ls-remote git@dev.iopsys.eu:iopsys/endptmngr.git -q 2>/dev/null && endptAllowed=1
|
||||
git ls-remote git@dev.iopsys.eu:iopsys/wifilife.git -q 2>/dev/null && wifilifeAllowed=1
|
||||
}
|
||||
|
||||
v() {
|
||||
[ "$VERBOSE" -ge 1 ] && echo "$@"
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo
|
||||
echo 1>&2 "Usage: $0 [ OPTIONS ] < Board_Type > [ Customer [customer2 ]...]"
|
||||
echo
|
||||
echo -e " -c|--clean\t\tRemove all files under ./files and import from config "
|
||||
echo -e " -v|--verbose\t\tVerbose"
|
||||
echo -e " -n|--no-update\tDo NOT! Update customer config before applying"
|
||||
echo -e " -s|--override\t\tEnable 'Package source tree override'"
|
||||
echo -e " -S|--brcmsingle\tForce build of bcmkernel to use only one thread"
|
||||
echo -e " -h|--help\t\tShow this message"
|
||||
echo -e " -l|--list [customer]\tList all Customers or all boards for one customer"
|
||||
echo -e " -a|--list-all\t\tList all Customers and their board types"
|
||||
echo -e " -b|--boards\t\tList all board types"
|
||||
echo
|
||||
echo "Example ./iop genconfig dg200 TELIA"
|
||||
echo "(if no customerconfig is chosen, iopsys config will be used)"
|
||||
echo
|
||||
exit 0
|
||||
}
|
||||
|
||||
list_customers()
|
||||
{
|
||||
local ALL="$1"
|
||||
local CUSTOMER="$2"
|
||||
if [ "$CUSTOMER" -a -d "$CUSTCONF/$CUSTOMER" ]; then
|
||||
local boards="$(ls -1 "$CUSTCONF/$CUSTOMER" | grep -v common | grep -v juci-theme)"
|
||||
if [ "$boards" ]; then
|
||||
echo "$CUSTOMER has following boards:"
|
||||
for board in $boards; do
|
||||
echo -e "\t$board"
|
||||
done
|
||||
else
|
||||
echo "No boards found for $CUSTOMER"
|
||||
fi
|
||||
elif [ "$CUSTOMER" ]; then
|
||||
echo "No customer called $CUSTOMER"
|
||||
exit 1
|
||||
elif [ -d $CUSTCONF ]; then
|
||||
local customers="$(ls -1 $CUSTCONF)"
|
||||
if [ "$customers" -a "$ALL" == 1 ]; then
|
||||
for customer in $customers; do
|
||||
echo $customer
|
||||
local boards="$(ls -1 $CUSTCONF/$customer | grep -v common | grep -v juci-theme)"
|
||||
if [ "$boards" ]; then
|
||||
for board in $boards; do
|
||||
echo -e "\t$board"
|
||||
done
|
||||
else
|
||||
echo "has no boards"
|
||||
fi
|
||||
done
|
||||
elif [ "$customers" ]; then
|
||||
echo -e "$customers"
|
||||
else
|
||||
echo "no customers found"
|
||||
fi
|
||||
else
|
||||
echo "No $CUSTCONF folder found"
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
generate_config()
|
||||
{
|
||||
DIFFFILE="$1"
|
||||
MASTERFILE="$2"
|
||||
while read p; do
|
||||
v "$p"
|
||||
sed -r -i "$p" $MASTERFILE
|
||||
done < $DIFFFILE
|
||||
}
|
||||
|
||||
setup_dirs()
|
||||
{
|
||||
if git ls-remote $CUSTREPO -q 2>/dev/null; then
|
||||
if [ ! -d "$CUSTPATH" ]; then
|
||||
git clone "$CUSTREPO" "$CUSTPATH"
|
||||
elif [ $IMPORT -eq 1 ]; then
|
||||
cd $CUSTPATH
|
||||
v "git pull"
|
||||
git pull
|
||||
cd - >/dev/null #go back
|
||||
fi
|
||||
else
|
||||
echo "You do not have access to $CUSTREPO"
|
||||
fi
|
||||
|
||||
if [ ! -d "$FILEDIR" ]; then
|
||||
mkdir -p $FILEDIR
|
||||
elif [ -d "$FILEDIR" -a $CLEAN -eq 1 ]; then
|
||||
v "rm -rf $FILEDIR*"
|
||||
rm -rf $FILEDIR*
|
||||
fi
|
||||
|
||||
if [ ! -d "$THEMEDIR" ]; then
|
||||
mkdir -p $THEMEDIR
|
||||
elif [ -d "$THEMEDIR" -a $CLEAN -eq 1 ]; then
|
||||
v "rm -rf $THEMEDIR/*"
|
||||
rm -rf $THEMEDIR/*
|
||||
fi
|
||||
}
|
||||
|
||||
create_and_copy_files()
|
||||
{
|
||||
local BOARDTYPE=$1
|
||||
shift
|
||||
local CUSTOMERS=$@
|
||||
|
||||
# Validate seleced board and customers
|
||||
set_target $BOARDTYPE
|
||||
if [ $target == "bogus" ]; then
|
||||
echo "Hardware profile does not exist"
|
||||
exit 1
|
||||
elif [ -n "$CUSTOMERS" ]; then
|
||||
for CUSTOMER in $CUSTOMERS; do
|
||||
if [ ! -d "$CUSTCONF/$CUSTOMER/" ]; then
|
||||
echo "Customer profile for '$CUSTOMER' does not exist"
|
||||
exit 1
|
||||
elif [ ! -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/" ]; then
|
||||
echo "'$BOARDTYPE' board profile does not exist for customer '$CUSTOMER'"
|
||||
if [ -f "$CUSTCONF/$CUSTOMER/common/common.diff" ]; then
|
||||
echo "Common profile configuration will be used"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Generate base config
|
||||
rm -f .config
|
||||
v "Config $BOARDTYPE selected"
|
||||
v "cp $CONFIGPATH/config .config"
|
||||
cp $CONFIGPATH/config .config
|
||||
|
||||
if [ -f $config_path/config ]; then
|
||||
cat $config_path/config >> .config
|
||||
fi
|
||||
if [ -f $config_path/$BOARDTYPE/config ]; then
|
||||
cat $config_path/$BOARDTYPE/config >> .config
|
||||
fi
|
||||
|
||||
#special handling for intel_mips which use TARGET_DEVICES
|
||||
if [ "$target" = "intel_mips" ]; then
|
||||
subtarget="xrx500"
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
|
||||
echo "CONFIG_TARGET_MULTI_PROFILE=y" >> .config
|
||||
echo "CONFIG_TARGET_PER_DEVICE_ROOTFS=y" >> .config
|
||||
device=$(echo $BOARDTYPE | tr a-z A-Z)
|
||||
echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${device}=y" >> .config
|
||||
else
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${BOARDTYPE}=y" >> .config
|
||||
fi
|
||||
|
||||
echo "$CUSTOMERS $BOARDTYPE" > $CURRENT_CONFIG_FILE
|
||||
|
||||
# Add customerconfig diff if a customer is selected
|
||||
if [ -n "$CUSTOMERS" ]; then
|
||||
for CUSTOMER in $CUSTOMERS; do
|
||||
if [ -d "$CUSTCONF/$CUSTOMER/common/fs" ]; then
|
||||
v "cp -ar $CUSTCONF/$CUSTOMER/common/fs/* $FILEDIR"
|
||||
cp -ar $CUSTCONF/$CUSTOMER/common/fs/* $FILEDIR
|
||||
fi
|
||||
if [ -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/fs" ]; then
|
||||
v "cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR"
|
||||
cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR
|
||||
fi
|
||||
if [ -d "$CUSTCONF/$CUSTOMER/juci-theme" ]; then
|
||||
customer="$(echo $CUSTOMER | tr 'A-Z' 'a-z')"
|
||||
v "cp -ar $CUSTCONF/$CUSTOMER/juci-theme $THEMEDIR/juci-theme-$customer"
|
||||
cp -ar $CUSTCONF/$CUSTOMER/juci-theme $THEMEDIR/juci-theme-$customer
|
||||
fi
|
||||
if [ -e "$CUSTCONF/$CUSTOMER/common/common.diff" ]; then
|
||||
v "Apply $CUSTCONF/$CUSTOMER/common/common.diff"
|
||||
cat $CUSTCONF/$CUSTOMER/common/common.diff >> .config
|
||||
fi
|
||||
if [ -e "$CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff" ]; then
|
||||
v "Apply $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff"
|
||||
cat $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff >> .config
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Set target version
|
||||
local GIT_TAG=$(git describe --abbrev=0 --tags)
|
||||
echo "CONFIG_TARGET_VERSION=\"${GIT_TAG}\"" >> .config
|
||||
|
||||
# Enable Pckage source tree override if selected
|
||||
[ $SRCTREEOVERR -eq 1 ] && echo CONFIG_SRC_TREE_OVERRIDE=y >> .config
|
||||
|
||||
# developer mode selected ?
|
||||
echo "CONFIG_DEVEL=y" >>.config
|
||||
if [ $DEVELOPER -eq 1 ]; then
|
||||
# rewrite url to clone with ssh instead of http
|
||||
echo "CONFIG_GITMIRROR_REWRITE=y" >>.config
|
||||
[ $bcmAllowed -eq 0 ] && echo "CONFIG_BCM_OPEN=y" >> .config
|
||||
[ $endptAllowed -eq 0 ] && echo "CONFIG_ENDPT_OPEN=y" >> .config
|
||||
[ $natalieAllowed -eq 0 ] && echo "CONFIG_NATALIE_OPEN=y" >> .config
|
||||
[ $mediatekAllowed -eq 0 ] && echo "CONFIG_MEDIATEK_OPEN=y" >> .config
|
||||
[ $wifilifeAllowed -eq 0 ] && echo "CONFIG_WIFILIFE_OPEN=y" >> .config
|
||||
else
|
||||
echo "# CONFIG_GITMIRROR_REWRITE is not set" >>.config
|
||||
echo "CONFIG_BCM_OPEN=y" >> .config
|
||||
echo "CONFIG_ENDPT_OPEN=y" >> .config
|
||||
echo "CONFIG_NATALIE_OPEN=y" >> .config
|
||||
echo "CONFIG_MEDIATEK_OPEN=y" >> .config
|
||||
echo "CONFIG_WIFILIFE_OPEN=y" >> .config
|
||||
fi
|
||||
|
||||
if [ -n "$BRCM_MAX_JOBS" ]
|
||||
then
|
||||
echo "CONFIG_BRCM_MAX_JOBS=\"1\"" >>.config
|
||||
fi
|
||||
|
||||
# Force regeneration of themes
|
||||
touch package/feeds/juci/juci/Makefile
|
||||
|
||||
# Force regeneration of kernel Makefile
|
||||
# Needed to disable kmods for iopsys-brcm targets
|
||||
touch package/kernel/linux/Makefile
|
||||
|
||||
# we need to signal to bradcom SDK that we have changed the board id
|
||||
# currently boardparms.c and boardparms_voice.c is the only place that is depending on inteno boardid name
|
||||
# so just touch that file.
|
||||
[ -d ./build_dir ] && find build_dir/ -name "boardparms*c" -print0 2>/dev/null | xargs -0 touch 2>/dev/null
|
||||
|
||||
# Store generated config
|
||||
cp .config .genconfig.config
|
||||
|
||||
# Set default values based on selected parameters
|
||||
v "$(make defconfig 2>&1)"
|
||||
|
||||
echo Set version to $(grep -w CONFIG_TARGET_VERSION .config | cut -d'=' -f2 | tr -d '"')
|
||||
|
||||
# Clean base-file package to force rebuild when changing profile
|
||||
v "$(make package/base-files/clean 2>&1)"
|
||||
|
||||
verify_config
|
||||
}
|
||||
|
||||
####### main #####
|
||||
if [ ! -e tmp/.iop_bootstrap ]; then
|
||||
echo "You have not installed feeds. Running genconfig in this state would create a non functional configuration."
|
||||
echo "Run: iop feeds_update"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo Current profile:
|
||||
cat $CURRENT_CONFIG_FILE
|
||||
echo "Try ./iop genconfig -h' to get instructions if you want to change current config"
|
||||
exit 0
|
||||
else
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
|
||||
-c|--clean) export CLEAN=1;;
|
||||
-n|--no-update) export IMPORT=0;;
|
||||
-v|--verbose) export VERBOSE="$(($VERBOSE + 1))";;
|
||||
-p|--profile) export PROFILE="$2"; shift;;
|
||||
-r|--repo) export CUSTREPO="$2"; shift;;
|
||||
-s|--override) export SRCTREEOVERR=1;;
|
||||
-S|--brcmsingel) export BRCM_MAX_JOBS=1;;
|
||||
-h|--help) usage;;
|
||||
-l|--list) list_customers 0 $2;;
|
||||
-a|--list-all)list_customers 1;;
|
||||
-b|--boards)set_target LIST;exit 0;;
|
||||
-*)
|
||||
echo "Invalid option: $1 "
|
||||
echo "Try -h or --help for more information."
|
||||
exit 1
|
||||
;;
|
||||
*) break;;
|
||||
esac
|
||||
shift;
|
||||
done
|
||||
|
||||
CUSTREPO="${CUSTREPO:-git@dev.iopsys.eu:consumer/iopsys.git}"
|
||||
|
||||
setup_dirs
|
||||
create_and_copy_files "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
register_command "genconfig" "Generate configuration for board and customer"
|
||||
@@ -1,168 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
build_bcmkernel_consumer() {
|
||||
local tarfile bcmkernelcommith sdkversion
|
||||
sdkversion=$(grep "CONFIG_BRCM_SDK_VER.*=y" .config | awk -F'[_,=]' '{print$5}')
|
||||
sdkversion=${sdkversion:0:4}${sdkversion:(-1)}
|
||||
bcmkernelcommith=$(grep -w "PKG_SOURCE_VERSION:" $curdir/feeds/broadcom/bcmkernel/${sdkversion:0:5}*.mk | cut -d'=' -f2)
|
||||
# do not build bcmopen sdk if it was already built before
|
||||
[ -n "$board" -a -n "$bcmkernelcommith" ] || return
|
||||
ssh $SERVER "test -f $FPATH/bcmopen-$board-$bcmkernelcommith.tar.gz" && return
|
||||
cd ./build_dir/target-*/bcmkernel-*-${sdkversion:0:4}*/bcm963xx/release
|
||||
bash do_consumer_release -p $profile -y -F
|
||||
tarfile='out/bcm963xx_*_consumer.tar.gz'
|
||||
[ $(ls -1 $tarfile |wc -l) -ne 1 ] && echo "Too many tar files: '$tarfile'" && return
|
||||
scp -pv $tarfile $SERVER:$FPATH/bcmopen-$board-$bcmkernelcommith.tar.gz
|
||||
ssh $SERVER "[ -f $FPATH/bcmopen-$board-$bcmkernelcommith.tar.gz ] && ln -sf $FPATH/bcmopen-$board-$bcmkernelcommith.tar.gz $FPATH/bcmopen-$board-$majver.$minver-latest"
|
||||
rm -f $tarfile
|
||||
cd "$curdir"
|
||||
}
|
||||
|
||||
build_natalie_consumer() {
|
||||
# create natalie-dect open version tar file
|
||||
local natalieversion nataliecommith
|
||||
grep -q "CONFIG_TARGET_NO_DECT=y" .config && return
|
||||
natalieversion=$(grep -w "PKG_VERSION:" ./feeds/iopsys/natalie-dect/Makefile | cut -d'=' -f2)
|
||||
nataliecommith=$(grep -w "PKG_SOURCE_VERSION:" ./feeds/iopsys/natalie-dect/Makefile | cut -d'=' -f2)
|
||||
[ -n "$profile" -a -n "$natalieversion" -a -n "$nataliecommith" ] || return
|
||||
ssh $SERVER "test -f $FPATH/natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz" && return
|
||||
cd ./build_dir/target-*/natalie-dect-$natalieversion/
|
||||
mkdir natalie-dect-open-$natalieversion
|
||||
cp -f ipkg-*/natalie-dect/lib/modules/*/extra/dect.ko natalie-dect-open-$natalieversion/dect.ko
|
||||
tar -czv natalie-dect-open-$natalieversion/ -f natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz
|
||||
scp -pv natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz $SERVER:$FPATH/
|
||||
cp natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz $curdir/
|
||||
rm -rf natalie-dect-open-$natalieversion
|
||||
rm -f natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz
|
||||
cd "$curdir"
|
||||
}
|
||||
|
||||
build_endptmngr_consumer() {
|
||||
# create endptmngr open version tar file
|
||||
local endptversion endptcommith
|
||||
grep -q "CONFIG_TARGET_NO_VOICE=y" .config && return
|
||||
endptversion=$(grep -w "PKG_VERSION:" ./feeds/iopsys/endptmngr/Makefile | cut -d'=' -f2)
|
||||
endptcommith=$(grep -w "PKG_SOURCE_VERSION:" ./feeds/iopsys/endptmngr/Makefile | cut -d'=' -f2)
|
||||
[ -n "$profile" -a -n "$endptversion" -a -n "$endptcommith" ] || return
|
||||
ssh $SERVER "test -f $FPATH/endptmngr-$profile-$endptversion-$endptcommith.tar.gz" && return
|
||||
cd ./build_dir/target-*/endptmngr-$endptversion/
|
||||
mkdir endptmngr-open-$endptversion
|
||||
mkdir endptmngr-open-$endptversion/src
|
||||
cp ./src/endptmngr endptmngr-open-$endptversion/src
|
||||
cp -r ./files/ endptmngr-open-$endptversion/
|
||||
tar -czv endptmngr-open-$endptversion/ -f endptmngr-$profile-$endptversion-$endptcommith.tar.gz
|
||||
scp -pv endptmngr-$profile-$endptversion-$endptcommith.tar.gz $SERVER:$FPATH/
|
||||
cp endptmngr-$profile-$endptversion-$endptcommith.tar.gz $curdir/
|
||||
rm -rf endptmngr-open-$endptversion
|
||||
rm -f endptmngr-$profile-$endptversion-$endptcommith.tar.gz
|
||||
cd "$curdir"
|
||||
}
|
||||
|
||||
build_wifilife_consumer() {
|
||||
local ver commit
|
||||
ver=$(grep -w "PKG_VERSION:" ./feeds/iopsys/wifilife/Makefile | cut -d'=' -f2)
|
||||
commit=$(grep -w "PKG_SOURCE_VERSION:" ./feeds/iopsys/wifilife/Makefile | cut -d'=' -f2)
|
||||
[ -n "$ver" -a -n "$commit" ] || return
|
||||
ssh $SERVER "test -f $FPATH/wifilife-$target-${ver}_${commit}.tar.xz" && return
|
||||
cd ./build_dir/target-*/wifilife-$ver/ipkg-* || cd ./build_dir/target-mips*musl-*/wifilife-$ver/ipkg-*
|
||||
mkdir -p wifilife-$ver/src
|
||||
cp -rf wifilife/usr/sbin/* wifilife-$ver/src/
|
||||
tar Jcf wifilife-${target}-${ver}_${commit}.tar.xz wifilife-$ver
|
||||
scp -pv wifilife-$target-${ver}_${commit}.tar.xz $SERVER:$FPATH/
|
||||
cp wifilife-${target}-${ver}_${commit}.tar.xz $curdir/
|
||||
rm -rf wifilife-$ver
|
||||
rm -f wifilife-${target}-${ver}_${commit}.tar.xz
|
||||
cd "$curdir"
|
||||
}
|
||||
|
||||
build_mediatek_kernel() {
|
||||
local mediatek_commit kernel_version kernel
|
||||
|
||||
mediatek_commit=$(grep CONFIG_KERNEL_GIT_COMMIT .config | cut -d '=' -f2 | tr -d '"')
|
||||
kernel_version=$(grep KERNEL_PATCHVER target/linux/iopsys-ramips/Makefile | cut -d '=' -f2)
|
||||
kernel=linux-${kernel_version}.*
|
||||
[ -n "$mediatek_commit" ] || return
|
||||
ssh $SERVER "test -f $FPATH/mediatek-kernel-open-$mediatek_commit.tar.gz" && return
|
||||
echo "Building mediatek kernel tarball from kernel commit:"
|
||||
echo $mediatek_commit
|
||||
cd build_dir/target-mipsel_1004kc*/linux-iopsys-ramips*/$kernel
|
||||
|
||||
# Save Kconfig files to recreate the same kernel config,
|
||||
# delete everyting else.
|
||||
find drivers/net/wireless/mt_wifi -type f ! -name Kconfig | xargs rm
|
||||
find drivers/net/wireless/rlt_wifi -type f ! -name Kconfig | xargs rm
|
||||
|
||||
# remove git repo
|
||||
rm -rf .git
|
||||
|
||||
# patch kernel for openstk
|
||||
ls consumer_release | while read line; do patch -p1 < consumer_release/$line; done
|
||||
cd ..
|
||||
|
||||
tar -czv $kernel -f mediatek-kernel-open-$mediatek_commit.tar.gz
|
||||
scp -pv mediatek-kernel-open-$mediatek_commit.tar.gz $SERVER:$FPATH/
|
||||
cd "$curdir"
|
||||
}
|
||||
|
||||
function print_usage {
|
||||
echo "Usage: $0 generate_tarballs"
|
||||
echo " -t <target>"
|
||||
}
|
||||
|
||||
function generate_tarballs {
|
||||
|
||||
SERVER="god@download.iopsys.eu"
|
||||
FPATH="/var/www/html/iopsys/opensdk"
|
||||
|
||||
set -e
|
||||
git remote -v | grep -q http && return # do not continue if this is an open SDK environment
|
||||
|
||||
target=$(grep CONFIG_TARGET_BOARD .config | cut -d'=' -f2 | tr -d '"')
|
||||
board=$(grep CONFIG_TARGET_IBOARDID .config | cut -d'=' -f2 | tr -d '"')
|
||||
profile=$(grep CONFIG_BCM_KERNEL_PROFILE .config | cut -d'=' -f2 | tr -d '"')
|
||||
majver=$(grep CONFIG_TARGET_VERSION .config | cut -d'=' -f2 | tr -d '"' | cut -f1 -d .)
|
||||
minver=$(grep CONFIG_TARGET_VERSION .config | cut -d'=' -f2 | tr -d '"' | cut -f2 -d .)
|
||||
curdir="$PWD"
|
||||
|
||||
|
||||
# Execute user command
|
||||
while getopts "t:h" opt; do
|
||||
case $opt in
|
||||
t)
|
||||
stk_target=${OPTARG}
|
||||
;;
|
||||
h)
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
\?)
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -n "$stk_target" ]; then
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$stk_target" == "broadcom" ]; then
|
||||
build_bcmkernel_consumer
|
||||
build_natalie_consumer
|
||||
build_endptmngr_consumer
|
||||
build_wifilife_consumer
|
||||
elif [ "$stk_target" == "mediatek" ]; then
|
||||
build_mediatek_kernel
|
||||
build_wifilife_consumer
|
||||
else
|
||||
echo "Invalid target: $stk_target"
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
register_command "generate_tarballs" "Generate tarballs for Open SDK"
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
# this is a developer helper script to install the public ssh key in the created image
|
||||
|
||||
function install_key {
|
||||
|
||||
mkdir -p files/etc/dropbear
|
||||
test -e ~/.ssh/id_dsa.pub && cat ~/.ssh/id_dsa.pub >>files/etc/dropbear/authorized_keys
|
||||
test -e ~/.ssh/id_rsa.pub && cat ~/.ssh/id_rsa.pub >>files/etc/dropbear/authorized_keys
|
||||
chmod 0644 files/etc/dropbear/authorized_keys
|
||||
|
||||
echo "::sysinit:/etc/init.d/rcS S boot" >files/etc/inittab
|
||||
echo "::shutdown:/etc/init.d/rcS K shutdown" >>files/etc/inittab
|
||||
echo "tty/0::askfirst:/bin/ash --login" >>files/etc/inittab
|
||||
echo "console::askfirst:/bin/cttyhack /bin/ash --login" >>files/etc/inittab
|
||||
|
||||
echo Done
|
||||
}
|
||||
|
||||
register_command "install_key" "Install the user's public ssh key in the created image"
|
||||
@@ -1,326 +0,0 @@
|
||||
# this is a developer helper script to install firmware on a remote host with SSH
|
||||
|
||||
function upd_usage {
|
||||
echo "usage: $0 iopupgrade -t <host> -f <file> [opts] "
|
||||
echo ""
|
||||
echo " Default host is 192.168.1.1"
|
||||
echo " Default firmware file is the newest one found"
|
||||
echo " Default is to not keep configuration"
|
||||
echo "opts:"
|
||||
echo ""
|
||||
echo " -i Interactive use, Allows to select firmware file"
|
||||
echo " -n Do not do the final reboot of the target board"
|
||||
echo " -c Keep configuration"
|
||||
echo " -x Force install even if firmware is not for this board"
|
||||
echo " -b Force install of bootloader regardless of version installed"
|
||||
echo " -s Use sysupgade. old upgrade method, needed for old releases that do not have iopu"
|
||||
}
|
||||
|
||||
function set_config_string {
|
||||
eval `grep $1 .config`
|
||||
}
|
||||
|
||||
function upd_ask_ok {
|
||||
echo "Will Continue with the following settings"
|
||||
echo "-----------------------------------------"
|
||||
printf "%20s: %s\n" "Firmare file" "$upd_fw_base"
|
||||
printf "%20s: %s\n" "Host ip" "$upd_host"
|
||||
printf "%20s: " "Reboot"; if [ "$upd_noreboot" == "0" ] ;then printf "Yes\n" ;else printf "No\n";fi
|
||||
printf "%20s: " "Keep config"; if [ "$upd_keepconf" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi
|
||||
printf "%20s: " "Force bootloader"; if [ "$upd_forceboot" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi
|
||||
printf "%20s: " "Force image upgrade"; if [ "$upd_forceimage" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi
|
||||
printf "%20s: " "Use sysupgrade"; if [ "$upd_sysupgrade" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi
|
||||
echo "-----------------------------------------"
|
||||
|
||||
if [ "$upd_sysupgrade" == "0" ]
|
||||
then
|
||||
if [ "$upd_keepconf" == "1" ] ;then echo "keeping config is just a fantasy it's not yet implemented, try sysupgrade";fi
|
||||
fi
|
||||
|
||||
echo -n "Continue? [Y/n/q]:"
|
||||
read answer
|
||||
|
||||
case $answer in
|
||||
n|N)
|
||||
return 1;;
|
||||
q|Q)
|
||||
exit 1;;
|
||||
y|Y|*)
|
||||
return 0;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select_file {
|
||||
|
||||
dialog --keep-tite --title "To select file use TAB/ARROW to hilight then press SPACEBAR -> RETURN" \
|
||||
--fselect "bin/targets/$CONFIG_TARGET_BOARD/generic/" \
|
||||
$((lines -10)) $((cols -5)) \
|
||||
2> $tempfile
|
||||
|
||||
new_file=$(cat $tempfile)
|
||||
if [ -n "$new_file" ]
|
||||
then
|
||||
upd_fw="$new_file"
|
||||
upd_fw_base=$(basename $upd_fw);
|
||||
fi
|
||||
}
|
||||
|
||||
function upd_select_target {
|
||||
|
||||
dialog --keep-tite --title "Input the name/ip number of target board" \
|
||||
--inputbox "Name/IP" \
|
||||
$((lines -10)) $((cols -5)) \
|
||||
"$upd_host" \
|
||||
2> $tempfile
|
||||
|
||||
new_file=$(cat $tempfile)
|
||||
if [ -n "$new_file" ]
|
||||
then
|
||||
upd_host="$new_file"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function upd_select_reboot {
|
||||
dialog --keep-tite --radiolist "Should the board reboot after download finished" \
|
||||
$((lines -5)) $((cols -5)) $((lines -5 -5)) \
|
||||
"Reboot" "Restart board after done" `if [ "$upd_noreboot" == "0" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
"No reboot" "Continue running old system" `if [ "$upd_noreboot" == "1" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
2> $tempfile
|
||||
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
"No reboot")
|
||||
upd_noreboot=1
|
||||
;;
|
||||
"Reboot")
|
||||
upd_noreboot=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select_config {
|
||||
dialog --keep-tite --radiolist "Should the configuration be keept" \
|
||||
$((lines -5)) $((cols -5)) $((lines -5 -5)) \
|
||||
"Keep" "Keep the config from old system" `if [ "$upd_keepconf" == "1" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
"Default" "Use default config for new system" `if [ "$upd_keepconf" == "0" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
2> $tempfile
|
||||
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
"Keep")
|
||||
upd_keepconf=1
|
||||
;;
|
||||
"Default")
|
||||
upd_keepconf=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select_forceboot {
|
||||
dialog --keep-tite --radiolist "Should the boot loader be updated reagardless of version installed" \
|
||||
$((lines -5)) $((cols -5)) $((lines -5 -5)) \
|
||||
"Force" "Alwasy update boot loader" `if [ "$upd_forceboot" == "1" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
"Version check" "Only upgrade if version is newer" `if [ "$upd_forceboot" == "0" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
2> $tempfile
|
||||
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
"Force")
|
||||
upd_forceboot=1
|
||||
;;
|
||||
"Version check")
|
||||
upd_forceboot=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select_forceimage {
|
||||
dialog --keep-tite --radiolist "Should the image be stored in flash even if sanity checks would reject it" \
|
||||
$((lines -5)) $((cols -5)) $((lines -5 -5)) \
|
||||
"Force" "Dissable sanity check and force use of image (dangerous)" `if [ "$upd_forceimage" == "1" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
"Only compatible" "Normal checks apply" `if [ "$upd_forceimage" == "0" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
2> $tempfile
|
||||
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
"Force")
|
||||
upd_forceimage=1
|
||||
;;
|
||||
"Only compatible")
|
||||
upd_forceimage=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select_sysupgrade {
|
||||
dialog --keep-tite --radiolist "Use the old way to upgrade a board" \
|
||||
$((lines -5)) $((cols -5)) $((lines -5 -5)) \
|
||||
"iopu" "Use the iop upgrade methode" `if [ "$upd_sysupgrade" == "0" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
"sysupgrade" "Use the old sysupgrade methode" `if [ "$upd_sysupgrade" == "1" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
2> $tempfile
|
||||
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
"iopu")
|
||||
upd_sysupgrade=0
|
||||
;;
|
||||
"sysupgrade")
|
||||
upd_sysupgrade=1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select {
|
||||
|
||||
dialog --keep-tite --ok-label "Select" --cancel-label "Done" --menu "Select Item to change" \
|
||||
$((lines -5)) $((cols -5)) $((lines -5 -5)) \
|
||||
"Firmare file" "$upd_fw_base"\
|
||||
"Host ip" "$upd_host" \
|
||||
"Reboot" `if [ "$upd_noreboot" == "0" ] ;then printf "Yes\n" ;else printf "No\n";fi` \
|
||||
"Keep config" `if [ "$upd_keepconf" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi` \
|
||||
"Force bootloader" `if [ "$upd_forceboot" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi` \
|
||||
"Force image upgrade" `if [ "$upd_forceimage" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi` \
|
||||
"sysupgrade" `if [ "$upd_sysupgrade" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi` \
|
||||
2> $tempfile
|
||||
|
||||
|
||||
case $(cat $tempfile) in
|
||||
"Firmare file")
|
||||
upd_select_file
|
||||
;;
|
||||
"Host ip")
|
||||
upd_select_target
|
||||
;;
|
||||
"Reboot")
|
||||
upd_select_reboot
|
||||
;;
|
||||
"Keep config")
|
||||
upd_select_config
|
||||
;;
|
||||
"Force bootloader")
|
||||
upd_select_forceboot
|
||||
;;
|
||||
"Force image upgrade")
|
||||
upd_select_forceimage
|
||||
;;
|
||||
"sysupgrade")
|
||||
upd_select_sysupgrade
|
||||
;;
|
||||
*)
|
||||
return
|
||||
;;
|
||||
esac
|
||||
upd_select
|
||||
}
|
||||
function upd_select_start {
|
||||
lines=$(tput lines)
|
||||
cols=$(tput cols)
|
||||
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
|
||||
trap "rm -f $tempfile" 0 1 2 5 15
|
||||
upd_select
|
||||
|
||||
}
|
||||
|
||||
function ssh_upgrade {
|
||||
upd_noreboot=0
|
||||
upd_forceboot=0
|
||||
upd_keepconf=0
|
||||
upd_forceimage=0
|
||||
upd_fw_base=""
|
||||
upd_fw=""
|
||||
upd_host="192.168.1.1"
|
||||
upd_sysupgrade=0
|
||||
do_dialog=0
|
||||
|
||||
while getopts "f:hnxt:iscb" opt; do
|
||||
case $opt in
|
||||
n)
|
||||
upd_noreboot=1
|
||||
;;
|
||||
x)
|
||||
upd_forceimage=1
|
||||
;;
|
||||
b)
|
||||
upd_forceboot=1
|
||||
;;
|
||||
c)
|
||||
upd_keepconf=1
|
||||
;;
|
||||
v)
|
||||
verbose=$OPTARG
|
||||
;;
|
||||
f)
|
||||
upd_fw=$OPTARG
|
||||
;;
|
||||
t)
|
||||
upd_host=$OPTARG
|
||||
;;
|
||||
i)
|
||||
do_dialog=1
|
||||
;;
|
||||
s)
|
||||
upd_sysupgrade=1
|
||||
;;
|
||||
h)
|
||||
upd_usage
|
||||
exit 1
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "$upd_fw" ]
|
||||
then
|
||||
upd_fw_base=$(basename $upd_fw);
|
||||
else
|
||||
set_config_string CONFIG_TARGET_BOARD
|
||||
firmwares=$(cd bin/targets/$CONFIG_TARGET_BOARD/generic/; ls -t *[0-9].y[3])
|
||||
|
||||
for upd_fw_base in $firmwares
|
||||
do
|
||||
#echo "firmware $upd_fw"
|
||||
break
|
||||
done
|
||||
upd_fw="bin/targets/$CONFIG_TARGET_BOARD/generic/$upd_fw_base"
|
||||
fi
|
||||
|
||||
[ $do_dialog -eq 1 ] && upd_select_start
|
||||
|
||||
if ! upd_ask_ok
|
||||
then
|
||||
upd_select_start
|
||||
if ! upd_ask_ok
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f $upd_fw ]
|
||||
then
|
||||
echo "firmware file $firmware do not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $upd_sysupgrade -eq 0 ]
|
||||
then
|
||||
extra_args=""
|
||||
[ $upd_noreboot -eq 1 ] && extra_args="$extra_args -n"
|
||||
[ $upd_forceimage -eq 1 ] && extra_args="$extra_args -x"
|
||||
[ $upd_forceboot -eq 1 ] && extra_args="$extra_args -b"
|
||||
|
||||
file_size_kb=`du -k "$upd_fw" | cut -f1`
|
||||
cat $upd_fw | pv -s ${file_size_kb}k | ssh root@$upd_host "iopu $extra_args"
|
||||
else
|
||||
scp $upd_fw root@$upd_host:/tmp/ &&
|
||||
ssh -o ConnectTimeout=60 root@$upd_host "sysupgrade -v $3 /tmp/$upd_fw_base" &&
|
||||
echo "sysupgrade done!"
|
||||
fi
|
||||
}
|
||||
|
||||
register_command "ssh_upgrade" "-h <host> -f <file> [opts] Install firmware on remote host with SSH"
|
||||
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
# this is a developer helper script to SCP changed files to remote host
|
||||
|
||||
ROOT=build_dir/target-mips_uClibc-0.9.33.2/root-iopsys-brcm63xx-mips/
|
||||
ROOT_OLD=tmp/root_old/
|
||||
ROOT_TMP=tmp/root_tmp/
|
||||
|
||||
function scp_changes_reset {
|
||||
{ cd `dirname $0`
|
||||
rm -rf "$ROOT_OLD"
|
||||
mkdir -p "$ROOT_OLD"
|
||||
cp -a "$ROOT"* "$ROOT_OLD"
|
||||
}
|
||||
}
|
||||
|
||||
function scp_changes {
|
||||
if [ -z "$1" ] ; then
|
||||
echo "usage: $0 scp_changes <host/-r(eset)/-p(retend)>"
|
||||
echo "Error: host required"
|
||||
exit 1
|
||||
fi
|
||||
{ cd `dirname $0`
|
||||
if [ ! -d $ROOT ]; then
|
||||
echo "$ROOT does not exist"
|
||||
echo "please build the project first"
|
||||
exit 1;
|
||||
fi
|
||||
if [ "$1" = "-r" ]; then
|
||||
echo "reset changes"
|
||||
scp_changes_reset
|
||||
exit 0
|
||||
fi
|
||||
if [ ! -d $ROOT_OLD ]; then
|
||||
echo "$ROOT_OLD does not exist"
|
||||
echo "you didn't store state of previous buildroot"
|
||||
#echo "please run ./scp_changes_reset.sh"
|
||||
echo "doing it now"
|
||||
scp_changes_reset
|
||||
exit 1;
|
||||
fi
|
||||
FILES=`diff -rq "$ROOT" "$ROOT_OLD" 2>&1 | sed -ne "s?^Files .* and $ROOT_OLD\\(.*\\) differ?\\1?p" -ne "s?^Only in $ROOT\\(.*\\): \\(.*\\)?\\1/\\2?p"`
|
||||
if [ "$1" = "-p" ]; then
|
||||
echo "files that would be copied:"
|
||||
echo $FILES
|
||||
exit 0
|
||||
fi
|
||||
for f in $FILES
|
||||
do
|
||||
mkdir -p "$ROOT_TMP`dirname $f`"
|
||||
cp -af "$ROOT$f" "$ROOT_TMP$f"
|
||||
done
|
||||
if [ -d "$ROOT_TMP" ]; then
|
||||
echo "scp changed files to $1"
|
||||
pushd "$ROOT_TMP" 2>&1 >/dev/null
|
||||
scp -r * root@$1:/
|
||||
RETVAL=$?
|
||||
popd 2>&1 >/dev/null
|
||||
rm -rf "$ROOT_TMP"
|
||||
if [ "$RETVAL" -eq 0 ]; then
|
||||
scp_changes_reset
|
||||
else
|
||||
echo "scp error"
|
||||
exit $RETVAL
|
||||
fi
|
||||
else
|
||||
echo "no change"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
register_command "scp_changes" "<host/-r(eset)/-p(retend)> SCP only changed files to device"
|
||||
@@ -1,17 +0,0 @@
|
||||
# this is a developer helper script to install the public ssh key on host running dropbear
|
||||
|
||||
function ssh_install_key {
|
||||
if [ -e ~/.ssh/id_rsa.pub ]; then
|
||||
echo "Adding public RSA key to $1"
|
||||
KEY=`cat ~/.ssh/id_rsa.pub`
|
||||
elif [ -e ~/.ssh/id_dsa.pub ]; then
|
||||
echo "Adding public DSA key to $1"
|
||||
KEY=`cat ~/.ssh/id_dsa.pub`
|
||||
else
|
||||
echo "No public key found"
|
||||
exit 1
|
||||
fi
|
||||
ssh root@$1 "echo '$KEY' >> /etc/dropbear/authorized_keys" && echo ok
|
||||
}
|
||||
|
||||
register_command "ssh_install_key" "Install the users public ssh key on host running dropbear"
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function status {
|
||||
topdir=$PWD
|
||||
echo
|
||||
for subdir in .git $(find feeds/ -type d -name .git); do
|
||||
|
||||
echo "======= $(dirname $subdir) ========"
|
||||
cd $subdir/..
|
||||
if git status |grep -Eq '^\s([^\s\(]+)'; then
|
||||
git status |grep -Ev '(nothing added|use "git |^$)'
|
||||
else
|
||||
git status |grep -E "(On branch|HEAD detached)"
|
||||
fi
|
||||
cd $topdir
|
||||
done
|
||||
echo
|
||||
}
|
||||
|
||||
register_command "status" "Display the state of your working tree"
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Exported interface
|
||||
function update_feed_branches {
|
||||
local release="$1"
|
||||
local ipath="$(pwd)"
|
||||
local branch="$2"
|
||||
local curbranch
|
||||
|
||||
[ -n "$release" ] || {
|
||||
echo "Usage: ./update_feeds <RELEASE> <BRANCH>"
|
||||
echo ""
|
||||
echo "If you do not give a branch as argument,"
|
||||
echo "<RELEASE> branch will be updated to commit"
|
||||
echo "hash given in feeds.conf for each feed repo"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ -n "$branch" ]; then
|
||||
echo "Updating release branch $release to specific commit hash given in feeds.conf for each feed repo at branch $branch"
|
||||
if git diff-index --quiet HEAD; then
|
||||
curbranch=`git symbolic-ref HEAD 2>/dev/null`
|
||||
curbranch=${curbranch##refs/heads/}
|
||||
if [ -z $curbranch ]; then
|
||||
curbranch=`git log -1 --pretty=format:"%H"`
|
||||
fi
|
||||
git checkout $branch || {
|
||||
echo "couldn't checkout branch $branch"
|
||||
exit 99
|
||||
}
|
||||
else
|
||||
echo "You have unsaved changes."
|
||||
exit 99
|
||||
fi
|
||||
else
|
||||
echo "Updating release branch $release to specific commit hash given in feeds.conf for each feed repo"
|
||||
fi
|
||||
|
||||
ifeeds="$(grep -r 'dev.iopsys.eu' feeds.conf | awk '{print$2}' | tr '\n' ' ')"
|
||||
|
||||
for f in $ifeeds; do
|
||||
commith=$(grep $f feeds.conf | cut -d'^' -f2)
|
||||
cd $ipath/feeds/$f
|
||||
git branch -D $release 2>/dev/null
|
||||
echo "$f: updating release branch $release to commit $commith"
|
||||
git checkout $commith
|
||||
git push origin :$release
|
||||
git checkout -b $release
|
||||
git push --set-upstream origin $release
|
||||
cd $ipath
|
||||
done
|
||||
|
||||
if [ -n "$branch" ]; then
|
||||
echo "Release branch $release is updated to specific commit hash given in feeds.conf in in branch $branch for each feed repo"
|
||||
git checkout $curbranch
|
||||
else
|
||||
echo "Release branch $release is updated to specific commit hash given in feeds.conf for each feed repo"
|
||||
fi
|
||||
}
|
||||
|
||||
register_command "update_feed_branches" "<release> [branch] Update branches in feeds from the current top level commit or specified top level branch"
|
||||
@@ -1,645 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
print_git_update()
|
||||
{
|
||||
echo "pkg -> ${PKG_NAME}"
|
||||
echo " PKG_BUILD_DIR = ${PKG_BUILD_DIR}"
|
||||
echo " PKG_DIR = ${PKG_DIR}"
|
||||
echo " PKG_SOURCE = ${PKG_SOURCE}"
|
||||
echo " PKG_NAME = ${PKG_NAME}"
|
||||
echo " PKG_SOURCE_URL = ${PKG_SOURCE_URL}"
|
||||
echo " PKG_SOURCE_PROTO= ${PKG_SOURCE_PROTO}"
|
||||
echo " PKG_SOURCE_VERSION= ${PKG_SOURCE_VERSION}"
|
||||
echo " PKG_SOURCE = ${PKG_SOURCE}"
|
||||
echo " PKG_SOURCE_VERSION_FILE=${PKG_SOURCE_VERSION_FILE}"
|
||||
}
|
||||
|
||||
is_git_same()
|
||||
{
|
||||
git_last=$(cd ${PKG_BUILD_DIR}; git rev-parse HEAD)
|
||||
#echo "$PKG_NAME $git_last = ${PKG_SOURCE_VERSION}"
|
||||
if [ "$git_last" == "${PKG_SOURCE_VERSION}" ]
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
update_this_pkg()
|
||||
{
|
||||
mk_hash=$(get_makefile_hash)
|
||||
|
||||
if [ "$mk_hash" != "${PKG_SOURCE_VERSION}" ]
|
||||
then
|
||||
echo "${PKG_NAME}:"
|
||||
echo " build dir = ${PKG_BUILD_DIR}"
|
||||
echo " feed makefile = ${mk_hash}"
|
||||
echo " stale hash = ${PKG_SOURCE_VERSION}"
|
||||
echo " build git = $(cd ${PKG_BUILD_DIR}; git rev-parse HEAD)"
|
||||
echo " Git hash in package makefile and the git hash recorded from last compile of"
|
||||
echo " package is different. You probably want to recompile the package"
|
||||
echo " to get an up to date version in ${PKG_BUILD_DIR}/.git_update"
|
||||
echo ""
|
||||
|
||||
echo -n " Should we continue with the update anyway? [y/N]:"
|
||||
read answer
|
||||
echo ""
|
||||
|
||||
case $answer in
|
||||
y|Y)
|
||||
;;
|
||||
n|N|*)
|
||||
return 1;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo "${PKG_NAME}:"
|
||||
echo " build dir = ${PKG_BUILD_DIR}"
|
||||
echo " pkg dir = ${PKG_DIR}"
|
||||
echo " feed makefile = ${PKG_SOURCE_VERSION}"
|
||||
echo " build git = $(cd ${PKG_BUILD_DIR}; git rev-parse HEAD)"
|
||||
echo " package is at a different git commit in build compared to feed"
|
||||
echo -n " Should we update the feed and top project to reflect the new version ? [y/N]:"
|
||||
read answer
|
||||
echo ""
|
||||
|
||||
case $answer in
|
||||
y|Y)
|
||||
return 0;;
|
||||
*)
|
||||
echo ""
|
||||
return 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_makefile_hash()
|
||||
{
|
||||
if [ -n "$PKG_SOURCE_VERSION_FILE" ]
|
||||
then
|
||||
name="$PKG_SOURCE_VERSION_FILE"
|
||||
else
|
||||
name=Makefile
|
||||
fi
|
||||
grep "PKG_SOURCE_VERSION:=" ${PKG_DIR}/${name} | sed -e "s/\(^PKG_SOURCE_VERSION:=\)\(.*\)/\2/"
|
||||
}
|
||||
|
||||
insert_hash_in_feed_makefile()
|
||||
{
|
||||
if [ -n "$PKG_SOURCE_VERSION_FILE" ]
|
||||
then
|
||||
name="$PKG_SOURCE_VERSION_FILE"
|
||||
else
|
||||
name=Makefile
|
||||
fi
|
||||
|
||||
git_last=$(cd ${PKG_BUILD_DIR}; git rev-parse HEAD)
|
||||
|
||||
sed -i -e "s/\(^PKG_SOURCE_VERSION:=\).*/\1${git_last}/" ${PKG_DIR}/${name}
|
||||
(cd ${PKG_DIR}; git add ${name})
|
||||
}
|
||||
|
||||
insert_version_in_feed_makefile()
|
||||
{
|
||||
if [ -n "$PKG_SOURCE_VERSION_FILE" ]
|
||||
then
|
||||
name="$PKG_SOURCE_VERSION_FILE"
|
||||
else
|
||||
name=Makefile
|
||||
fi
|
||||
|
||||
last_version=$(awk -F '=' '/PKG_VERSION:=/ {print $2}' ${PKG_DIR}/${name})
|
||||
|
||||
echo -n "please enter version: "
|
||||
read -ei "$last_version" answer
|
||||
|
||||
if [ -z ${answer} ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
sed -i -e "s/\(^PKG_VERSION:=\).*/\1${answer}/" ${PKG_DIR}/${name}
|
||||
(cd ${PKG_DIR}; git add ${name})
|
||||
}
|
||||
|
||||
|
||||
# BUG: fix if only local branche name!
|
||||
branch_uptodate()
|
||||
{
|
||||
# $1 git repo
|
||||
# $2 if it exist dont abort do the pull
|
||||
(cd $1
|
||||
git remote update 2>&1 >/dev/null
|
||||
|
||||
LOCAL=$(git rev-parse @)
|
||||
REMOTE=$(git rev-parse @{u})
|
||||
BASE=$(git merge-base @ @{u})
|
||||
|
||||
if [ -z "$REMOTE" ]; then
|
||||
BRANCH=$(basename $(git symbolic-ref -q HEAD))
|
||||
echo "You need to setup a tracking branch for $BRANCH"
|
||||
exit 99
|
||||
fi
|
||||
|
||||
if [ $LOCAL = $REMOTE ]; then
|
||||
return
|
||||
elif [ $LOCAL = $BASE ]; then
|
||||
if [ -n "$2" ]
|
||||
then
|
||||
echo "Doing automatic pull on [ $1 ]"
|
||||
if git pull
|
||||
then
|
||||
return
|
||||
else
|
||||
echo "Something wrong with pull. aborting, repo at"
|
||||
echo " [ $1 ]"
|
||||
exit 99
|
||||
fi
|
||||
else
|
||||
echo "Local repo behind remote:"
|
||||
echo "do git pull at repo"
|
||||
echo " [ $1 ]"
|
||||
exit 99
|
||||
fi
|
||||
elif [ $REMOTE = $BASE ]; then
|
||||
echo "Local repo ahead of remote. A push is needed"
|
||||
echo "Repo is at: $1"
|
||||
echo ""
|
||||
echo -n "Should we try a push ? [Y/n]:"
|
||||
read answer
|
||||
echo ""
|
||||
|
||||
case $answer in
|
||||
n|N|q|Q)
|
||||
exit 99;;
|
||||
*)
|
||||
echo -e "${Yellow}"
|
||||
if ! git push origin HEAD
|
||||
then
|
||||
echo -e "${Color_Off}"
|
||||
exit 99
|
||||
fi
|
||||
echo -e "${Color_Off}Push done."
|
||||
;;
|
||||
esac
|
||||
|
||||
else
|
||||
echo "Diverged. not sure what you did but there is no tracking branch. "
|
||||
echo "repo at [ $1 ]. fix it so that there is a tracking branch remote."
|
||||
echo "Often this is related to somebody having commited to the same branch"
|
||||
echo "on the server so a simple push wont work, try a 'git rebase'."
|
||||
exit 99
|
||||
fi
|
||||
)
|
||||
}
|
||||
|
||||
on_a_branch()
|
||||
{
|
||||
local repo=$1
|
||||
local type=$2
|
||||
(
|
||||
cd $repo
|
||||
name=$(git symbolic-ref -q HEAD)
|
||||
if [ -z "$name" ]
|
||||
then
|
||||
echo "git $type repo [ $repo ] is detached."
|
||||
|
||||
branches=($(git branch -r --contains $(git rev-parse HEAD)))
|
||||
if [ 0 == ${#branches[@]} ]
|
||||
then
|
||||
echo "It needs to be on a branch but git could not find any associated branch"
|
||||
echo ""
|
||||
echo "you need to make sure that the commit is not on a detached branch"
|
||||
echo "and that the branch exist in the remote repo also. it can not be a local name"
|
||||
echo "as it is about to get pushed so it can be part of system release"
|
||||
exit 99
|
||||
fi
|
||||
|
||||
echo "It needs to be on a branch. Please select one or quit if it is not in list."
|
||||
echo ""
|
||||
|
||||
i=0
|
||||
for branch in ${branches[*]}
|
||||
do
|
||||
echo "$i: $branch"
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo -n "Select what branch to checkout. Q/q or N/n to quit? "
|
||||
read answer
|
||||
|
||||
case $answer in
|
||||
q|Q|n|N)
|
||||
echo "Aborting!"
|
||||
exit 99;;
|
||||
esac
|
||||
|
||||
echo -e "${Yellow}"
|
||||
pwd
|
||||
echo "git checkout ${branches[$answer]}"
|
||||
if ! git checkout -t ${branches[$answer]}
|
||||
then
|
||||
local_branch=$(basename ${branches[$answer]})
|
||||
if ! git checkout ${local_branch}
|
||||
then
|
||||
echo -e "${Color_Off}"
|
||||
echo "update_git aborting! something was wrong changing to branch ${branches[$answer]}"
|
||||
echo "go to [ $repo ] and fix it."
|
||||
exit 99
|
||||
fi
|
||||
fi
|
||||
echo -e "${Color_Off}"
|
||||
fi
|
||||
)
|
||||
}
|
||||
|
||||
git_repos_uptodate()
|
||||
{
|
||||
on_a_branch ${PKG_BUILD_DIR} package
|
||||
on_a_branch ${PKG_DIR} feed
|
||||
on_a_branch ${PWD} top
|
||||
branch_uptodate ${PKG_BUILD_DIR}
|
||||
branch_uptodate ${PKG_DIR} do_pull
|
||||
branch_uptodate ${PWD} do_pull
|
||||
}
|
||||
|
||||
get_feed_name()
|
||||
{
|
||||
|
||||
echo $1 |sed -e "s|.*feeds/\([^/]*\).*|\1|"
|
||||
|
||||
# rest=$(dirname $1)
|
||||
# base=$(basename $1)
|
||||
# prev=$base
|
||||
|
||||
# while [ -n "$rest" ]
|
||||
# do
|
||||
# if [ "$base" == "feeds" ]
|
||||
# then
|
||||
# echo "$prev"
|
||||
# fi
|
||||
# done
|
||||
}
|
||||
|
||||
create_message()
|
||||
{
|
||||
FORMAT="commit %H%n\
|
||||
Author: %aN <%aE>%n\
|
||||
Date: %ai%n\
|
||||
%n\
|
||||
%w(80,4,4)%s%n
|
||||
%b%n\
|
||||
%w()Base directory -> ${repo_PATH}/"
|
||||
local FROM=${PKG_SOURCE_VERSION}
|
||||
local TO=$(cd ${PKG_BUILD_DIR}; git rev-parse HEAD)
|
||||
|
||||
local commits=$(cd ${PKG_BUILD_DIR};git rev-list ${FROM}..${TO})
|
||||
|
||||
local feed=$(get_feed_name ${PKG_DIR})
|
||||
|
||||
echo "Update feed [ $feed ] package [ $PKG_NAME ]"
|
||||
echo ""
|
||||
echo "-------------------------------------------------------------------------------"
|
||||
(cd ${PKG_BUILD_DIR}; git log --graph --oneline ${FROM}..${TO})
|
||||
echo "-------------------------------------------------------------------------------"
|
||||
|
||||
for commit in $commits
|
||||
do
|
||||
(cd ${PKG_BUILD_DIR}; git show --stat --pretty=format:"$FORMAT" $commit)
|
||||
echo "-------------------------------------------------------------------------------"
|
||||
done
|
||||
}
|
||||
|
||||
edit_file()
|
||||
{
|
||||
echo -en "${Red}"
|
||||
echo "Here is the commit message we are going to use!"
|
||||
echo "-------------------------------------------------------------------------------"
|
||||
echo -en "${Color_Off}"
|
||||
cat $1
|
||||
echo -en "${Red}"
|
||||
echo "-------------------------------------------------------------------------------"
|
||||
echo -en "${Color_Off}"
|
||||
|
||||
echo -n "Do you want to edit the message [y/N]? "
|
||||
read answer
|
||||
|
||||
case $answer in
|
||||
y|Y)
|
||||
$EDITOR $1;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
commit_feed()
|
||||
{
|
||||
template=$(readlink -f $1)
|
||||
edit_file $template
|
||||
|
||||
echo -e "${Yellow}"
|
||||
(
|
||||
cd ${PKG_DIR}
|
||||
if git commit -F $template
|
||||
then
|
||||
if git push origin HEAD
|
||||
then
|
||||
echo -e "${Color_Off} Feed Updated!"
|
||||
return
|
||||
else
|
||||
echo -e "${Color_Off}"
|
||||
echo "something wrong push feed git ${PKG_DIR}"
|
||||
exit 99
|
||||
fi
|
||||
else
|
||||
echo -e "${Color_Off}"
|
||||
echo "something wrong committing to feed git ${PKG_DIR}"
|
||||
exit 99
|
||||
fi
|
||||
)
|
||||
}
|
||||
|
||||
commit_feeds_config()
|
||||
{
|
||||
template=$(readlink -f $1)
|
||||
edit_file $template
|
||||
|
||||
echo -e "${Yellow}"
|
||||
if git commit -F $template
|
||||
then
|
||||
if git push origin HEAD
|
||||
then
|
||||
echo -e "${Color_Off}Feeds.conf updated!"
|
||||
return
|
||||
else
|
||||
echo -e "${Color_Off}"
|
||||
echo "something wrong push change to feeds.conf"
|
||||
echo "try \"git remote update ; git stash ;git rebase; git push;git stash pop\""
|
||||
exit 99
|
||||
fi
|
||||
else
|
||||
echo -e "${Color_Off}"
|
||||
echo "something wrong committing to feed git"
|
||||
exit 99
|
||||
fi
|
||||
}
|
||||
|
||||
insert_hash_in_feeds_config()
|
||||
{
|
||||
local feed=$(get_feed_name ${PKG_DIR})
|
||||
local TO=$(cd ${PKG_DIR}; git rev-parse HEAD)
|
||||
|
||||
sed -i feeds.conf -e "/ ${feed} / s/\(.*\)[;^].*/\1^${TO}/"
|
||||
git add feeds.conf
|
||||
}
|
||||
|
||||
check_packages()
|
||||
{
|
||||
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
|
||||
echo "Now checking if any changes have been done to the packages."
|
||||
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
|
||||
|
||||
# only scan in the build directory that is currently in use.
|
||||
CPU=$(grep "CONFIG_CPU_TYPE=" .config| cut -f2 -d\")
|
||||
LIBC=$(grep "CONFIG_LIBC=" .config| cut -f2 -d\")
|
||||
|
||||
# First scan all files in build dir for packages that have .git directories.
|
||||
all_pkgs=$(find build_dir/*${CPU}*${LIBC}* -name ".git")
|
||||
|
||||
for pkg in `echo "$all_pkgs"`
|
||||
do
|
||||
pkg=$(dirname $pkg)
|
||||
|
||||
# check if the git in build is at same commit id as the feed makefile points out
|
||||
if [ -e ${pkg}/.git_update ]
|
||||
then
|
||||
source ${pkg}/.git_update
|
||||
fi
|
||||
|
||||
# print_git_update
|
||||
|
||||
if [ -n "${PKG_NAME}" ]
|
||||
then
|
||||
if ! is_git_same
|
||||
then
|
||||
if update_this_pkg
|
||||
then
|
||||
# print_git_update
|
||||
git_repos_uptodate
|
||||
insert_hash_in_feed_makefile
|
||||
[ ${UPDATE} -eq 1 ] && insert_version_in_feed_makefile
|
||||
create_message >tmp/msg
|
||||
commit_feed tmp/msg
|
||||
insert_hash_in_feeds_config
|
||||
commit_feeds_config tmp/msg
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# now handle the target git. we have only one
|
||||
|
||||
|
||||
feeds_hash()
|
||||
{
|
||||
grep -v "^#" feeds.conf | grep " $1 " | grep "\^" | sed -e "s/.*[;^]\(.*\)/\1/"
|
||||
}
|
||||
|
||||
insert_feed_hash_in_feeds_config()
|
||||
{
|
||||
local feed=$1
|
||||
local TO=$(cd feeds/${feed}; git rev-parse HEAD)
|
||||
|
||||
sed -i feeds.conf -e "/ ${feed}/ s/\(.*\)[;^].*/\1^${TO}/"
|
||||
git add feeds.conf
|
||||
}
|
||||
|
||||
create_feed_message()
|
||||
{
|
||||
local feed=$1
|
||||
local FROM=$2
|
||||
local TO=$3
|
||||
|
||||
local FORMAT="commit %H%n\
|
||||
Author: %aN <%aE>%n\
|
||||
Date: %ai%n\
|
||||
%n\
|
||||
%w(80,4,4)%s%n
|
||||
%b%n\
|
||||
%w()Base directory -> feeds/$feed/"
|
||||
|
||||
|
||||
local commits=$(cd feeds/$feed;git rev-list ${FROM}..${TO})
|
||||
|
||||
echo "Update feed [ $feed ]"
|
||||
echo ""
|
||||
echo "-------------------------------------------------------------------------------"
|
||||
(cd feeds/$feed; git log --graph --oneline ${FROM}..${TO})
|
||||
echo "-------------------------------------------------------------------------------"
|
||||
|
||||
for commit in $commits
|
||||
do
|
||||
(cd feeds/$feed; git show --stat --pretty=format:"$FORMAT" $commit)
|
||||
echo "-------------------------------------------------------------------------------"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
check_feeds()
|
||||
{
|
||||
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
|
||||
echo "Now checking if any changes have been done to the feeds."
|
||||
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
|
||||
|
||||
feeds=$(grep -v "^#" feeds.conf| awk '{print $2}')
|
||||
for feed in `echo $feeds`
|
||||
do
|
||||
feed_hash=$(feeds_hash $feed)
|
||||
[ -n "$feed_hash" ] || continue
|
||||
if [ -d feeds/$feed ]; then
|
||||
in_git=$(cd feeds/$feed; git rev-parse HEAD)
|
||||
|
||||
if [ "$feed_hash" != "$in_git" ]
|
||||
then
|
||||
|
||||
name=$(cd feeds/$feed;git symbolic-ref -q HEAD)
|
||||
if [ -z "$name" ]
|
||||
then
|
||||
echo "Feed feeds/${feed} is at a git commit which is different from feeds.conf"
|
||||
#echo "git id from feeds.conf [$feed_hash] git id from feeds/${feed} [$in_git]"
|
||||
on_a_branch feeds/${feed} feed
|
||||
|
||||
#redo the test here and see if the feeds.conf and git is still different.
|
||||
in_git=$(cd feeds/$feed; git rev-parse HEAD)
|
||||
if [ "$feed_hash" = "$in_git" ]
|
||||
then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
LOCAL=$(cd feeds/$feed;git rev-parse @)
|
||||
REMOTE=$(cd feeds/$feed;git rev-parse @{u})
|
||||
BASE=$(cd feeds/$feed;git merge-base @ @{u})
|
||||
|
||||
# if we are behind the remote automatically do a pull
|
||||
if [ $LOCAL = $BASE ]; then
|
||||
(cd feeds/$feed ; git pull 1>/dev/null)
|
||||
|
||||
#redo the test here and see if the feeds.conf and git is still different.
|
||||
in_git=$(cd feeds/$feed; git rev-parse HEAD)
|
||||
if [ "$feed_hash" = "$in_git" ]
|
||||
then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Feed feeds/${feed} is at different commit than what is in feeds.conf"
|
||||
#echo "git id from feeds.conf [$feed_hash] git id from feeds/${feed} [$in_git]"
|
||||
echo -n "Should we update feeds.conf to reflect the new version ? [y/N]:"
|
||||
read answer
|
||||
|
||||
case $answer in
|
||||
n|N|'')
|
||||
continue;;
|
||||
esac
|
||||
branch_uptodate feeds/${feed}
|
||||
create_feed_message ${feed} $feed_hash $in_git >tmp/msg
|
||||
insert_feed_hash_in_feeds_config ${feed}
|
||||
commit_feeds_config tmp/msg
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
feeds_at_top()
|
||||
{
|
||||
git remote update 2>/dev/null 1>/dev/null
|
||||
LOCAL=$(git rev-parse @)
|
||||
REMOTE=$(git rev-parse @{u})
|
||||
|
||||
if [ $LOCAL = $REMOTE ]
|
||||
then
|
||||
return
|
||||
fi
|
||||
|
||||
local_name=$(git rev-parse --abbrev-ref @ )
|
||||
remote_name=$(git rev-parse --abbrev-ref @{u} )
|
||||
|
||||
echo "Top repo local branch \"$local_name\" is not at same point as remote \"$remote_name\""
|
||||
echo "This update script will update the feeds.conf file and for that to work it needs to"
|
||||
echo "be up to date with the remote."
|
||||
echo ""
|
||||
echo "please run:"
|
||||
echo " git pull"
|
||||
echo " ./iop feeds_update"
|
||||
echo ""
|
||||
echo "do not forget the bootstrap. but do not run make it can delete your package in build"
|
||||
exit 0
|
||||
}
|
||||
|
||||
usage(){
|
||||
echo -e "$0 [flags]"
|
||||
echo -e "flags:"
|
||||
echo -e " -v\tVerbose mode"
|
||||
echo -e " -h\tShow this help"
|
||||
echo -e " -u\tUpdate package version\n"
|
||||
}
|
||||
|
||||
# Exported interface
|
||||
function update_package {
|
||||
|
||||
UPDATE=0
|
||||
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# Regular Colors
|
||||
Black='\033[0;30m' # Black
|
||||
Red='\033[0;31m' # Red
|
||||
Green='\033[0;32m' # Green
|
||||
Yellow='\033[0;33m' # Yellow
|
||||
Blue='\033[0;34m' # Blue
|
||||
Purple='\033[0;35m' # Purple
|
||||
Cyan='\033[0;36m' # Cyan
|
||||
White='\033[0;37m' # White
|
||||
|
||||
while getopts "v:hu" opt; do
|
||||
case $opt in
|
||||
v)
|
||||
verbose=$OPTARG
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
u)
|
||||
UPDATE=1
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$EDITOR" ]
|
||||
then
|
||||
if [ -f /usr/bin/vi ]; then
|
||||
EDITOR=vi
|
||||
else
|
||||
echo "env variable EDITOR needs to be set"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# allow subshells to abort the whole program by exiting with "exit 99"
|
||||
set -E
|
||||
trap '[ "$?" -ne 99 ] || exit 99' ERR
|
||||
|
||||
feeds_at_top
|
||||
check_packages
|
||||
check_feeds
|
||||
}
|
||||
|
||||
register_command "update_package" "Publish changes to packages and feeds"
|
||||
@@ -1,58 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2019 iopsys
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=iopupgrade
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=01f2afd6c831d6f9eb2940c7e7af16f7e4d439c2
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/iopupgrade
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
# support parallel build
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
#re create configure scripts if not present.
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
|
||||
# this way we don't need to pick out the resulting files from the build dir.
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/iopupgrade
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Iopsys system upgrade utility
|
||||
URL:=
|
||||
# DEPENDS:=
|
||||
endef
|
||||
|
||||
define Package/iopupgrade/description
|
||||
Application handling peripheral
|
||||
endef
|
||||
|
||||
define Package/iopupgrade/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/etc/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/iopupgrade $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,iopupgrade))
|
||||
|
||||
@@ -1,278 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
###############################################################################
|
||||
# Global variables. can be used directly in any function called.
|
||||
cur_vol="" # num,[0/1] Number used for ubifs root filesystem volume name.
|
||||
# eg: rootfs_0 or rootfs_1, currently used
|
||||
upd_vol="" # num,[0/1] Number used for ubifs root filesystem volume name.
|
||||
# eg: rootfs_0 or rootfs_1, the one we want to update
|
||||
cmdline="" # command line settings.
|
||||
cmdline_match="" # Headers to match to the image
|
||||
|
||||
###############################################################################
|
||||
# file local variables. should not be used in imported functions. Can be used
|
||||
# by functions declared in this script
|
||||
chroot_cmdline="" # command line for the iop_chroot command.
|
||||
board="" # string, Board name that is going to be matched
|
||||
# against header of firmware image
|
||||
upd_ubi_id="" # num, UBI volume number for the volume name
|
||||
# "rootfs_$upd_vol", use to know what volume to run
|
||||
# ubiupdatevol on.
|
||||
run_cleanup=0 # if set the cleanup should be run otherwise we skip it.
|
||||
run_mount_cleanup=0 # set if we should run umount in cleanup
|
||||
upd_kernel=0 # set to 1 if system has the kernel in own mtd partition
|
||||
log_stdout=1 # set to 0 to prevent the log to also print to stdout
|
||||
upd_noreboot=0 # set to 1 if we should not reboot after programming
|
||||
upd_forceimage=0 # set this to force upgrade even if image is for wrong board.
|
||||
upd_forceboot=0 # set this to force upgrade of boot loader
|
||||
###############################################################################
|
||||
# import external functions
|
||||
source /lib/upgrade/iopsys.sh
|
||||
[ -f /lib/upgrade/iopupgrade ] && source /lib/upgrade/iopupgrade
|
||||
|
||||
# only call function if it exists
|
||||
function_call() {
|
||||
if type "$1" 2>/dev/null >/dev/null
|
||||
then
|
||||
$1 $@
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Cleanup and error handling functions.
|
||||
function log {
|
||||
TIME=$(date)
|
||||
[ $log_stdout -eq 1 ] && echo "$@"
|
||||
echo "[$TIME] $@" >>/tmp/upd_log
|
||||
}
|
||||
|
||||
# we need to handle ctrl-c, segmentation fault, sigpipe and other abnormal
|
||||
# terminations. no printing to stdout/stderr allowed in this function or
|
||||
# anyhting it calls as stdout/stderr might no longer exist
|
||||
function finish {
|
||||
|
||||
if [ "$run_cleanup" == "1" ]
|
||||
then
|
||||
|
||||
function_call upd_cleanup
|
||||
log ""
|
||||
fi
|
||||
|
||||
if [ "$run_mount_cleanup" == "1" ]
|
||||
then
|
||||
log "Cleaning up after mount"
|
||||
umount_newroot
|
||||
fi
|
||||
# always kill the timeout process, will leave the sleep but that is harmless
|
||||
# as long as the kill will nerver be run.
|
||||
kill $TIMEOUT_PID 2>/dev/null
|
||||
|
||||
lock -u /tmp/iopu.lock
|
||||
}
|
||||
|
||||
function sig_pipe {
|
||||
log_stdout=0 # stdin,stdout,stderr do not exist anymore
|
||||
log "Got sigpipe. Turning of log printing to stdout"
|
||||
}
|
||||
|
||||
# if a timout happens terminate
|
||||
function timeout {
|
||||
finish
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Not much that can be done if the mount fails but to try again.
|
||||
# if after 10 seconds there still is errors abort program.
|
||||
# UBIFS has some wierd time intervall after ubiupdatevol where
|
||||
# a mount of the newly written data results in a busy error.
|
||||
function mount_retry {
|
||||
local tries=0
|
||||
|
||||
while [ $tries -lt 10 ]
|
||||
do
|
||||
if mount $@ 2>/dev/null
|
||||
then
|
||||
return
|
||||
fi
|
||||
tries=$((tries + 1))
|
||||
sleep 1
|
||||
done
|
||||
|
||||
log "mount failed for command [mount $@] so upgrade failed."
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
function mount_newroot {
|
||||
run_mount_cleanup=1
|
||||
mkdir -p /tmp/newroot
|
||||
mkdir -p /tmp/newroot_overlay
|
||||
|
||||
mount_retry -t ubifs ubi0:rootfs_$upd_vol /tmp/newroot
|
||||
|
||||
mount_retry -o noatime,lowerdir=/tmp/newroot,upperdir=/tmp/newroot/overlay,workdir=/tmp/newroot/lib/overlay.tmp -t overlay "overlayfs:/tmp/newroot/overlay" /tmp/newroot_overlay
|
||||
mount_retry --bind /tmp/newroot/ /tmp/newroot_overlay/rom
|
||||
|
||||
mount_retry --bind /dev /tmp/newroot_overlay/dev
|
||||
mount_retry --bind /proc /tmp/newroot_overlay/proc
|
||||
mount_retry --bind /sys /tmp/newroot_overlay/sys
|
||||
mount_retry -t tmpfs -o noatime,mode=0755 root /tmp/newroot_overlay/tmp
|
||||
|
||||
mkdir -p /tmp/newroot_overlay/tmp/oldroot
|
||||
mount_retry --bind / /tmp/newroot_overlay/tmp/oldroot
|
||||
mount_retry --bind /tmp /tmp/newroot_overlay/tmp/oldroot/tmp
|
||||
}
|
||||
|
||||
function umount_newroot {
|
||||
umount /tmp/newroot_overlay/tmp/oldroot/tmp
|
||||
umount /tmp/newroot_overlay/tmp/oldroot
|
||||
umount /tmp/newroot_overlay/tmp
|
||||
umount /tmp/newroot_overlay/sys
|
||||
umount /tmp/newroot_overlay/proc
|
||||
umount /tmp/newroot_overlay/dev
|
||||
umount /tmp/newroot_overlay/rom
|
||||
umount /tmp/newroot_overlay
|
||||
umount /tmp/newroot
|
||||
run_mount_cleanup=0
|
||||
}
|
||||
|
||||
function usage {
|
||||
echo "usage: $0 iopu [opts] "
|
||||
echo ""
|
||||
echo "opts:"
|
||||
echo ""
|
||||
echo " -n Do not do the final reboot of the target board"
|
||||
echo " -c Keep configuration"
|
||||
echo " -x Force install even if firmware is not for this board"
|
||||
echo " -b Force install of bootloader regardless of version installed"
|
||||
echo " -r Jump into chroot env of other system"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
||||
# just one instance
|
||||
# this check has to be done before we install handler to avoid removing the
|
||||
# lock even if it was not available.
|
||||
if ! lock -n /tmp/iopu.lock
|
||||
then
|
||||
echo "Another instance of iopu already running"
|
||||
echo "If you are sure this is wrong remove file /tmp/iopu.lock"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
trap finish EXIT
|
||||
trap timeout SIGALRM
|
||||
trap sig_pipe SIGPIPE
|
||||
|
||||
while getopts "nrxbh" opt; do
|
||||
case $opt in
|
||||
n)
|
||||
upd_noreboot=1
|
||||
;;
|
||||
x)
|
||||
upd_forceimage=1
|
||||
;;
|
||||
b)
|
||||
upd_forceboot=1
|
||||
;;
|
||||
r)
|
||||
upd_vol=$(get_flashbank_next)
|
||||
mount_newroot
|
||||
(ENV=/sbin/iopu_chroot_env chroot /tmp/newroot_overlay /bin/sh)
|
||||
echo ""
|
||||
umount_newroot
|
||||
exit 0
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# put a timeout on this if it takes longer than 120 seconds we should abort
|
||||
# and clean up
|
||||
(
|
||||
sleep 120 # if 2 minutes pass
|
||||
kill -ALRM $$ 2>/dev/null # send it a SIGALRM signal
|
||||
)&
|
||||
TIMEOUT_PID=$!
|
||||
|
||||
log "Firmware upgrade started"
|
||||
|
||||
# Should board name be checked
|
||||
if [ $upd_forceimage -eq 0 ]
|
||||
then
|
||||
board=$(db get hw.board.iopVerBoard)
|
||||
cmdline_match="board=$board"
|
||||
fi
|
||||
|
||||
# find out what rootfs volume is active.
|
||||
cur_vol=$(get_flashbank_current)
|
||||
upd_vol=$(get_flashbank_next)
|
||||
|
||||
# convert volume name "rootfs_$upd_vol" into ubifs volume id
|
||||
upd_ubi_id=$(ubinfo -d 0 -N rootfs_$upd_vol | awk "/Volume ID:/ {print \$3}")
|
||||
log "installing Root Fileystem into UBI volume rootfs_$upd_vol"
|
||||
|
||||
# prepare to match dsl.
|
||||
function_call upd_conf_dsl
|
||||
|
||||
# prepare to update CFE if it exists
|
||||
function_call upd_conf_cfe
|
||||
|
||||
# prepare to update kernel if it is stored in MTD/JFFS2
|
||||
function_call upd_conf_kernel
|
||||
|
||||
log "now starting writing data to flash with [ iopupgrade $cmdline -M "$cmdline_match" -u ubi0_$upd_ubi_id ]"
|
||||
run_cleanup=1 # When we start to actually write data there might be some
|
||||
# things that need cleanup if we get an error/crash
|
||||
iopupgrade $cmdline -M "$cmdline_match" -u ubi0_$upd_ubi_id
|
||||
|
||||
# in case of any error we abort
|
||||
if [ $? -ne 0 ]; then
|
||||
log "iopupgrade program Failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Firmware programmed to flash."
|
||||
|
||||
|
||||
log "Transfering configuration to new system."
|
||||
|
||||
# Force upgrade of boot loader
|
||||
[ $upd_forceboot -eq 1 ] && chroot_cmdline="$chroot_cmdline -b"
|
||||
|
||||
mount_newroot
|
||||
chroot /tmp/newroot_overlay /sbin/iopu_chroot $chroot_cmdline
|
||||
umount_newroot
|
||||
|
||||
log "Update fully installed."
|
||||
run_cleanup=0
|
||||
|
||||
# Now make sure that we actually boot the new system on the next reboot
|
||||
upd_finnish
|
||||
|
||||
# spawn the reboot to a subshell to allow the main program to quit before reset
|
||||
# to avoid any hanged network connection like ssh
|
||||
if [ $upd_noreboot -eq 0 ]
|
||||
then
|
||||
(
|
||||
log_stdout=0 # stdin,stdout,stderr do not exist anymore, we are in a
|
||||
# subshell and then the trap is no longer working.
|
||||
sleep 1
|
||||
log "Rebooting NOW!!!"
|
||||
log ""
|
||||
reboot
|
||||
)&
|
||||
log "Reboot initiated"
|
||||
else
|
||||
log "Skipping reboot"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This program is intended to be run in a chroot environment where the old system
|
||||
# is mounted in /tmp/oldroot
|
||||
#
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Global variables. can be used directly in any function called.
|
||||
|
||||
|
||||
###############################################################################
|
||||
# file local variables. should not be used in imported functions. Can be used
|
||||
# by functions declared in this script
|
||||
upd_forceboot=0
|
||||
log_stdout=1 # set to 0 to prevent the log to also print to stdout
|
||||
|
||||
###############################################################################
|
||||
# import external functions
|
||||
|
||||
source /lib/upgrade/iopsys.sh
|
||||
[ -f /lib/upgrade/iopupgrade ] && source /lib/upgrade/iopupgrade
|
||||
|
||||
|
||||
# only call function if it exists
|
||||
function_call() {
|
||||
if type "$1" 2>/dev/null >/dev/null
|
||||
then
|
||||
$1 $@
|
||||
fi
|
||||
}
|
||||
# Cleanup and error handling functions.
|
||||
function log {
|
||||
TIME=$(date)
|
||||
[ $log_stdout -eq 1 ] && echo "$@"
|
||||
echo "[$TIME] $@" >>/root/upd_log
|
||||
}
|
||||
|
||||
|
||||
while getopts "hb" opt; do
|
||||
case $opt in
|
||||
h)
|
||||
upd_usage
|
||||
exit 1
|
||||
;;
|
||||
b)
|
||||
upd_forceboot=1
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# copy old install log over
|
||||
cp /tmp/oldroot/tmp/upd_log /root/upd_log
|
||||
|
||||
# Upgrade boot loader if needed.
|
||||
function_call upd_program_boot
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
# this is run when "iopr -r" is executed.
|
||||
# intended to just show what environment is actually started.
|
||||
|
||||
cat /etc/banner
|
||||
|
||||
echo "/tmp/oldroot:"
|
||||
echo " Contains the running root filesystem. It is live so files are in use"
|
||||
echo " Anything copying/reading files from there needs to make sure it is done safely."
|
||||
echo ""
|
||||
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
Red='\033[0;31m' # Red
|
||||
|
||||
PS1="${Red}chroot_new${Color_Off}:\w\#"
|
||||
export PS1
|
||||
export Red
|
||||
export Color_Off
|
||||
@@ -17,11 +17,11 @@ define Package/iup
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=iup client
|
||||
DEPENDS:=+libuci +uci +busybox
|
||||
DEPENDS:=+libuci +uci +busybox
|
||||
endef
|
||||
|
||||
define Package/iup/description
|
||||
This package contains Inteno's IUP Client
|
||||
This package contains Intenos IUP Client
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# iup at boot
|
||||
# Copyright (C) 2007 OpenWrt.org
|
||||
|
||||
START=98
|
||||
STOP=15
|
||||
USE_PROCD=1
|
||||
@@ -13,84 +12,24 @@ include /lib/network
|
||||
CRONPATH="/etc/crontabs/root"
|
||||
RANGE=60
|
||||
|
||||
management_interfaces() {
|
||||
local DHCP_IFACES=""
|
||||
|
||||
is_notbridged_dhcp() {
|
||||
local config="$1"
|
||||
local proto="$(uci -q get network.$config.proto)"
|
||||
local typ="$(uci -q get network.$config.type)"
|
||||
if [ "$proto" == "dhcp" -a "$typ" != "bridge" ]; then
|
||||
DHCP_IFACES="$DHCP_IFACES $config"
|
||||
fi
|
||||
}
|
||||
|
||||
config_load network
|
||||
config_foreach is_notbridged_dhcp interface
|
||||
echo $DHCP_IFACES
|
||||
}
|
||||
|
||||
init_iup() {
|
||||
local polling_enabled
|
||||
local interval
|
||||
local starttime
|
||||
local nummber
|
||||
number=$RANDOM
|
||||
|
||||
[ -f $CRONPATH ] || touch $CRONPATH
|
||||
|
||||
config_load provisioning
|
||||
config_get polling_enabled polling enabled on
|
||||
config_get interval polling interval
|
||||
config_get starttime polling starttime
|
||||
|
||||
### Ask for IUP related DHCP options only if IUP is enabled ###
|
||||
new_reqopts() {
|
||||
local net=$1
|
||||
local enabled
|
||||
local newreqopts=
|
||||
local baseopts=
|
||||
local reqopts="$(uci -q get network.$net.reqopts)"
|
||||
local iupopts="66 67 128 224 225 226"
|
||||
local ropt iopt
|
||||
config_get enabled iup enabled "on"
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
66|67|128|224|225|226) ;;
|
||||
*) baseopts="$baseopts $ropt" ;;
|
||||
esac
|
||||
done
|
||||
ropt=""
|
||||
reqopts="$baseopts $iupopts"
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
66|67|128|224|225|226) [ $enabled == "on" ] && newreqopts="$newreqopts $ropt" ;;
|
||||
*) newreqopts="$newreqopts $ropt" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
newreqopts="$(echo $newreqopts | tr ' ' '\n' | sort -n | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//')"
|
||||
echo "$newreqopts"
|
||||
}
|
||||
for net in $(management_interfaces); do
|
||||
uci -q set network.$net.reqopts="$(new_reqopts $net)"
|
||||
done
|
||||
uci commit network
|
||||
ubus call network reload
|
||||
#################################################################
|
||||
|
||||
if [ $polling_enabled == "off" ]; then
|
||||
sed -i "/\/sbin\/iup/d" $CRONPATH
|
||||
logger -s -t /etc/init.d/iup[$$] "Provisioning polling unscheduled" 2>/dev/console
|
||||
return
|
||||
if [ -f $CRONPATH ]; then
|
||||
echo "File $CRONPATH exists"
|
||||
else
|
||||
echo "File $CRONPATH did not exists"
|
||||
touch $CRONPATH
|
||||
fi
|
||||
|
||||
local log_hour=$starttime
|
||||
local log_minute
|
||||
local log_interval=$interval
|
||||
config_load provisioning
|
||||
config_get interval polling interval
|
||||
config_get starttime polling starttime
|
||||
if [ $interval == "weekly" ]; then
|
||||
interval="0"
|
||||
log_interval="$log_interval/sunday"
|
||||
elif [ $interval == "hourly" ]; then
|
||||
interval='*'
|
||||
starttime='*'
|
||||
@@ -98,34 +37,27 @@ init_iup() {
|
||||
interval='*'
|
||||
fi
|
||||
let "number %= $RANGE"
|
||||
if ! grep -q "$starttime \* \* \\$interval /sbin/iup" "$CRONPATH" ; then
|
||||
if grep -q "$starttime \* \* \\$interval /sbin/iup" "$CRONPATH" ; then
|
||||
echo "IUP is scheduled $starttime \* \* \\$interval "
|
||||
else
|
||||
if grep -q "iup" "$CRONPATH" ; then
|
||||
sed -i "/iup/d" $CRONPATH
|
||||
fi
|
||||
echo "$number $starttime * * $interval /sbin/iup -v > /dev/null 2>&1" >> $CRONPATH
|
||||
fsync $CRONPATH
|
||||
echo "$number $starttime * * $interval /sbin/iup > /dev/null 2>&1" >> $CRONPATH
|
||||
/etc/init.d/cron restart
|
||||
fi
|
||||
log_minute=$(awk '/\/sbin\/iup/ {print $1}' /etc/crontabs/root)
|
||||
logger -s -t /etc/init.d/iup[$$] "Provisioning is scheduled at $log_hour:$log_minute $log_interval" 2>/dev/console
|
||||
}
|
||||
|
||||
}
|
||||
start_service() {
|
||||
init_iup
|
||||
|
||||
/sbin/iup -v &
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
if [ -f "/tmp/run/iup.pid" ]; then
|
||||
kill -9 $(cat /tmp/run/iup.pid)
|
||||
rm -rf /tmp/run/iup.pid
|
||||
test_default_route
|
||||
if [ "$?" -eq 0 ]; then
|
||||
/sbin/iup &
|
||||
fi
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
stop_service() {
|
||||
killall -9 /sbin/iup
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
management_interfaces() {
|
||||
local DHCP_IFACES=""
|
||||
|
||||
is_notbridged_dhcp() {
|
||||
local config="$1"
|
||||
local proto="$(uci -q get network.$config.proto)"
|
||||
local typ="$(uci -q get network.$config.type)"
|
||||
if [ "$proto" == "dhcp" -a "$typ" != "bridge" ]; then
|
||||
DHCP_IFACES="$DHCP_IFACES $config"
|
||||
fi
|
||||
}
|
||||
|
||||
config_load network
|
||||
config_foreach is_notbridged_dhcp interface
|
||||
echo $DHCP_IFACES
|
||||
}
|
||||
|
||||
set_iup_reqopts() {
|
||||
### Ask for IUP related DHCP options only if IUP is enabled ###
|
||||
new_reqopts() {
|
||||
local net=$1
|
||||
local enabled="$(uci -q get provisioning.iup.enabled)"
|
||||
enabled="${enabled:-on}"
|
||||
local newreqopts=
|
||||
local baseopts=
|
||||
local reqopts="$(uci -q get network.$net.reqopts)"
|
||||
local iupopts="66 67 128 224 225 226"
|
||||
local ropt iopt
|
||||
local net
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
66|67|128|224|225|226) ;;
|
||||
*) baseopts="$baseopts $ropt" ;;
|
||||
esac
|
||||
done
|
||||
ropt=""
|
||||
reqopts="$baseopts $iupopts"
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
66|67|128|224|225|226) [ $enabled == "on" ] && newreqopts="$newreqopts $ropt" ;;
|
||||
*) newreqopts="$newreqopts $ropt" ;;
|
||||
esac
|
||||
done
|
||||
newreqopts="$(echo $newreqopts | tr ' ' '\n' | sort -n | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//')"
|
||||
echo "$newreqopts"
|
||||
}
|
||||
for net in $(management_interfaces); do
|
||||
uci -q set network.$net.reqopts="$(new_reqopts $net)"
|
||||
done
|
||||
uci commit network
|
||||
}
|
||||
|
||||
set_iup_reqopts
|
||||
@@ -1,219 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# functions that take dhcp options received on the wan interface
|
||||
# and relay/repeat them for specific clients
|
||||
|
||||
#config dhcp_option_relay
|
||||
# option enable 1
|
||||
# list dhcp_option 43
|
||||
# list from_interface wan
|
||||
# option vendorclass '*SDX*'
|
||||
|
||||
# where:
|
||||
# dhcp_option_relay is the name of the section parsed by this script
|
||||
# enable/enabled - option, enable the uci section [default on]
|
||||
# dhcp_option/dhcp_options - list of dhcp options (0-255) to be relayed/repeated
|
||||
# overwrite - if same dhcp_option already exists in /etc/config/dhcp, overwrite it with this option [default off]
|
||||
# from_interface - list of interfaces (e.g. wan) to get the dhcp options from
|
||||
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
interface=""
|
||||
opt224=""
|
||||
opt225=""
|
||||
opt226=""
|
||||
opt43=""
|
||||
opt128=""
|
||||
opt66=""
|
||||
opt67=""
|
||||
opt132=""
|
||||
opt133=""
|
||||
newsectionid="0"
|
||||
|
||||
function parse_the_json()
|
||||
{
|
||||
local the_json="$@"
|
||||
|
||||
json_load "$the_json"
|
||||
json_get_var interface interface
|
||||
json_get_var opt224 privopt224
|
||||
json_get_var opt225 privopt225
|
||||
json_get_var opt226 privopt226
|
||||
json_get_var opt43 vendorspecinf # option 43
|
||||
json_get_var opt128 httpurl128
|
||||
json_get_var opt66 tftp # option 66
|
||||
json_get_var opt67 bootfile #option 67
|
||||
json_get_var opt132 vlanid # option 132
|
||||
json_get_var opt133 vlanpriority # option 133
|
||||
}
|
||||
|
||||
function add_section_dhcp_vendorclass()
|
||||
{
|
||||
local dhcp_option=$1
|
||||
local dhcp_option_value=$2
|
||||
local vendorclass=$3
|
||||
local new=
|
||||
newsectionid=$((newsectionid+1))
|
||||
|
||||
#echo "add_section_dchp_vendorclass $dhcp_option ${dhcp_option_value} $vendorclass"
|
||||
new=$(uci add dhcp vendorclass)
|
||||
uci set dhcp.$new.vendorclass="$vendorclass"
|
||||
uci set dhcp.$new.networkid="dhcp_option_relay_$newsectionid"
|
||||
uci add_list dhcp.$new.dhcp_option=$dhcp_option,\"${dhcp_option_value}\"
|
||||
|
||||
uci commit dhcp
|
||||
}
|
||||
|
||||
function dhcp_option_relay()
|
||||
{
|
||||
local section="$1"
|
||||
local enable="" enabled=""
|
||||
local dhcp_option="" dhcp_option_value=""
|
||||
local vendorclass=""
|
||||
#local overwrite=""
|
||||
local from_interface
|
||||
|
||||
#echo "section: $section"
|
||||
|
||||
# parse only enabled sections
|
||||
config_get_bool enabled $section enabled 1
|
||||
config_get_bool enable $section enable 1
|
||||
#echo "enabled: $enabled"
|
||||
#echo "enable : $enable"
|
||||
if [ "$enable" == "0" -o "$enabled" == "0" ] ; then
|
||||
#echo "section $section is not enabled"
|
||||
return
|
||||
fi
|
||||
# todo: for disabled sections: run only the removal of the dhcp options
|
||||
|
||||
# option overwrite 1
|
||||
#config_get_bool overwrite $section overwrite 0
|
||||
config_get vendorclass $section vendorclass
|
||||
if [ ${#vendorclass} -le 1 ]; then
|
||||
#echo "vendorclass must not be empty"
|
||||
return
|
||||
fi
|
||||
|
||||
# list to_interface lan
|
||||
# to_interface - list of interfaces (e.g. lan, guest) to advertise the dhcp options to
|
||||
#foreach_to_interface() {
|
||||
# local to_interface=$1
|
||||
# echo ""
|
||||
# echo " from_interface $from_interface"
|
||||
# echo " dhcp_option $dhcp_option"
|
||||
# echo " dhcp_option_value $dhcp_option_value"
|
||||
# echo " overwrite $overwrite"
|
||||
# echo " to_interface $to_interface"
|
||||
#
|
||||
# if [ ! $(uci -q get dhcp.$to_interface) ] ; then
|
||||
# echo "to_interface $to_interface does not exist in dhcp uci config"
|
||||
# return
|
||||
# fi
|
||||
#
|
||||
#}
|
||||
|
||||
|
||||
foreach_dhcp_option() {
|
||||
dhcp_option=$1
|
||||
|
||||
echo "dhcp_option: $dhcp_option"
|
||||
case $dhcp_option in
|
||||
43) dhcp_option_value=$opt43 ;;
|
||||
66) dhcp_option_value=$opt66 ;;
|
||||
67) dhcp_option_value=$opt67 ;;
|
||||
128) dhcp_option_value=$opt128 ;;
|
||||
132) dhcp_option_value=$opt132 ;;
|
||||
133) dhcp_option_value=$opt133 ;;
|
||||
224) dhcp_option_value=$opt224 ;;
|
||||
225) dhcp_option_value=$opt225 ;;
|
||||
226) dhcp_option_value=$opt226 ;;
|
||||
*) dhcp_option_value="unsupported" ;;
|
||||
esac
|
||||
|
||||
if [ "${dhcp_option_value}" == "unsupported" ] ; then
|
||||
echo "dhcp_option $dhcp_option is unsupported"
|
||||
return
|
||||
fi
|
||||
if [ "${dhcp_option_value}" == "" ] ; then
|
||||
echo "dhcp_option $dhcp_option is empty"
|
||||
return
|
||||
fi
|
||||
|
||||
#echo "dhcp_option: $dhcp_option dhcp_option_value: ${dhcp_option_value}"
|
||||
|
||||
#config_list_foreach $section to_interface foreach_to_interface
|
||||
|
||||
add_section_dhcp_vendorclass $dhcp_option ${dhcp_option_value} $vendorclass
|
||||
}
|
||||
|
||||
foreach_from_interface() {
|
||||
from_interface="$1"
|
||||
#echo "from_interface: $from_interface"
|
||||
if [ "$from_interface" != "$interface" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
dhcp_option=""
|
||||
config_list_foreach $section dhcp_option foreach_dhcp_option
|
||||
#config_list_foreach $section dhcp_options foreach_dhcp_option
|
||||
}
|
||||
|
||||
from_interface=""
|
||||
config_list_foreach $section from_interface foreach_from_interface
|
||||
}
|
||||
|
||||
|
||||
# in uci dhcp config:
|
||||
# remove all the vendorclass sections
|
||||
# that have previosly been configured by this script.
|
||||
# all are identified by "option networkid dhcp_option_relay_*"
|
||||
function dhcp_option_relay_clear_prev()
|
||||
{
|
||||
local to_remove=""
|
||||
|
||||
foreach_vendorclass() {
|
||||
local section="$1"
|
||||
local networkid
|
||||
config_get networkid $section networkid
|
||||
|
||||
case "$networkid"
|
||||
in dhcp_option_relay*)
|
||||
to_remove="$to_remove $section"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
config_load dhcp
|
||||
config_foreach foreach_vendorclass vendorclass
|
||||
|
||||
local sect
|
||||
for sect in $to_remove ; do
|
||||
uci_remove dhcp $sect
|
||||
done
|
||||
uci_commit dhcp
|
||||
}
|
||||
|
||||
|
||||
# the main function
|
||||
function dhcp_option_relay_parse()
|
||||
{
|
||||
local the_json="$@"
|
||||
parse_the_json "$the_json"
|
||||
|
||||
dhcp_option_relay_clear_prev
|
||||
|
||||
newsectionid="0"
|
||||
|
||||
config_load provisioning
|
||||
config_foreach dhcp_option_relay dhcp_option_relay
|
||||
#config_foreach dhcp_option_relay dhcp_options_relay
|
||||
#config_foreach dhcp_option_relay dhcpoption_relay
|
||||
#config_foreach dhcp_option_relay dhcpoptions_relay
|
||||
#config_foreach dhcp_option_relay dhcp_optionrelay
|
||||
#config_foreach dhcp_option_relay dhcp_optionsrelay
|
||||
#config_foreach dhcp_option_relay dhcpoptionrelay
|
||||
#config_foreach dhcp_option_relay dhcpoptionsrelay
|
||||
}
|
||||
|
||||
#dhcp_option_relay_parse
|
||||
@@ -1,11 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo $$ > /var/run/iup.pid
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/network.sh
|
||||
. /lib/functions/savecfg.sh
|
||||
. /lib/functions/dhcp_option_relay.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
include /lib/upgrade
|
||||
@@ -18,43 +13,38 @@ export IUPTEMP="/tmp/iup"
|
||||
export INTERACTIVE=0
|
||||
export VERBOSE=0
|
||||
export CONF=1
|
||||
export DESKEY=
|
||||
export MAC=
|
||||
export DESKEY=$(cat /proc/nvram/DesKey | hexdump -e '16/1 "%02x"')
|
||||
export MAC=$(cat /proc/nvram/BaseMacAddr)
|
||||
export RANGE=10
|
||||
export RETRYSTOP=5
|
||||
export SLEEP=10
|
||||
#remove whitespace
|
||||
MAC=${MAC// /}
|
||||
#lower to upper Conversion
|
||||
MAC=$(echo $MAC | tr '[a-z]' '[A-Z]')
|
||||
|
||||
json_load "$(ubus call router.system info)"
|
||||
json_select system
|
||||
json_get_var MAC basemac
|
||||
json_select ..
|
||||
json_select keys
|
||||
json_get_var DESKEY des
|
||||
json_select ..
|
||||
|
||||
# MAC lowercase to uppercase and remove ':'
|
||||
MAC=$(echo $MAC | tr '[a-z]' '[A-Z]' | tr -d ':')
|
||||
|
||||
# Convert DESKEY to HEX format
|
||||
DESKEY=$(echo $DESKEY | tr -d '\n' | hexdump -e '16/1 "%02x"')
|
||||
|
||||
|
||||
# no verbose: no output
|
||||
# -v log to system log
|
||||
# -v -v log to system log and console
|
||||
# -v -v -v log to system log, console and stderr
|
||||
v() {
|
||||
[ "$VERBOSE" -eq 0 ] && return
|
||||
[ "$VERBOSE" -eq 1 ] && logger -t $0[$$] "$@" && return
|
||||
[ "$VERBOSE" -eq 2 ] && logger -s -t $0[$$] "$@" >/dev/console 2>&1 && return
|
||||
[ "$VERBOSE" -eq 3 ] && logger -s -t $0[$$] "$@" 2>&1 | tee /dev/console && return
|
||||
[ "$VERBOSE" -ge 1 ] && echo "$@"
|
||||
}
|
||||
|
||||
vv() {
|
||||
VERBOSE="$(($VERBOSE + 1))"
|
||||
v "$@"
|
||||
VERBOSE="$(($VERBOSE - 1))"
|
||||
if [ -f $IUPMD5 ]; then
|
||||
v "File $IUPMD5 exists"
|
||||
else
|
||||
v "File $IUPMD5 did not exists"
|
||||
touch $IUPMD5
|
||||
fi
|
||||
|
||||
handle_ucitrack()
|
||||
{
|
||||
local config="$1"
|
||||
config_get init "$config" init
|
||||
echo $init
|
||||
config_get affects "$config" affects
|
||||
|
||||
for aff in $affects
|
||||
do
|
||||
config_foreach handle_ucitrack $aff
|
||||
done
|
||||
}
|
||||
|
||||
get_packages()
|
||||
@@ -62,45 +52,45 @@ get_packages()
|
||||
local pack
|
||||
pack=$(grep -w 'package' $1)
|
||||
pack=${pack//package/}
|
||||
#pack=${pack//[\'|\"]/}
|
||||
echo $pack | tr -d '\"' | tr -d "'"
|
||||
pack=${pack//[\'|\"]/}
|
||||
echo $pack
|
||||
}
|
||||
|
||||
reload ()
|
||||
{
|
||||
local reload
|
||||
local initlist
|
||||
local reload
|
||||
local pack
|
||||
pack=$(get_packages $1)
|
||||
v "Calling ubus call uci commit for $pack"
|
||||
config_load ucitrack
|
||||
for packname in $pack
|
||||
do
|
||||
ubus call uci commit '{"config":"'$packname'"}'
|
||||
sleep 1
|
||||
initlist=$(config_foreach handle_ucitrack $packname)
|
||||
for reltest in $initlist
|
||||
do
|
||||
case $reload in
|
||||
*" $reltest "*) v "already added to reload $reltest" ;;
|
||||
*) reload="$reload"" ""$reltest" ;;
|
||||
esac
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
save_usercfg()
|
||||
{
|
||||
savecfg_save_config fw_redirect fw_parental wifi
|
||||
}
|
||||
|
||||
apply_usercfg()
|
||||
{
|
||||
# decide to save the user changes based on keepuserconfig received through provisioning
|
||||
local keep
|
||||
config_load provisioning
|
||||
config_get_bool keep configserver keepuserconfig "0"
|
||||
v "apply_usercfg(): keepuserconfig = $keep"
|
||||
if [ "$keep" != "1" ] ; then
|
||||
savecfg_rm_files
|
||||
return
|
||||
v "Init scripts to be run $reload"
|
||||
for inittoreload in $reload
|
||||
do
|
||||
if [ "$inittoreload" != "iup" ]; then
|
||||
/etc/init.d/$inittoreload restart
|
||||
fi
|
||||
done
|
||||
#Ugly hack need to figure out something here
|
||||
test_default_route
|
||||
if [ "$?" -eq 1 ]; then
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
savecfg_apply_config fw_redirect fw_parental wifi
|
||||
}
|
||||
|
||||
handle_provisioning() {
|
||||
local config="$1"
|
||||
local default="$2"
|
||||
local enabled
|
||||
local url
|
||||
local tftpfile
|
||||
@@ -118,20 +108,15 @@ handle_provisioning() {
|
||||
mkdir $IUPTEMP
|
||||
fi
|
||||
touch $IUPCONFFILES
|
||||
config_get_bool enabled "$config" enabled "$default"
|
||||
config_get_bool enabled "$config" enabled
|
||||
config_get_bool defaultreset "$config" defaultreset
|
||||
config_get deckey "$config" deckey
|
||||
if [ "$enabled" -eq 1 ]; then
|
||||
if [ "$config" == "iup" ]; then
|
||||
v "Using url received in dhcp options"
|
||||
config_get url "$config" urliup
|
||||
else
|
||||
config_get url "$config" url
|
||||
fi
|
||||
config_get url "$config" urliup
|
||||
url=${url//\$MAC/$MAC}
|
||||
v "Downloading from url \"$url\""
|
||||
|
||||
while [ $retry -le $RETRYSTOP ]
|
||||
v "Download from $url"
|
||||
|
||||
while [ $retry -le $RETRYSTOP ]
|
||||
do
|
||||
if [ ${url%%:*} == "tftp" ]; then
|
||||
tftpfile=${url#*\/\/}
|
||||
@@ -143,17 +128,17 @@ handle_provisioning() {
|
||||
get_image "$url" "cat" > $IUPCONFFILES
|
||||
fi
|
||||
if [ -s $IUPCONFFILES ]; then
|
||||
v "Download finished"
|
||||
v "File Downloaded"
|
||||
retry=$((RETRYSTOP + 1))
|
||||
else
|
||||
v "Download failed, retrying in $incsleep seconds"
|
||||
else
|
||||
v "Download failed will try again in $incsleep sec"
|
||||
sleep $incsleep
|
||||
incsleep=$((incsleep * retry + number))
|
||||
retry=$((retry+1))
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [ ! -s "$IUPCONFFILES" ] && [ "$enabled" -eq 1 ]; then
|
||||
if [ ! -s "$IUPCONFFILES" ]; then
|
||||
echo "File not Found"
|
||||
reboot="off"
|
||||
CONF=0
|
||||
@@ -166,61 +151,47 @@ handle_Downloaded_file()
|
||||
{
|
||||
local DECKEY
|
||||
local KEY
|
||||
[ -n "$1" ] && DECKEY=$(echo $1 | tr -d '\n' | hexdump -e '16/1 "%02x"')
|
||||
[ -n "$1" ] && DECKEY=$(echo $1 | hexdump -e '16/1 "%02x"')
|
||||
KEY=${DECKEY:-$DESKEY}
|
||||
local img_type
|
||||
case "$(get_image_type "$IUPCONFFILES")" in
|
||||
"INTENO") img_type=2 ;;
|
||||
"CFE+FS") img_type=1 ;;
|
||||
"FS") img_type=0 ;;
|
||||
*) img_type="UNKNOWN";;
|
||||
esac
|
||||
|
||||
if [ "$img_type" == "UNKNOWN" ] ; then
|
||||
if [ "$(brcm_fw_tool -i check "$IUPCONFFILES")" == "UNKNOWN" ] ; then
|
||||
case "$(hexdump -v -n 2 -e '1/1 "%02x"' $IUPCONFFILES)" in
|
||||
1f8b)
|
||||
v "Downloaded file is an unencrypted config"
|
||||
v "Found Config"
|
||||
md5=$(md5sum $IUPCONFFILES)
|
||||
md5="${md5%% *}" # remove the first space and everything after it
|
||||
md5sum "$IUPCONFFILES" >> "$IUPMD5.temp"
|
||||
if grep -q "$md5" "$IUPMD5"; then
|
||||
v "Config is already up to date, nothing to do"
|
||||
#because config is up to date we need to disable last step reboot if set
|
||||
v "Config Already Up to Date"
|
||||
#becuse config is up to date we need to disable last step reboot if set
|
||||
reboot="off"
|
||||
rm -rf $IUPTEMP
|
||||
else
|
||||
save_usercfg
|
||||
cd $IUPTEMP
|
||||
cd /tmp/iup/
|
||||
tar xvzf $IUPCONFFILES
|
||||
for f in $CONFILESLURP
|
||||
do
|
||||
v "File to be applied $f and config $(cat $f)"
|
||||
uci -f $f import
|
||||
v "file to be applied $f and config $(cat $f)"
|
||||
uci import -f $f
|
||||
done
|
||||
pack=$(get_packages $CONFILESLURP)
|
||||
v "Packages to be commited: $pack"
|
||||
v "$pack packages to be commited"
|
||||
for packname in $pack
|
||||
do
|
||||
uci commit $packname
|
||||
done
|
||||
apply_usercfg
|
||||
reboot=`uci -q get provisioning.configserver.reboot`
|
||||
if [ "$reboot" != "on" ]; then
|
||||
sync
|
||||
reload $CONFILESLURP
|
||||
fi
|
||||
rm -rf $IUPTEMP
|
||||
|
||||
cp /rom/etc/uci-defaults/* /etc/uci-defaults/
|
||||
sync
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
v "Downloaded file is an encrypted config"
|
||||
v "encrypted"
|
||||
if [ $KEY ]; then
|
||||
openssl enc -d -des-ede -nosalt -K $KEY -iv "0000000000000000" -in $IUPCONFFILES -out $IUPCONFFILES.tmp
|
||||
if [ $? -eq 0 ]; then
|
||||
v "Decryption successful"
|
||||
v "Decrypted Content"
|
||||
mv $IUPCONFFILES.tmp $IUPCONFFILES
|
||||
handle_Downloaded_file
|
||||
else
|
||||
@@ -236,360 +207,71 @@ handle_Downloaded_file()
|
||||
;;
|
||||
esac
|
||||
else
|
||||
v "Downloaded file is a firmware, will start reflashing"
|
||||
v "Image found will start flashing"
|
||||
if [ "$defaultreset" -eq 1 ]; then
|
||||
v "Not saving configuration over reflash"
|
||||
v "nuke config"
|
||||
/sbin/sysupgrade -v -n $IUPCONFFILES
|
||||
else
|
||||
v "Saving configuration over reflash"
|
||||
/sbin/sysupgrade -v $IUPCONFFILES
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# function: change_to_vlan
|
||||
# arg 1 = vlan id
|
||||
# arg 2 = vlan priority
|
||||
# arg 3 = $INTERFACE
|
||||
change_to_vlan() {
|
||||
# local variables.
|
||||
local name="vlan$1" # construct name = vlan + vlanid.
|
||||
local base_dev # varible holding device name of wan port.
|
||||
local wan_if # variable holding wan interfaces.
|
||||
local new_wan_if #
|
||||
###main
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
|
||||
# extract device name.
|
||||
network_get_device base_dev $3
|
||||
|
||||
# bring down old interface/device.
|
||||
ifdown "${base_dev}"
|
||||
v "option 132: bringing down old if: ${base_dev}"
|
||||
|
||||
# extract base name of device.
|
||||
base_dev=$(echo ${base_dev} | cut -d. -f1)
|
||||
|
||||
# add "VLAN interface" to the "end of the file".
|
||||
uci add network device
|
||||
uci rename network.@device[-1]=${name}
|
||||
uci set network.@device[-1].type=8021q
|
||||
uci set network.@device[-1].ifname=${base_dev}
|
||||
uci set network.@device[-1].name="${base_dev}.${1}"
|
||||
uci set network.@device[-1].vid=${1}
|
||||
uci set network.@device[-1].priority=${2}
|
||||
# and commit the change.
|
||||
uci commit network
|
||||
v "option 132: committed update to file network"
|
||||
|
||||
# reload configuration files.
|
||||
ubus call network reload
|
||||
v "option 132: reload network config"
|
||||
|
||||
# replace old interface (like eth0.1 with new eth0.101).
|
||||
wan_if=$(uci get network.$3.ifname)
|
||||
v "option 132: old network.${3}.ifname: $wan_if"
|
||||
|
||||
# loop through the string, remove any word close to "base_dev".
|
||||
for word in ${wan_if}; do
|
||||
#echo $word
|
||||
case $word in
|
||||
${base_dev}*) # don't add if.
|
||||
;;
|
||||
*) new_wan_if=${word}' '${new_wan_if} # add if.
|
||||
#new_wan_if+=" ${word}" # probably not working in ash.
|
||||
-v) export VERBOSE="$(($VERBOSE + 1))";;
|
||||
-q) export VERBOSE="$(($VERBOSE - 1))";;
|
||||
-*)
|
||||
echo "Invalid option: $1"
|
||||
exit 1
|
||||
;;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
# append new interface.
|
||||
new_wan_if=${new_wan_if}${base_dev}.${1}
|
||||
uci set network.wan.ifname="${new_wan_if}"
|
||||
# and commit the change.
|
||||
uci commit network
|
||||
v "option 132: committed update to file network: ifname=${new_wan_if}"
|
||||
shift;
|
||||
done
|
||||
|
||||
# reboot into new if configuration.
|
||||
vv "Rebooting"
|
||||
export REBOOT_REASON=iup
|
||||
local iupurl
|
||||
local configurl
|
||||
local software
|
||||
local sofwareminuspath
|
||||
config_load provisioning
|
||||
#check if iup should be used or if its overridden by /etc/config
|
||||
config_get configurl configserver url
|
||||
config_get reboot configserver reboot
|
||||
config_get iupurl iup urliup
|
||||
if [ $configurl ]; then
|
||||
handle_provisioning configserver
|
||||
elif [ $iupurl ]; then
|
||||
handle_provisioning iup
|
||||
else
|
||||
echo "No Provisioning Server Found"
|
||||
exit
|
||||
fi
|
||||
config_load provisioning
|
||||
config_foreach handle_provisioning subconfig
|
||||
config_get software uppgradeserver url
|
||||
sofwareminuspath=${software##*/}
|
||||
v "Software version to download $sofwareminuspath"
|
||||
|
||||
if [ $software ]; then
|
||||
local sysinfo=$(ubus call router quest "{ \"info\": \"system\" }")
|
||||
json_load "$sysinfo"
|
||||
json_get_var firmware firmware
|
||||
if [ "$sofwareminuspath" == "${sofwareminuspath/$firmware/}" ] ; then
|
||||
echo $software
|
||||
handle_provisioning uppgradeserver
|
||||
else
|
||||
v "Will not update software, already up to date"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $CONF -eq 1 ]; then
|
||||
mv "$IUPMD5.temp" $IUPMD5
|
||||
fi
|
||||
|
||||
if [ "$reboot" == "on" ]; then
|
||||
v "Reboot Signaled"
|
||||
/sbin/reboot
|
||||
}
|
||||
|
||||
handle_option224()
|
||||
{
|
||||
if [ -z "$1" ] ; then
|
||||
echo "No argument"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $(echo $1|grep -o "," | wc -l) -eq 0 ] ; then
|
||||
url=$1
|
||||
else
|
||||
url=$(echo $1|cut -d',' -f1)
|
||||
a=$(echo $1|cut -d',' -f2)
|
||||
b=$(echo $1|cut -d',' -f3)
|
||||
c=$(echo $1|cut -d',' -f4)
|
||||
fi
|
||||
|
||||
currdate=$(date +"%Y-%m-%d")
|
||||
|
||||
active=0
|
||||
if [ -z $a ] ; then
|
||||
active=1
|
||||
elif [ $a ] && [ $b ] && [ $a -lt 25 ] ; then
|
||||
#Time
|
||||
begin=$(date +%s -d"$currdate $a")
|
||||
now=$(date +%s)
|
||||
end=$((begin+3600*$b))
|
||||
if [ $now -gt $begin ] && [ $now -lt $end ] ; then
|
||||
active=1
|
||||
fi
|
||||
elif [ $a ] && [ $b ] && [ $c ] && [ $a -gt 25 ] ; then
|
||||
#Date
|
||||
y=$(echo $a| cut -c1-4)
|
||||
m=$(echo $a| cut -c5-6)
|
||||
d=$(echo $a| cut -c7-8)
|
||||
begin=$(date +%s -d"$y-$m-$d $b")
|
||||
now=$(date +%s)
|
||||
end=$((begin+3600*$c))
|
||||
if [ $now -gt $begin ] && [ $now -lt $end ] ; then
|
||||
active=1
|
||||
fi
|
||||
else
|
||||
echo "Bad format"
|
||||
return 1
|
||||
fi
|
||||
|
||||
softwareminuspath=${url##*/}
|
||||
|
||||
if [ $url ] && [ $active -eq 1 ]; then
|
||||
v "Software version to download \"$softwareminuspath\""
|
||||
local sysinfo=$(ubus call router.system info)
|
||||
json_load "$sysinfo"
|
||||
json_select system
|
||||
json_get_var firmware firmware
|
||||
local firmware_new=${softwareminuspath%.*} # remove extension (.w, .y or .y2) from filename
|
||||
if [ "$firmware_new" != "$firmware" ] ; then
|
||||
v "Firmware found $url will start flashing"
|
||||
v "Currently running firmware: \"$firmware\""
|
||||
v "Newly received firmware: \"$firmware_new\""
|
||||
wait_for_dns $url
|
||||
v "Start flashing"
|
||||
/sbin/sysupgrade -v $url &
|
||||
return 1
|
||||
else
|
||||
v "Firmware is up to date, nothing to do"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
parse_dhcp_options()
|
||||
{
|
||||
local the_json="$@"
|
||||
|
||||
# process the dhcp_option_relay sections
|
||||
dhcp_option_relay_parse "$the_json"
|
||||
|
||||
# Process IUP related DHCP options #
|
||||
local privopt224 privopt225 privopt226 vendorspecinf httpurl128
|
||||
local tftp bootfile vlanid vlanpriority interface
|
||||
|
||||
json_load "$the_json"
|
||||
json_get_var interface interface
|
||||
json_get_var privopt224 privopt224
|
||||
json_get_var privopt225 privopt225
|
||||
json_get_var privopt226 privopt226
|
||||
json_get_var vendorspecinf vendorspecinf # option 43
|
||||
json_get_var httpurl128 httpurl128
|
||||
json_get_var tftp tftp # option 66
|
||||
json_get_var bootfile bootfile #option 67
|
||||
json_get_var vlanid vlanid # option 132
|
||||
json_get_var vlanpriority vlanpriority # option 133
|
||||
|
||||
if [ $privopt224 ]; then
|
||||
v "dhcp option 224 firmware url $privopt224"
|
||||
handle_option224 $privopt224
|
||||
[ $? -eq 1 ] && exit
|
||||
fi
|
||||
|
||||
if [ $vendorspecinf ]; then
|
||||
v "dhcp option 43 tr69 url $vendorspecinf"
|
||||
url=${vendorspecinf%%,*}; rest=${vendorspecinf#*,}
|
||||
provisioningcode=${rest%%,*};
|
||||
[ -f /etc/config/cwmp ] && uci_set_state cwmp acs dhcp_url "$url"
|
||||
uci_set_state provisioning iup urlcwmp "$url"
|
||||
uci_set_state provisioning iup url "$url"
|
||||
uci_set_state provisioning iup provisioningcode "$provisioningcode"
|
||||
elif [ $httpurl128 ]; then
|
||||
v "dhcp option 128 http config url $httpurl128"
|
||||
uci_set_state provisioning iup urliup "$httpurl128"
|
||||
elif [ $tftp ]; then
|
||||
v "dhcp option 66 tftp config url $tftp"
|
||||
if [ ${bootfile:0:1} == '/' ]; then
|
||||
uci_set_state provisioning iup urliup "tftp://$tftp$bootfile"
|
||||
else
|
||||
uci_set_state provisioning iup urliup "tftp://$tftp/$bootfile"
|
||||
fi
|
||||
fi
|
||||
|
||||
# vlanid (and vlanpriority)
|
||||
if [ -n "$vlanid" -a -n "$vlanpriority" ]; then
|
||||
v "dhcp option 132 vlanid: ${vlanid} vlanpriority: ${vlanpriority}"
|
||||
change_to_vlan ${vlanid} ${vlanpriority} ${interface}
|
||||
elif [ -n "$vlanid" ]; then
|
||||
v "dhcp option 132 vlanid: ${vlanid}"
|
||||
change_to_vlan ${vlanid} 0 ${interface}
|
||||
elif [ -n "$privopt225" ] || [ -n "$privopt226" ]; then
|
||||
# opt225 and opt226 can be used together or separatly
|
||||
if [ -n "$privopt225" ]; then
|
||||
v "dhcp option 225: $privopt225"
|
||||
# option225 is allowd to change only once per CPE
|
||||
if [ "$(uci get -q ice.cloud.frozen)" != "1" ] ; then
|
||||
uci set ice.cloud.frozen="1"
|
||||
uci set ice.cloud.enabled="1"
|
||||
uci set ice.cloud.server="$privopt225"
|
||||
fi
|
||||
fi
|
||||
if [ -n "$privopt226" ]; then
|
||||
v "dhcp option 226: $privopt226"
|
||||
[ -z "$(uci get -q ice.dhcp)" ] && uci set ice.dhcp="dhcp"
|
||||
uci set ice.dhcp.opt226connectionid="$privopt226"
|
||||
ubus send dhcp.opt226connectionid '{"opt226connectionid":"","value":"'$privopt226'"}'
|
||||
fi
|
||||
uci commit
|
||||
fi
|
||||
}
|
||||
|
||||
# wait_for_default_gateway to become reachable
|
||||
# return 0 if the default gateway is reachable
|
||||
# return 1 if the default gateway is not reachable after $wait_time
|
||||
wait_for_default_gateway()
|
||||
{
|
||||
local gateway
|
||||
local device
|
||||
local wait_time=120
|
||||
local wait_interval=10
|
||||
|
||||
while [ true ] ; do
|
||||
|
||||
gateway=""
|
||||
device=""
|
||||
network_flush_cache
|
||||
network_get_gateway gateway wan #true
|
||||
network_get_device device wan
|
||||
device="${device:+-I }$device"
|
||||
if ping -q -w 1 -c 1 $device $gateway >/dev/null 2>&1 ; then
|
||||
[ "$wait_time" -lt "60" ] && v "Default gateway $gateway is reachable"
|
||||
sleep $wait_interval
|
||||
return 0
|
||||
fi
|
||||
|
||||
# try the nameservers too
|
||||
for ns in $(grep nameserver /var/resolv.conf.auto | awk '{print $2}'); do
|
||||
if ping -q -w 1 -c 1 $device $ns >/dev/null 2>&1 ; then
|
||||
[ "$wait_time" -lt "60" ] && v "Name server $ns is reachable"
|
||||
sleep $wait_interval
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
v "Waiting for default gateway or name server. Countdown $wait_time seconds"
|
||||
sleep $wait_interval
|
||||
wait_time=$((wait_time - wait_interval))
|
||||
[ "$wait_time" -le "0" ] && break # timer expired
|
||||
done
|
||||
|
||||
return 1 # default gateway and name server are not reachable
|
||||
}
|
||||
|
||||
|
||||
main()
|
||||
{
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
-v) export VERBOSE="$(($VERBOSE + 1))";;
|
||||
-q) export VERBOSE="$(($VERBOSE - 1))";;
|
||||
--dhcp-options)
|
||||
shift
|
||||
parse_dhcp_options "$@"
|
||||
exit 0
|
||||
;;
|
||||
-*)
|
||||
echo "Invalid option: $1"
|
||||
exit 1
|
||||
;;
|
||||
*) break;;
|
||||
esac
|
||||
shift;
|
||||
done
|
||||
|
||||
if ! wait_for_default_gateway ; then
|
||||
v "Neither default gateway nor name server are reachable. Aborting iup."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f $IUPMD5 ]; then
|
||||
v "Creating file $IUPMD5"
|
||||
touch $IUPMD5
|
||||
fi
|
||||
|
||||
|
||||
local iupurl
|
||||
local configurl
|
||||
local software
|
||||
local sofwareminuspath
|
||||
|
||||
config_load provisioning
|
||||
#check if iup should be used or if its overridden by /etc/config
|
||||
config_get configurl configserver url
|
||||
config_get reboot configserver reboot
|
||||
config_get iupurl iup urliup
|
||||
|
||||
if [ $configurl ]; then
|
||||
handle_provisioning configserver "0"
|
||||
elif [ $iupurl ]; then
|
||||
handle_provisioning iup "1"
|
||||
else
|
||||
v "No provisioning server configured"
|
||||
exit
|
||||
fi
|
||||
|
||||
config_load provisioning
|
||||
config_foreach handle_provisioning subconfig "0"
|
||||
config_get software uppgradeserver url
|
||||
sofwareminuspath=${software##*/}
|
||||
|
||||
if [ $software ]; then
|
||||
v "Software version to download \"$sofwareminuspath\""
|
||||
local sysinfo=$(ubus call router.system info)
|
||||
json_load "$sysinfo"
|
||||
json_select system
|
||||
json_get_var firmware firmware
|
||||
json_get_var filesystem filesystem
|
||||
if [ "$filesystem" == "JFFS2" ] ; then
|
||||
firmware=$firmware.w
|
||||
else
|
||||
firmware=$firmware.y3
|
||||
fi
|
||||
if [ "$sofwareminuspath" == "${sofwareminuspath/$firmware/}" ] ; then
|
||||
v "Software \"$software\""
|
||||
handle_provisioning uppgradeserver "0"
|
||||
else
|
||||
v "Will not update software, already up to date"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $CONF -eq 1 ]; then
|
||||
mv "$IUPMD5.temp" $IUPMD5
|
||||
fi
|
||||
|
||||
if [ "$reboot" == "on" ]; then
|
||||
vv "Rebooting"
|
||||
export REBOOT_REASON=iup
|
||||
/sbin/reboot
|
||||
fi
|
||||
|
||||
rm -rf /var/run/iup.pid
|
||||
}
|
||||
|
||||
main $@
|
||||
fi
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
# Copyright (C) 2019 iopsys
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
# Copyright (C) 2013 Inteno
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
@@ -11,9 +8,6 @@ PKG_NAME:=iwatchdog
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
# support parallel build
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
@@ -28,7 +22,7 @@ include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/iwatchdog
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=IOPSYS watchdog
|
||||
TITLE:=Inteno watchdog
|
||||
endef
|
||||
|
||||
define Package/iwatchdog/description
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=10
|
||||
START=01
|
||||
STOP=99
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user