diff --git a/Makefile b/Makefile index 72e75f9..03fea4d 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ IncludeWithNewlines = $(subst # Name and release number of this package PKG_NAME := wifibox PKG_VERSION := 0.1.0 -PKG_RELEASE := 3 +PKG_RELEASE := 4 # This specifies the directory where we're going to build the program. # The root build directory, $(BUILD_DIR), is by default the build_mipsel diff --git a/extra/create-packages-dir.sh b/extra/create-packages-dir.sh new file mode 100755 index 0000000..1e45166 --- /dev/null +++ b/extra/create-packages-dir.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +OPENWRT_BASE=/Volumes/openwrt-image-10gb/openwrt +PKG_SRC_DIR=$OPENWRT_BASE/bin/ar71xx/packages +PKG_DEST_DIR=wifibox-packages +MAKE_INDEX_SCRIPT=$OPENWRT_BASE/scripts/ipkg-make-index.sh +INDEX_FILE=Packages +INDEX_GZ_FILE=Packages.gz + +if [ "x$1" == "x-h" ]; then + echo "This script creates a directory with wifibox ipk files found in the openWrt build environment." + echo "If specified, the -z option also compresses the result." + exit +fi + +if [ ! -d $PKG_DEST_DIR ]; then mkdir $PKG_DEST_DIR; fi +cp $PKG_SRC_DIR/wifibox*.ipk $PKG_DEST_DIR +cd $PKG_DEST_DIR +rm -f $INDEX_FILE +rm -f $INDEX_GZ_FILE + + +# NOTE: the aliasing construct in the indexing script does not work (and even then, the md5 command defaults to a different output format), so we hack around it here. +MD5_HACK_ENABLED=0 +which md5sum >/dev/null 2>&1 +if [ $? -eq 1 ]; then + MD5_HACK_ENABLED=1 + TEMPBIN_DIR=/tmp/tempbin23QQDBR + mkdir $TEMPBIN_DIR + + cat < $TEMPBIN_DIR/md5sum +`type -p md5` -q \$1 +EOF + + chmod +x $TEMPBIN_DIR/md5sum + PATH=$PATH:$TEMPBIN_DIR +fi + +$MAKE_INDEX_SCRIPT . > $INDEX_FILE + +if [ $MD5_HACK_ENABLED -eq 1 ]; then + rm $TEMPBIN_DIR/md5sum + rmdir $TEMPBIN_DIR +fi + + +gzip -c $INDEX_FILE > $INDEX_GZ_FILE + +if [ "x$1" == "x-z" ]; then + cd .. + echo "Compressing generated package directory..." + tar czvf $PKG_DEST_DIR.tgz $PKG_DEST_DIR +fi