diff options
Diffstat (limited to 'contrib/package')
18 files changed, 84 insertions, 536 deletions
diff --git a/contrib/package/community-profiles/files/etc/config/profile_berlin b/contrib/package/community-profiles/files/etc/config/profile_berlin index 1bfc8ed7d7..e1e4eda91b 100644 --- a/contrib/package/community-profiles/files/etc/config/profile_berlin +++ b/contrib/package/community-profiles/files/etc/config/profile_berlin @@ -33,7 +33,7 @@ config 'defaults' 'ssidscheme' config 'defaults' 'interface' option 'netmask' '255.255.255.255' - option 'dns' '85.214.20.141 213.73.91.35 194.150.168.168 2001:4ce8::53 2001:910:800::12' + option 'dns' '85.214.20.141 194.150.168.168 2001:4ce8::53 2001:910:800::12' config 'dhcp' 'dhcp' option leasetime '5m' diff --git a/contrib/package/community-profiles/files/etc/config/profile_cottbus b/contrib/package/community-profiles/files/etc/config/profile_cottbus index 6f395a1332..9b08acc256 100644 --- a/contrib/package/community-profiles/files/etc/config/profile_cottbus +++ b/contrib/package/community-profiles/files/etc/config/profile_cottbus @@ -31,7 +31,7 @@ config 'defaults' 'ssidscheme' config 'defaults' 'interface' option 'netmask' '255.255.255.255' - option 'dns' '85.214.20.141 213.73.91.35 194.150.168.168 2001:4ce8::53 2001:910:800::12' + option 'dns' '85.214.20.141 194.150.168.168 2001:4ce8::53 2001:910:800::12' config 'dhcp' 'dhcp' option 'leasetime' '5m' diff --git a/contrib/package/community-profiles/files/etc/config/profile_hannover b/contrib/package/community-profiles/files/etc/config/profile_hannover deleted file mode 100644 index 008b6c70e3..0000000000 --- a/contrib/package/community-profiles/files/etc/config/profile_hannover +++ /dev/null @@ -1,12 +0,0 @@ -config 'community' 'profile' - option 'name' 'Freifunk Hannover' - option 'homepage' 'http://hannover.freifunk.net' - option 'ssid' 'hannover.freifunk.net' - option 'mesh_network' '10.2.0.0/16' - option 'splash_network' '10.104.0.0/16' - option 'splash_prefix' '27' - option 'latitude' '52.38427' - option 'longitude' '9.74359' - -config 'defaults' 'wifi_iface' - option 'bssid' 'CA:FF:EE:CA:FF:EE' diff --git a/contrib/package/community-profiles/files/etc/config/profile_potsdam b/contrib/package/community-profiles/files/etc/config/profile_potsdam index c15624a9fd..84bbdfe528 100644 --- a/contrib/package/community-profiles/files/etc/config/profile_potsdam +++ b/contrib/package/community-profiles/files/etc/config/profile_potsdam @@ -1,19 +1,35 @@ config 'community' 'profile' option 'name' 'Freifunk Potsdam' option 'homepage' 'http://potsdam.freifunk.net' - option 'ssid' 'www.freifunk-potsdam.de' + option 'ssid' 'freifunk-potsdam.de' option 'mesh_network' '10.22.0.0/16' option 'splash_network' '192.168.22.0/24' option 'splash_prefix' '24' option 'latitude' '52.39349' option 'longitude' '13.06489' + option 'ipv6' '0' + +config 'defaults' 'interface' + option 'netmask' '255.255.0.0' + option 'dns' '85.214.20.141 194.150.168.168' + option 'delegate' '0' config 'defaults' 'wifi_device' option 'channel' '5' +config 'defaults' 'wifi_device_5' + option 'channel' '44' + config 'defaults' 'bssidscheme' option '5' '02:CA:FF:EE:BA:BE' + option '44' '02:CA:FF:EE:BA:BE' -config 'defaults' 'interface' - option 'dns' '85.214.20.141 213.73.91.35 194.150.168.168' +config 'defaults' 'ssidscheme' + option '5' 'Mesh23' + option '44' 'Mesh23' + +config 'defaults' 'dhcp' + option 'leasetime' '15m' +config 'defaults' 'olsrd' + option 'LinkQualityAlgorithm' 'etx_ffeth' diff --git a/contrib/package/community-profiles/files/etc/config/profile_tulumlibre b/contrib/package/community-profiles/files/etc/config/profile_tulumlibre index ecc6f9bc43..c028a66614 100644 --- a/contrib/package/community-profiles/files/etc/config/profile_tulumlibre +++ b/contrib/package/community-profiles/files/etc/config/profile_tulumlibre @@ -7,4 +7,4 @@ config 'community' 'profile' option 'splash_prefix' '28' config 'defaults' 'interface' - option 'dns' '213.73.91.35 216.87.84.211' + option 'dns' '216.87.84.211' diff --git a/contrib/package/freifunk-common/Makefile b/contrib/package/freifunk-common/Makefile index d9bbd994a1..f7128b6411 100644 --- a/contrib/package/freifunk-common/Makefile +++ b/contrib/package/freifunk-common/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=freifunk-common -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -15,6 +15,7 @@ define Package/freifunk-common CATEGORY:=LuCI SUBMENU:=9. Freifunk TITLE:=Freifunk common files + DEPENDS:=+libuci-lua endef define Package/freifunk-common/description diff --git a/contrib/package/freifunk-common/files/etc/config/freifunk b/contrib/package/freifunk-common/files/etc/config/freifunk index 9a46f056ad..b1a2e41e2a 100644 --- a/contrib/package/freifunk-common/files/etc/config/freifunk +++ b/contrib/package/freifunk-common/files/etc/config/freifunk @@ -104,12 +104,6 @@ config 'defaults' 'wifi_iface' option 'bssid' '12:CA:FF:EE:BA:BE' option 'mcast_rate' '6000' -config 'defaults' 'madwifi_wifi_iface' - option 'bgscan' '0' - option 'sw_merge' '1' - option 'probereq' '1' - option 'mcast_rate' '5500' - config 'defaults' 'interface' option 'netmask' '255.255.0.0' option 'dns' '8.8.8.8 212.204.49.83 141.1.1.1' diff --git a/contrib/package/freifunk-p2pblock/Makefile b/contrib/package/freifunk-p2pblock/Makefile deleted file mode 100644 index df7bd9b635..0000000000 --- a/contrib/package/freifunk-p2pblock/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# -# Copyright (C) 2009 Andreas Seidler <tetzlav@subsignal.org> -# Copyright (C) 2012 Jo-Philipp Wich <jow@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:=freifunk-p2pblock -PKG_RELEASE:=3 - -PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) - -include $(INCLUDE_DIR)/package.mk - -define Package/freifunk-p2pblock - SECTION:=luci - CATEGORY:=LuCI - SUBMENU:=9. Freifunk - TITLE:=Freifunk p2pblock Addon - DEPENDS:=+iptables-mod-filter +iptables-mod-ipp2p +l7-protocols +iptables-mod-conntrack-extra @BROKEN -endef - -define Package/freifunk-p2pblock/description - Simple Addon for Freifunk which use iptables layer7-, ipp2p- and recent-modules - to block p2p/filesharing traffic -endef - -define Build/Prepare - mkdir -p $(PKG_BUILD_DIR) -endef - -define Build/Configure -endef - -define Build/Compile -endef - -define Package/freifunk-p2pblock/install - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/freifunk-p2pblock.init $(1)/etc/init.d/freifunk-p2pblock - $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DATA) ./files/freifunk-p2pblock.config $(1)/etc/config/freifunk_p2pblock -endef - -$(eval $(call BuildPackage,freifunk-p2pblock)) diff --git a/contrib/package/freifunk-p2pblock/files/freifunk-p2pblock.config b/contrib/package/freifunk-p2pblock/files/freifunk-p2pblock.config deleted file mode 100644 index 291260e370..0000000000 --- a/contrib/package/freifunk-p2pblock/files/freifunk-p2pblock.config +++ /dev/null @@ -1,6 +0,0 @@ -config 'settings' 'p2pblock' - option 'portrange' '1024:65535' - option 'layer7' 'edonkey bittorrent fasttrack' - option 'ipp2p' 'edk dc kazaa gnu bit ares soul winmx apple' - option 'blocktime' '60' - option 'whitelist' '' diff --git a/contrib/package/freifunk-p2pblock/files/freifunk-p2pblock.init b/contrib/package/freifunk-p2pblock/files/freifunk-p2pblock.init deleted file mode 100644 index 5ca60c8916..0000000000 --- a/contrib/package/freifunk-p2pblock/files/freifunk-p2pblock.init +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/sh /etc/rc.common - -START=82 -ME="freifunk-p2pblock" -LOCK='/var/run/p2pblock.lock' - -# helper-scripts -ipt_add() { - logger -t "$ME" "set 'iptables -I $1'" - iptables -I $1 - echo "iptables -D $1" >> $LOCK -} - -start() { - /etc/init.d/freifunk-p2pblock enabled || return - - if [ ! -s "$LOCK" ]; then - logger -s -t "$ME" 'starting p2pblock...' - - config_load network - config_get wan wan ifname - - if [ -n "$wan" ]; then - config_load freifunk_p2pblock - config_get layer7 p2pblock layer7 - config_get ipp2p p2pblock ipp2p - config_get portrange p2pblock portrange - config_get blocktime p2pblock blocktime - config_get whitelist p2pblock whitelist - - # load modules - insmod ipt_ipp2p 2>&- - insmod ipt_layer7 2>&- - insmod ipt_recent ip_list_tot=400 ip_pkt_list_tot=3 2>&- - - # create new p2p-chain - iptables -N p2pblock - # pipe all incoming FORWARD with source-/destination-port 1024-65535 throu p2p-chain - ipt_add "FORWARD -i $wan -p tcp --sport $portrange --dport $portrange -j p2pblock" - ipt_add "FORWARD -i $wan -p udp --sport $portrange --dport $portrange -j p2pblock" - - # if p2p-traffic blocked 3 packages to a destination ip then block all traffic within the next 180 sec (port 1024-65535) - ipt_add "p2pblock -m recent --rdest --rcheck --name P2PBLOCK --seconds $blocktime --hitcount 3 -j DROP" - ipt_add "p2pblock -m recent --rdest --rcheck --name P2PBLOCK --seconds $blocktime --hitcount 3 -m limit --limit 1/minute -j LOG --log-prefix P2PBLOCK-DROP:" - - # create layer7-rules - for proto in $layer7; do - ipt_add "p2pblock -m layer7 --l7proto $proto -m recent --rdest --set --name P2PBLOCK" - ipt_add "p2pblock -m layer7 --l7proto $proto -m limit --limit 1/minute -j LOG --log-prefix P2PBLOCK-seen-$proto:" - done - - # create ipp2p-rules - for proto in $ipp2p; do - ipt_add "p2pblock -m ipp2p --$proto -m recent --rdest --set --name P2PBLOCK" - ipt_add "p2pblock -m ipp2p --$proto -m limit --limit 1/minute -j LOG --log-prefix P2PBLOCK-seen-$proto:" - done - - # insert whitelisted ips - for ip in $whitelist; do - ipt_add "p2pblock -d $ip -j RETURN" - done - - logger -s -t "$ME" 'Done.'; return 0 - else - logger -s -t "$ME" 'No wan interface present.'; return 0 - fi - else - logger -s -t "$ME" 'WARNING! already running - Aborting!'; return 2 - fi -} - -stop() { - if [ -s "$LOCK" ]; then - logger -s -t "$ME" 'stopping p2pblock...' - - # unset all rules in $LOCK-file - cat $LOCK | sed -ne '1!G;h;$p' | while read line; do - logger -t "$ME" "unset $line" - while eval $line 2>&-; do :; done - done; : > "$LOCK" - - # flush and delete the p2p-chain - iptables -F p2pblock - iptables -X p2pblock - logger -s -t "$ME" 'Done.'; return 0 - - else - logger -s -t "$ME" 'WARNING! not running - Aborting!'; return 2 - - fi -} - -restart() { - stop; sleep 1; start -} diff --git a/contrib/package/lucihttp/Makefile b/contrib/package/lucihttp/Makefile new file mode 100644 index 0000000000..408994435a --- /dev/null +++ b/contrib/package/lucihttp/Makefile @@ -0,0 +1,54 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=lucihttp +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL=https://github.com/jow-/lucihttp.git +PKG_SOURCE_DATE:=2018-05-18 +PKG_SOURCE_VERSION:=cb119deddee5f0f8f1da883b20c60aea7611b175 +PKG_MIRROR_HASH:=573a20817c73344b17c8fa1b8112f14af9dccc25fef017ae072ecd09140cf9e1 +CMAKE_INSTALL:=1 + +PKG_LICENSE:=ISC +PKG_LICENSE_FILES:=LICENSE + +PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io> +PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_liblucihttp-lua + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/liblucihttp + SECTION:=libs + CATEGORY:=Libraries + ABI_VERSION:=$(PKG_VERSION) + TITLE:=LuCI HTTP utility library +endef + +define Package/liblucihttp-lua + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=+liblucihttp +liblua + TITLE:=Lua binding for the LuCI HTTP utility library +endef + +TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include + +CMAKE_OPTIONS = \ + -DLUAPATH=/usr/lib/lua \ + -DBUILD_LUA=$(if $(CONFIG_PACKAGE_liblucihttp-lua),ON,OFF) \ + -DBUILD_TESTS=OFF + +define Package/liblucihttp/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblucihttp.so $(1)/usr/lib/ +endef + +define Package/liblucihttp-lua/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lua/lucihttp.so $(1)/usr/lib/lua/ +endef + +$(eval $(call BuildPackage,liblucihttp)) +$(eval $(call BuildPackage,liblucihttp-lua)) diff --git a/contrib/package/meshwizard/Makefile b/contrib/package/meshwizard/Makefile index 9ac5a06286..62983465c1 100644 --- a/contrib/package/meshwizard/Makefile +++ b/contrib/package/meshwizard/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=meshwizard -PKG_RELEASE:=0.3.2 +PKG_RELEASE:=0.3.3 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/rename-wifi.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/rename-wifi.sh index e9139ed510..f2d10cc9e2 100755 --- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/rename-wifi.sh +++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/rename-wifi.sh @@ -1,6 +1,6 @@ #!/bin/sh # This script renames IB_wifi_ interface names into real interface names used on this system. -# E.g. wireless.IB_wifi0 would become wireless.wifi0 on madwifi and wireless.radio0 on mac80211 +# E.g. wireless.IB_wifi0 would become wireless.radio0 on mac80211 . $dir/functions.sh diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh index 01a93874ab..9ebcb46b13 100755 --- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh +++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh @@ -73,7 +73,7 @@ setup_nameservice() { uci batch <<- EOF set $cfg.olsrd_nameservice=LoadPlugin - set $cfg.olsrd_nameservice.library="olsrd_nameservice.so.0.3" + set $cfg.olsrd_nameservice.library="olsrd_nameservice.so.0.4" set $cfg.olsrd_nameservice.latlon_file="$llfile" set $cfg.olsrd_nameservice.hosts_file="$hosts" set $cfg.olsrd_nameservice.sighup_pid_file="/var/run/dnsmasq.pid" @@ -118,7 +118,7 @@ setup_jsoninfo() { proto="$1" uci batch <<- EOF set $cfg.olsrd_jsoninfo=LoadPlugin - set $cfg.olsrd_jsoninfo.library="olsrd_jsoninfo.so.0.0" + set $cfg.olsrd_jsoninfo.library="olsrd_jsoninfo.so.1.1" EOF if [ "$proto" = "6" ]; then uci set $cfg.olsrd_jsoninfo.ipv6only='1' @@ -130,7 +130,7 @@ setup_txtinfo() { proto="$1" uci batch <<- EOF set $cfg.olsrd_txtinfo=LoadPlugin - set $cfg.olsrd_txtinfo.library="olsrd_txtinfo.so.0.1" + set $cfg.olsrd_txtinfo.library="olsrd_txtinfo.so.1.1" EOF if [ "$proto" = "6" ]; then uci set $cfg.olsrd_txtinfo.ipv6only='1' diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh index 41feb86651..707b7b72cd 100755 --- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh +++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh @@ -59,11 +59,6 @@ uci set wireless.$net\_iface=wifi-iface # create new wifi-iface for $net from defaults set_defaults "wifi_iface_" wireless.$net\_iface -# overwrite some settings for type atheros (madwifi) -if [ "$type" = "atheros" ]; then - set_defaults "madwifi_wifi_iface_" wireless.${net} -fi - # overwrite defaults bssid="$($dir/helpers/gen_bssid.sh $channel $community)" diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/supports_vap.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/supports_vap.sh index 0585ab5fe1..7fdff3c566 100755 --- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/supports_vap.sh +++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/supports_vap.sh @@ -8,9 +8,7 @@ if [ -z "$dev" -o -z "$type" ]; then exit 1 fi -if [ "$type" = "atheros" ]; then - exit 0 -elif [ "$type" = "mac80211" ]; then +if [ "$type" = "mac80211" ]; then # not hostapd[-mini], no VAP if [ ! -x /usr/sbin/hostapd ]; then echo "WARNING: hostapd[-mini] is required to be able to use VAP with mac80211." diff --git a/contrib/package/remote-update/Makefile b/contrib/package/remote-update/Makefile deleted file mode 100644 index 4f8b3a596b..0000000000 --- a/contrib/package/remote-update/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# -# Copyright (C) 2009 Jo-Philipp Wich <jow@openwrt.org> -# -# This is free software, licensed under the Apache 2.0 license. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=remote-update -PKG_RELEASE:=4 - -PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) - -include $(INCLUDE_DIR)/package.mk - -define Package/remote-update - SECTION:=luci - CATEGORY:=LuCI - SUBMENU:=9. Freifunk - TITLE:=Freifunk remote update utility. - DEPENDS:=@TARGET_atheros||@TARGET_ar71xx||@TARGET_brcm_2_4 -endef - -define Package/remote-update/description - The freifunk remote-update utility uses sysupgrade to reflash the currently - running firmware while keeping most of the existing configuratio. -endef - -define Build/Prepare - mkdir -p $(PKG_BUILD_DIR) -endef - -define Build/Configure -endef - -define Build/Compile -endef - -define Package/remote-update/install - $(CP) ./files/* $(1)/ -endef - -$(eval $(call BuildPackage,remote-update)) diff --git a/contrib/package/remote-update/files/usr/sbin/remote-update b/contrib/package/remote-update/files/usr/sbin/remote-update deleted file mode 100755 index 6e45e482be..0000000000 --- a/contrib/package/remote-update/files/usr/sbin/remote-update +++ /dev/null @@ -1,306 +0,0 @@ -#!/bin/sh - -local tempfile=/tmp/remote-upgrade.img -local D2='\([0-9]\{2\}\)' -local D4='\([0-9]\{4\}\)' -local NL=' -' - -find_architecture() -{ - local ifs="$IFS"; IFS="-" - set -- $(opkg list_installed kernel) - IFS="$ifs" - - echo "$3" -} - -find_image() -{ - case "$1" in - atheros) - echo "openwrt-atheros-combined.squashfs.img" - ;; - ar71xx) - echo "openwrt-ar71xx-combined.squashfs.img" - ;; - brcm) - echo "openwrt-brcm-2.4-squashfs.trx" - ;; - esac -} - -check_image() -{ - local file; for file in /lib/upgrade/*.sh; do . $file; done - if platform_check_image "$1" >/dev/null 2>/dev/null; then - return 0 - fi - return 1 -} - -find_remote_checksum() -{ - wget -qO- ${1%/*}/md5sums 2>/dev/null | \ - sed -ne '/'$2'/ { s/ .*//p }' -} - -find_local_checksum() -{ - set -- $(md5sum "$tempfile") - echo $1 -} - -find_remote_info() -{ - wget -qO- "${1%/*}/VERSION.txt" 2>/dev/null -} - -find_remote_version() -{ - find_remote_info "$1" | \ - sed -ne "s!.*$D4/$D2/$D2 $D2:$D2.*!\\1\\2\\3\\4\\5!p;t" -} - -find_local_version() -{ - if [ -f /rom/etc/banner ]; then - sed -ne "s!.*$D4/$D2/$D2 $D2:$D2.*!\\1\\2\\3\\4\\5!p;t" \ - /rom/etc/banner - else - date +"%Y%m%d%H%M" -r /bin/sh - fi -} - -stop_service() -{ - [ -x /etc/init.d/$1 ] && { - echo -n "Stopping service $1 ... " - /etc/init.d/$1 stop >/dev/null 2>/dev/null - echo "done" - } -} - -do_wait() -{ - if [ ${1:-0} -gt 0 ]; then - echo -n "${2:-Waiting} " - for i in $(seq 1 $1); do - printf "%-2dseconds" $(($1-$i)) - sleep 1 - echo -en "\b\b\b\b\b\b\b\b\b" - done - echo "${NL}" - fi -} - -version_compare() -{ - local v1="$1" - local v2="$2" - - while [ -n "$v1" -o -n "$v2" ]; do - if [ -z "${v2:0:4}" -o "${v1:0:4}" -gt "${v2:0:4}" ]; then - return 1 - elif [ -z "${v1:0:4}" -o "${v1:0:4}" -lt "${v2:0:4}" ]; then - return 2 - fi - - v1="${v1:4}" - v2="${v2:4}" - done - - return 0 -} - -usage() -{ - cat <<EOT - -Usage: - remote-update -h - remote-update [-u <update url>] -c - remote-update [-v] [-y] [-u <update url>] -w - remote-update [-d] [-n] [-v] [-y] [-s <sleep seconds>] [-u <update url>] - -Actions: - -h Display this help message and exit. - -c Check for firmware update and exit. - -w Fetch image and exit, do not perform flash write. - -Options: - -d Do not detach from terminal. - -n Do not backup configuration. - -v Skip verification of downloaded image. - -y Assume defaults for all questions. - - -s <seconds> - Sleep given amount of seconds before starting flash write. - If ommitted and '-y' is not used, 5 seconds are assumed. - - -u <url> - Fetch firmware image from given url. A file "md5sums" is expected - in the same remote directory. If there is no such file, use -v to - suppress verification. - -EOT - - exit 1 -} - - -while getopts "s:u:cdnvwyh" flag; do - case $flag in - s) sleeptime="$OPTARG";; - u) updateurl="$OPTARG";; - c) checkupdate=1;; - d) nodetach=1;; - n) nobackup=1;; - v) noverify=1;; - w) noflash=1;; - y) noquestions=1;; - *) usage;; - esac -done - - -local image_url="$updateurl" -local image_name="${image_url##*/}" - -[ -z "$image_url" ] && { - local arch=$(find_architecture) - local image=$(find_image "$arch") - local repo=$(uci get freifunk.upgrade.repository 2>/dev/null) - repo=${repo:-$(uci get system.upgrade.repository 2>/dev/null)} - - [ -z "$arch" ] && { - echo "Can not determine the current architecture." - exit 1 - } - - [ -z "$repo" ] && { - echo "No repository configured in 'system.upgrade.repository'." - echo "Use the '-u' flag to specify an image location." - exit 1 - } - - [ -z "$image" ] && { - echo "No suitable image for the '$arch' architecture." - echo "Your platform is not supported." - exit 1 - } - - echo "Architecture: $arch" - echo "Repository: $repo" - - image_name="$image" - image_url="${repo%/}/$arch/$image" -} - - -if [ "$checkupdate" = 1 ]; then - local v1=$(find_local_version) - local v2=$(find_remote_version "$image_url") - - [ -n "$v1" -a -n "$v2" ] && { - version_compare "$v1" "$v2" - [ $? == 2 ] && { - echo "Update available!${NL}Local: $v1${NL}Remote: $v2${NL}--" - find_remote_info "$image_url" - exit 0 - } || { - echo "Local version $v1 is up to date" - exit 2 - } - } || { - echo "No remote time stamp found." - exit 1 - } -else - if [ "$noquestions" != 1 ]; then - echo -n "${NL}About to download $image_name. Continue? [y] " - read answer - case "$answer" in - [nN]) exit 1;; - esac - fi - - echo -n "Downloading $image_name ... " - rm -f $tempfile - wget -qO $tempfile "$image_url" 2>/dev/null - [ $? == 0 ] && echo done || { - echo failed - rm -f $tempfile - exit 1 - } - - if [ "$noverify" != 1 ]; then - echo -n "Verifying $image_name ... " - - local md5_remote=$(find_remote_checksum "$image_url" "$image_name") - local md5_local=$(find_local_checksum) - - check_image "$tempfile" - local image_ok=$? - - if [ $image_ok = 0 -a -n "$md5_remote" -a -n "$md5_local" -a "$md5_remote" = "$md5_local" ]; then - echo "done" - else - if [ $image_ok != 0 ]; then - echo "unsupported image type" - else - echo "checksum mismatch! (local:${md5_local:-(none)} remote:${md5_remote:-(none)})" - fi - - local answer=n - if [ "$noquestions" != 1 ]; then - echo -n "${NL}Verification failed. Continue anyway? [n] " - read answer - fi - - case "$answer" in - [yYjJ]*) : ;; - *) - echo "Aborting." - rm -f $tempfile - exit 1 - ;; - esac - fi - fi - - if [ "$noflash" != 1 ]; then - if [ -f "$tempfile" ]; then - if [ "$noquestions" == 1 ]; then - do_wait ${sleeptime:-5} "${NL}About to start flashing, hit <Ctrl-C> to abort!${NL}${NL}Starting in" - else - if [ -z "$nobackup" ]; then - echo -n "${NL}Keep configuration files? [y] " - read answer - case "$answer" in - [nN]) nobackup=1;; - esac - fi - - echo -n "${NL}About to start flashing!${NL}Hit <Enter> to continue or <Ctrl-C> to abort.${NL}" - read answer - fi - - for s in lucid collectd; do stop_service $s; done - - if [ "$nodetach" != 1 ]; then - echo -n "Starting sysupgrade in background ... " - /bin/busybox start-stop-daemon -S -b -x /sbin/sysupgrade -- ${nobackup:+-n} "$tempfile" - echo "done" - else - echo "Executing sysupgrade ... " - exec /sbin/sysupgrade ${nobackup:+-n} "$tempfile" - fi - else - echo "No upgrade image found!" - exit 1 - fi - else - echo "Image saved in '$tempfile'" - fi -fi |