wifitoggle: move to github
wifitoggle: move to github

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>

git-svn-id: svn://svn.openwrt.org/openwrt/packages@42560 3c298f89-4303-0410-b956-a3cf2f4a3e73

file:a/libs/libnatpmp/Makefile (deleted)
--- a/libs/libnatpmp/Makefile
+++ /dev/null
@@ -1,84 +1,1 @@
-#
-# Copyright (C) 2011-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:=libnatpmp
-PKG_VERSION:=20110808
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://miniupnp.free.fr/files
-PKG_MD5SUM:=22a1225b890471a7750a9bf26eb863f7
-
-PKG_INSTALL:=1
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/libnatpmp/Default
-  TITLE:=NAT Port Mapping Protocol (NAT-PMP)
-  URL:=http://miniupnp.free.fr/libnatpmp.html
-endef
-
-define Package/libnatpmp/Default/description
-  libnatpmp is an attempt to make a portable and fully compliant implementation
-  of the protocol for the client side. It is based on non blocking sockets and
-  all calls of the API are asynchronous. It is therefore very easy to integrate
-  the NAT-PMP code to any event driven code.
-endef
-
-define Package/libnatpmp
-  $(call Package/libnatpmp/Default)
-  SECTION:=libs
-  CATEGORY:=Libraries
-  TITLE+= library
-endef
-
-define Package/libnatpmp/description
-  $(call Package/libnatpmp/Default/description)
-  This package contains the shared library.
-endef
-
-define Package/natpmpc
-  $(call Package/libnatpmp/Default)
-  SECTION:=net
-  CATEGORY:=Network
-  SUBMENU:=Firewall
-  TITLE+= client
-  DEPENDS:=+libnatpmp
-endef
-
-define Package/natpmpc/description
-  $(call Package/libnatpmp/Default/description)
-  This package contains the natpmp client.
-endef
-
-MAKE_FLAGS += \
-	COPTS="$(TARGET_CFLAGS)" \
-	PREFIX="$(PKG_INSTALL_DIR)" \
-	OS="Linux"
-
-define Build/InstallDev
-	$(INSTALL_DIR) $(1)/usr/include
-	$(CP) $(PKG_INSTALL_DIR)/usr/include/natpmp.h $(1)/usr/include/
-	$(INSTALL_DIR) $(1)/usr/lib
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnatpmp*.{so*,a} $(1)/usr/lib/
-endef
-
-define Package/libnatpmp/install
-	$(INSTALL_DIR) $(1)/usr/lib
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libnatpmp.so.* $(1)/usr/lib/
-endef
-
-define Package/natpmpc/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/natpmpc $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,libnatpmp))
-$(eval $(call BuildPackage,natpmpc))
-

--- a/libs/libnatpmp/patches/001-cross_compile.patch
+++ /dev/null
@@ -1,13 +1,1 @@
---- a/Makefile
-+++ b/Makefile
-@@ -11,7 +11,8 @@ INSTALL = install
- # APIVERSION is used in soname
- APIVERSION = 1
- #LDFLAGS = -Wl,--no-undefined
--CFLAGS = -O -fPIC -Wall -DENABLE_STRNATPMPERR
-+COPTS = -O
-+CFLAGS = $(COPTS) -fPIC -Wall -DENABLE_STRNATPMPERR
- 
- LIBOBJS = natpmp.o getgateway.o
- 
 

file:a/net/lftp/Makefile (deleted)
--- a/net/lftp/Makefile
+++ /dev/null
@@ -1,61 +1,1 @@
-#
-# Copyright (C) 2008-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:=lftp
-PKG_VERSION:=4.3.6
-PKG_RELEASE:=2
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=http://lftp.cybermirror.org \
-  http://lftp.cybermirror.org/old
-PKG_MD5SUM:=ffcdbaec5d1416cb6dd754efd43fa61a
-
-PKG_INSTALL:=1
-
-include $(INCLUDE_DIR)/uclibc++.mk
-include $(INCLUDE_DIR)/package.mk
-
-define Package/lftp
-  SUBMENU:=File Transfer
-  SECTION:=net
-  CATEGORY:=Network
-  DEPENDS:=+libncurses +libopenssl +libreadline $(CXX_DEPENDS) +libexpat
-  TITLE:=Sophisticated file transfer program
-  URL:=http://lftp.yar.ru/
-endef
-
-define Package/lftp/description
-  lftp is sophisticated file transfer program with command line interface. It
-  supports FTP, HTTP, FISH, SFTP and FILE (local FS) protocols. GNU Readline
-  library is used for input. BitTorrent protocol is supported as built-in
-  `torrent' command.
-endef
-
-CONFIGURE_ARGS += \
-	--without-libiconv-prefix \
-	--without-libintl-prefix \
-	--without-gnutls \
-	--without-libresolv \
-	--with-openssl="$(STAGING_DIR)/usr" \
-	--disable-static
-
-CONFIGURE_VARS += \
-	LIBS="-lz -lutil -lcurses -ldl" \
-	i_cv_posix_fallocate_works=no
-
-MAKE_VARS += \
-	LD="$(TARGET_CXX)"
-
-define Package/lftp/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lftp $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,lftp))
-

--- a/net/lftp/patches/001-libintl.patch
+++ /dev/null
@@ -1,19 +1,1 @@
---- a/lib/gettext.h
-+++ b/lib/gettext.h
-@@ -22,7 +22,6 @@
- #if ENABLE_NLS
- 
- /* Get declarations of GNU message catalog functions.  */
--# include <libintl.h>
- 
- /* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
-    the gettext() and ngettext() macros.  This is an alternative to calling
-@@ -54,7 +53,6 @@
- #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
- # include <cstdlib>
- # if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
--#  include <libintl.h>
- # endif
- #endif
- 
 

--- a/utils/restorefactory/Makefile
+++ /dev/null
@@ -1,40 +1,1 @@
-#
-# Copyright (C) 2010 segal.di.ubi.pt
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
 
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=restorefactory
-PKG_VERSION:=1
-PKG_RELEASE:=6
-
-PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/restorefactory
-  SECTION:=utils
-  CATEGORY:=Utilities
-  TITLE:=Mimic original functionality of the reset button
-endef
-
-define Package/restorefactory/description
-RestoreFactory handles the reset button event and issues a "firstboot" command.
-Button and wait time can be configured with a UCI file.
-endef
-
-define Build/Compile
-endef
-
-define Package/restorefactory/install
-	$(INSTALL_DIR) $(1)/etc/hotplug.d/button
-	$(INSTALL_BIN) ./files/hotplug_restorefactory $(1)/etc/hotplug.d/button/50-restorefactory
-	$(INSTALL_DIR) $(1)/etc/uci-defaults
-	$(INSTALL_BIN) ./files/uci_defaults_restorefactory $(1)/etc/uci-defaults/50-restorefactory
-endef
-
-$(eval $(call BuildPackage,restorefactory))
-

--- a/utils/restorefactory/files/hotplug_restorefactory
+++ /dev/null
@@ -1,32 +1,1 @@
-#!/bin/sh
 
-system_config() {
-	config_get button "$1" button "reset"
-	config_get action "$1" action "pressed"
-	config_get timeout "$1" timeout "5"
-}
-
-config_load system
-config_foreach system_config restorefactory
-
-[ "$BUTTON" = "$button" ] && {
-
-	[ -f /tmp/run/restorefactory.pid ] && read PID < /tmp/run/restorefactory.pid && kill $PID && rm /tmp/run/restorefactory.pid && logger -p user.info -t "restorefactory" "restore to factory defaults aborted"
-
-	[ "$ACTION" = "$action" ] && {
-
-		if [ "$timeout" -gt 0 ]
-		then
-			sleep "$timeout" && firstboot && reboot &
-			echo $! > /tmp/run/restorefactory.pid
-			logger -p user.info -t "restorefactory" "restoring to factory defaults in $timeout seconds"
-		elif [ "$timeout" -eq 0 ]
-		then
-			firstboot && reboot &
-		else
-			logger -p user.info -t "restorefactory" "invalid timeout value ($timeout)"
-		fi
-	}
-} 
-
-

--- a/utils/restorefactory/files/uci_defaults_restorefactory
+++ /dev/null
@@ -1,11 +1,1 @@
-#!/bin/sh
 
-uci -q show system.@restorefactory[0] || {
-	uci add system restorefactory
-	uci set system.@restorefactory[0].button=reset
-	uci set system.@restorefactory[0].action=pressed
-	uci set system.@restorefactory[0].timeout=5
-	uci commit
-}
-
-

--- a/utils/wifitoggle/Makefile
+++ /dev/null
@@ -1,45 +1,1 @@
-#
-# Copyright (C) 2010-2013 OpenWrt.org
-# Copyright (C) 2010 segal.di.ubi.pt
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
 
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=wifitoggle
-PKG_VERSION:=1
-PKG_RELEASE:=4
-
-PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/wifitoggle
-  SECTION:=utils
-  CATEGORY:=Utilities
-  TITLE:=Script to toggle Wi-Fi with a button and UCI config
-endef
-
-define Package/wifitoggle/description
-Very versatile script to toggle Wi-Fi with a button. Allows to set
-timeouts, persist changes after boot, and set LEDs according to the state.
-endef
-
-define Package/wifitoggle/conffiles
-/etc/config/wifitoggle
-endef
-
-define Build/Compile
-endef
-
-define Package/wifitoggle/install
-	$(INSTALL_DIR) $(1)/etc/hotplug.d/button
-	$(INSTALL_BIN) ./files/wifitoggle.hotplug $(1)/etc/hotplug.d/button/50-wifitoggle
-	$(INSTALL_DIR) $(1)/etc/config
-	$(INSTALL_DATA) ./files/wifitoggle.config $(1)/etc/config/wifitoggle
-endef
-
-$(eval $(call BuildPackage,wifitoggle))
-

--- a/utils/wifitoggle/files/wifitoggle.config
+++ /dev/null
@@ -1,12 +1,1 @@
-config wifitoggle
-	option button	'wps'
 
-	option persistent	'0' 
-	option timer		'600'
-
-	option led_sysfs		'wrt160nl:amber:wps'
-	option led_enable_trigger	'timer' 
-	option led_enable_delayon	'500'
-	option led_enable_delayoff	'500'
-	option led_disable_default	'0'
-

--- a/utils/wifitoggle/files/wifitoggle.hotplug
+++ /dev/null
@@ -1,173 +1,1 @@
-# /bin/sh
 
-setled() {
-        if [ -e /sys/class/leds/${led_sysfs}/brightness ]
-	then
-                [ $led_default -eq 1 ] && echo 1 >/sys/class/leds/${led_sysfs}/brightness
-                [ $led_default -eq 1 ] || echo 0 >/sys/class/leds/${led_sysfs}/brightness
-
-                echo $led_trigger > /sys/class/leds/${led_sysfs}/trigger
-
-                [ "$led_trigger" == "netdev" -a -n "$led_dev" ] && {
-                        echo $led_dev > /sys/class/leds/${led_sysfs}/device_name
-                        echo $led_mode > /sys/class/leds/${led_sysfs}/mode
-                }
-
-                [ "$led_trigger" == "timer" ] && {
-                        [ -n "$led_delayon" ] && echo $led_delayon > /sys/class/leds/${led_sysfs}/delay_on
-                        [ -n "$led_delayoff" ] && echo $led_delayoff > /sys/class/leds/${led_sysfs}/delay_off
-                }
-        else
-		logger -p user.err -t "wifitoggle" "led: ${led_sysfs} not found"
-	fi
-}
-
-load_wireless() {
-	disabled="$(uci get wireless.${1}.disabled)"
-}
-
-save_wireless() {
-	[ "$device" = "all" -o "$device" = "${1}" ] && {
-		uci set "wireless.${1}.disabled=$disabled"
-	}
-}
-
-setwifi() {
-        setled
-
-        config_load wireless
-        config_foreach save_wireless wifi-device
-
-        if ubus list network.wireless >/dev/null 2>/dev/null; then
-                ubus call network reload
-        else
-                wifi
-        fi
-}
-
-
-save_system() {
-        config_get sysfs $1 sysfs
-        [ "$sysfs" = "$led_sysfs" ] && {
-                uci set "system.${1}.trigger=$led_trigger"
-                uci set "system.${1}.dev=$led_dev"
-                uci set "system.${1}.mode=$led_mode"
-                uci set "system.${1}.default=$led_default"
-                uci set "system.${1}.delayon=$led_delayon"
-                uci set "system.${1}.delayoff=$led_delayoff"
-
-                ledset=1
-        }
-}
-
-commit_changes() {
-        ledset=""
-
-        config_load system
-        config_foreach save_system led
-
-        [ "$ledset" -eq 1 ] || {
-                section=$(uci add system led)
-                uci set "system.${section}.sysfs=$led_sysfs"
-                uci set "system.${section}.trigger=$led_trigger"
-                uci set "system.${section}.dev=$led_dev"
-                uci set "system.${section}.mode=$led_mode"
-                uci set "system.${section}.default=$led_default"
-                uci set "system.${section}.delayon=$led_delayon"
-                uci set "system.${section}.delayoff=$led_delayoff"
-        }
-
-        uci commit
-}
-
-enable() {
-
-	led_trigger="$led_enable_trigger"
-	led_trigger="$led_enable_trigger"
-	led_dev="$led_enable_dev"
-	led_mode="$led_enable_mode"
-	led_default="$led_enable_default"
-	led_delayon="$led_enable_delayon"
-	led_delayoff="$led_enable_delayoff"
-	disabled=0
-	
-	setwifi
-
-	[ "$timer" -le 0 -a "$persistent" -eq 1 ] && commit_changes
-	
-	logger -p user.info -t "wifitoggle" "device($device) enabled"
-
-	[ "$timer" -gt 0 ] && {
-		sleep "$timer" && disable && rm /tmp/run/wirelesstoggle_${1}.pid &
-                echo $! > /tmp/run/wirelesstoggle_${1}.pid
-		logger -p user.info -t "wifitoggle" "auto-disable timer started($timer seconds)"
-	}
-}
-
-disable() {
-
-	led_trigger="$led_disable_trigger"
-	led_trigger="$led_disable_trigger"
-	led_dev="$led_disable_dev"
-	led_mode="$led_disable_mode"
-	led_default="$led_disable_default"
-	led_delayon="$led_disable_delayon"
-	led_delayoff="$led_disable_delayoff"
-	disabled=1
-
-	setwifi
-
-	[ "$timer" -le 0 -a "$persistent" -eq 1 ] && commit_changes
-	
-	logger -p user.info -t "wifitoggle" "device($device) disabled"
-}
-
-
-load_wifitoggle() {
-	config_get device $1 device "all"
-        config_get button $1 button "wps"
-        config_get action $1 action "pressed"
-        config_get_bool persistent $1 persistent "0"
-        config_get timer $1 timer "0"
-
-        config_get led_sysfs $1 led_sysfs
-
-	config_get led_enable_trigger $1 led_enable_trigger "none"
-	config_get led_enable_dev $1 led_enable_dev
-	config_get led_enable_mode $1 led_enable_mode "link"
-	config_get_bool led_enable_default $1 led_enable_default "1"
-	config_get led_enable_delayon $1 led_enable_delayon
-	config_get led_enable_delayoff $1 led_enable_delayoff
-
-	config_get led_disable_trigger $1 led_disable_trigger "none"
-	config_get led_disable_dev $1 led_disable_dev
-	config_get led_disable_mode $1 led_disable_mode "link"
-	config_get_bool led_disable_default $1 led_disable_default "0"
-	config_get led_disable_delayon $1 led_disable_delayon
-	config_get led_disable_delayoff $1 led_disable_delayoff
-
-        [ "$ACTION" = "$action" -a "$BUTTON" = "$button" ] && {
-
-		[ -f /tmp/run/wirelesstoggle_${1}.pid ] && read PID < /tmp/run/wirelesstoggle_${1}.pid && kill $PID && rm /tmp/run/wirelesstoggle_${1}.pid
-
-		if [ "$device" = "all" ]
-		then
-			config_load wireless
-        		config_foreach load_wireless wifi-device
-		else
-			disabled="$(uci get wireless."$device".disabled)"
-		fi
-
-
-		if [ "$disabled" = "1" ] 
-		then
-			enable $1
-		else
-			disable
-		fi
-        }
-}
-
-config_load wifitoggle
-config_foreach load_wifitoggle wifitoggle
-

comments