[packages] ap51-flash: update ap51-flash and add loop option
The newer ap51-flash version and updated scripts will fix a problem on big-endian machines and uses a lot less memory (libpcap is not required anymore, no more image-buffering). A loop-script per ap51-flash instance will take care of restarting the app if selected in uci-config file. git-svn-id: svn://svn.openwrt.org/openwrt/packages@20374 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
c14f4648e2
commit
162b7ed745
@ -7,7 +7,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ap51-flash
|
||||
PKG_REV:=195
|
||||
PKG_REV:=232
|
||||
PKG_VERSION:=r$(PKG_REV)
|
||||
PKG_RELEASE:=1
|
||||
|
||||
@ -19,22 +19,34 @@ PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifeq ($(CONFIG_BIG_ENDIAN),y)
|
||||
STAMP_BUILT:=$(STAMP_BUILT)_big
|
||||
endif
|
||||
|
||||
define Package/ap51-flash
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=A tool for flashing (nearly) all ap51/ap61 based routers
|
||||
URL:=http://dev.open-mesh.com/wiki/ap51-flash-station
|
||||
DEPENDS:=+libpcap
|
||||
endef
|
||||
|
||||
TARGET_EXTRA_CFLAGS:=-DFLASH_FROM_FILE -DNO_LIBPCAP
|
||||
ifeq ($(CONFIG_BIG_ENDIAN),y)
|
||||
TARGET_EXTRA_CFLAGS:=$(TARGET_EXTRA_CFLAGS) -DUIP_CONF_BYTE_ORDER=1234
|
||||
endif
|
||||
|
||||
# pass optimization flags
|
||||
MAKE_FLAGS += \
|
||||
OFLAGS="$(TARGET_CFLAGS)" \
|
||||
EXTRA_CFLAGS="$(TARGET_EXTRA_CFLAGS)" \
|
||||
REVISION="$(PKG_VERSION)" \
|
||||
|
||||
define Package/ap51-flash/install
|
||||
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d $(1)/usr/sbin \
|
||||
$(1)/usr/lib/ap51-flash
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ap51-flash $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/ap51-flash.init $(1)/etc/init.d/ap51-flash
|
||||
$(INSTALL_BIN) ./files/ap51-flash.sh $(1)/usr/lib/ap51-flash/ap51-flash.sh
|
||||
$(INSTALL_DATA) ./files/ap51-flash.conf $(1)/etc/config/ap51-flash
|
||||
endef
|
||||
|
||||
|
@ -2,4 +2,5 @@
|
||||
# option ifname eth0.1
|
||||
# option rootfs /tmp/images/openwrt-atheros-root.squashfs
|
||||
# option kernel /tmp/images/openwrt-atheros-vmlinux.lzma
|
||||
## option ubnt /tmp/images/openwrt-atheros-ubnt5-squashfs.bin
|
||||
# option ubnt /tmp/images/openwrt-atheros-ubnt5-squashfs.bin
|
||||
## option loop '1'
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2007 OpenWrt.org
|
||||
# Copyright (C) 2010 OpenWrt.org
|
||||
|
||||
START=20
|
||||
|
||||
@ -8,22 +8,23 @@ NAME=ap51-flash
|
||||
start_daemon() {
|
||||
local cfg="$1"
|
||||
|
||||
config_get_bool loop "$cfg" loop
|
||||
config_get ifname "$cfg" ifname
|
||||
config_get rootfs "$cfg" rootfs
|
||||
config_get kernel "$cfg" kernel
|
||||
config_get ubntimg "$cfg" ubntimg
|
||||
if [ -n "$ifname" -a -n "$rootfs" -a -n "$kernel" ]; then
|
||||
[ -n "`ls /var/run/$NAME-$ifname.pid 2> /dev/null`" ] && {
|
||||
config_get ubnt "$cfg" ubnt
|
||||
[ "$loop" != "1" ] && loop=0
|
||||
if [ -n "$ifname" -a -n "$rootfs" -a -n "$kernel" ] || \
|
||||
[ -n "$ifname" -a -n "$ubnt" ]; then
|
||||
PID="`cat /var/run/$NAME.sh-$ifname.pid 2> /dev/null`"
|
||||
[ -z "`ps | grep "^.[ ]*$PID "`" ] && \
|
||||
rm /var/run/$NAME.sh-$ifname.pid
|
||||
[ -n "`ls /var/run/$NAME.sh-$ifname.pid 2> /dev/null`" ] && {
|
||||
echo "Can't start more than one ap51-flash for interface $ifname!"
|
||||
return 0
|
||||
}
|
||||
start-stop-daemon -S -b -m -p /var/run/$NAME-$ifname.pid -n $NAME -x /usr/sbin/$NAME -- $ifname $rootfs $kernel
|
||||
elif [ -n "$ifname" -a -n "$ubntimg" ]; then
|
||||
[ -n "`ls /var/run/$NAME-$ifname-ubnt.pid 2> /dev/null`" ] && {
|
||||
echo "Can't start more than one ap51-flash (ubnt) for interface $ifname!"
|
||||
return 0
|
||||
}
|
||||
start-stop-daemon -S -b -m -p /var/run/$NAME-$ifname-ubnt.pid -n $NAME -x /usr/sbin/$NAME -- $ifname $ubntimg
|
||||
start-stop-daemon -S -b -m -p /var/run/$NAME.sh-$ifname.pid -n $NAME.sh \
|
||||
-x /usr/lib/ap51-flash/$NAME.sh -- "$loop" "$ifname" "$rootfs" "$kernel" "$ubnt"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -38,6 +39,10 @@ stop() {
|
||||
echo "OR you can stop this with Ctrl+c within 10 seconds"
|
||||
sleep 10
|
||||
local pidfile
|
||||
for pidfile in `ls /var/run/${NAME}.sh-*.pid 2> /dev/null`; do
|
||||
start-stop-daemon -K -s TERM -p "${pidfile}" -n "${NAME}.sh" >/dev/null
|
||||
rm -f "${pidfile}"
|
||||
done
|
||||
for pidfile in `ls /var/run/${NAME}-*.pid 2> /dev/null`; do
|
||||
start-stop-daemon -K -s TERM -p "${pidfile}" -n "${NAME}" >/dev/null
|
||||
rm -f "${pidfile}"
|
||||
|
21
utils/ap51-flash/files/ap51-flash.sh
Executable file
21
utils/ap51-flash/files/ap51-flash.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
NAME=ap51-flash
|
||||
rootfs=""
|
||||
kernel=""
|
||||
ubnt=""
|
||||
|
||||
[ $1 -eq "1" ] && loop="1"
|
||||
ifname="$2"
|
||||
[ -n "$3" ] && rootfs="--rootfs $3"
|
||||
[ -n "$4" ] && kernel="--kernel $4"
|
||||
[ -n "$5" ] && ubnt="--ubnt $5"
|
||||
|
||||
while [ 1 ]; do
|
||||
start-stop-daemon -S -m -p /var/run/$NAME-$ifname.pid -n $NAME \
|
||||
-x /usr/sbin/$NAME -- --flash-from-file $rootfs $kernel $ubnt $ifname
|
||||
|
||||
rm /var/run/$NAME-$ifname.pid
|
||||
[ "$loop" != "1" ] && break
|
||||
sleep 15
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user