On 2009-12-21 1:28 AM, Daniel A. Nagy wrote: > I would like to contribute a package to OpenWrt that we have developed and > successfully use commercially. I believe that having it included in official > OpenWrt distribution would benefit both projects. > > With this package, an OpenWrt-based router provides time-restricted internet > access in exchange for single-use codes. Tickets with these codes (called > ePoint > RANDs) can be printed from the administrative web interface. Accounting is > also > included. More on ePoint HotSpot here: > https://www.epointsystem.org/trac/vending_machine/wiki/HotSpot > > The package depends on two other packages (qrencode and code128b) responsible > for generating bar codes that appear on the tickets. Patches for those will > follow immediately. > > A minor problem with building the package is that it shows up in menuconfig > after selecting zlib, libgcrypt, libopencdk and xinetd *in this particular > order*. If these same packages are selected in a different order, our package > may not show up in menuconfig. > > Signed-off-by: Daniel A. Nagy <[email protected]> Hi Daniel,
Some comments about issues that I found during superficial review: > Index: net/epoint/files/CONTROL/postinst > =================================================================== > --- net/epoint/files/CONTROL/postinst (revision 0) > +++ net/epoint/files/CONTROL/postinst (revision 0) > @@ -0,0 +1,57 @@ > [...] preinst, postinst, prerm, conffiles, etc. files should be defined inline in the package makefile using something like this: define Package/<name>/postinst [...] endef > + > +grep -q epoint $IPKG_INSTROOT/etc/services || \ > + echo 'epoint 8080/tcp' >> $IPKG_INSTROOT/etc/services > + > +if [ -n "$IPKG_INSTROOT" ]; then > + touch $IPKG_INSTROOT/etc/epoint_firstboot > + > + CONF="$IPKG_INSTROOT/etc/opkg.conf" > + # XXX This is ugly hack. We should force offline installation of opkg > + # to happen before us, or fetch and modify opkg.conf somehow. > + if [ -f "$CONF" ]; then > + grep -q epoint "$CONF" || \ > + echo 'src epoint http://www.epointsystem.org/openwrt/packages' >> > "$CONF" > + else > + cat > "$CONF" <<EOF > +src/gz snapshots > http://downloads.openwrt.org/kamikaze/8.09.1/brcm-2.4/packages > +src epoint http://www.epointsystem.org/openwrt/packages > +dest root / > +dest ram /tmp > +lists_dir ext /var/opkg-lists > +option overlay_root /jffs > +EOF > + fi > + > + mkdir -p $IPKG_INSTROOT/etc/uci-defaults > + cat > $IPKG_INSTROOT/etc/uci-defaults/epoint <<DATA > +#!/bin/sh > + > +uci batch <<-EOF > + set luci.main.mediaurlbase=/luci-static/epoint > + commit > +EOF > +DATA > + chmod 755 $IPKG_INSTROOT/etc/uci-defaults/epoint > +fi > + > +if [ -z "$IPKG_INSTROOT" ]; then > + . /etc/functions.sh > + for m in /etc/modules.d/*ipt*; do > + load_modules `basename $m` > + done > + > + rm -f /tmp/luci-indexcache > + rm -f /tmp/luci-modulecache/* > + rm -rf /tmp/luci-templatecache/* > + > + /etc/init.d/xinetd enable > + /etc/init.d/xinetd restart > + /etc/init.d/matrixhttps enable > + /etc/init.d/matrixhttps start > + /etc/init.d/epoint enable > + /etc/init.d/epoint start > + > + ACTION=ifup /etc/hotplug.d/iface/40-hotspot-dns > +fi > +exit 0 Some of this is probably easier to handle by installing a script into /etc/uci-defaults, which will make it run on first boot only (or on the next reboot if you're installing it on the device). You could then also trigger the uci-defaults apply in the postinst script of the package by calling . /etc/functions.sh; uci_apply_defaults > Index: net/epoint/files/CONTROL/prerm > =================================================================== > --- net/epoint/files/CONTROL/prerm (revision 0) > +++ net/epoint/files/CONTROL/prerm (revision 0) > @@ -0,0 +1,8 @@ > [...] See above. > Index: net/epoint/files/www/epoint-static/epoint.png > =================================================================== > Cannot display: file marked as a binary type. > svn:mime-type = application/octet-stream This will have to be handled separately once we've decided whether we will merge this package into OpenWrt, or you guys maintain a separate feed for your packages. > Index: net/epoint/files/etc/ssl/privkey.pem > =================================================================== > --- net/epoint/files/etc/ssl/privkey.pem (revision 0) > +++ net/epoint/files/etc/ssl/privkey.pem (revision 0) > @@ -0,0 +1,15 @@ > +-----BEGIN RSA PRIVATE KEY----- > +MIICXAIBAAKBgQCtLD47gEHZbkW0PZvZm2J+1XbQL/qLP+cojfKNDdunwpdTDdEN > +QCXeZ1dHh0Uy+aS5dHpqsDDO/bCpD7qLT30l6WhZvuNvDcdbr8rD7SR3uoP12F+3 > +vgeLyGKtdJhQL73Ya55zPHcIRKUuGQwgSbdP22IX1Yeb/mGnkGWP2xboTQIDAQAB > +AoGAU2X9SpaIH/i1ZQpOpkvo8YBIShbxKGLMJoHGEBxebrqOOhdrWGBOXH+UTwRc > +VSJZLF9mHT9hIi6XB7RleHX9pJtKsS4fVcn3pm52NhH7UYFB4Y0AHhEWk6Wtcz64 > +uu+WPV1zh6kvCuGyTTFIlO9mbIafaJ5ON9DEewGUCYe+VIECQQDflxfGDbmtL1r3 > +/BTAYWeQc3K5m9B7bAtU/ZSgdQbHpQ/9H/r2gy8/fx6OfNYTKAXm6MkQQcdP1yGt > +Nc1xn4sxAkEAxkZHmC4BewYlr+bqaopa5QMjgBV91u/AyQnTBhoXdNZ5yihSX26A > +hdxnyuHG9fPZk5BdiPPT0GTjw4+0K7nv3QJBAIoHcou3qWp6k4QHwJ/LAe4w9yAS > +SrAG0TAUo44y8I6LHcW72mgYMDDYvvpjopyM1qfoCUfZ87scKhQN5NhCD+ECQGi6 > +BmbjJfUNMirPFVJg8dG07rNgpq84w+NsRQIcFfeosXuOALRXcZtC56/JwYV335yJ > +zF3iLCcOox9QcCIIfCECQA/78ix1fak4H6duD01a1RkSJf5hoJkGPqsB4r7AU578 > +taWLaEBbm/oaKdDdqxO5YQwfoNwu/Id7PEf4/0D1Gh4= > +-----END RSA PRIVATE KEY----- > Index: net/epoint/files/etc/ssl/cert.pem > =================================================================== > --- net/epoint/files/etc/ssl/cert.pem (revision 0) > +++ net/epoint/files/etc/ssl/cert.pem (revision 0) > @@ -0,0 +1,17 @@ > +-----BEGIN CERTIFICATE----- > +MIICrTCCAhagAwIBAgIJAJOWV2ZD7gtFMA0GCSqGSIb3DQEBBQUAMEQxHDAaBgNV > +BAoTE2VQb2ludCBTeXN0ZW1zIEx0ZC4xJDAiBgkqhkiG9w0BCQEWFWluZm9AZXBv > +aW50c3lzdGVtLm9yZzAeFw0wOTAzMjExMzUzNTlaFw0xMjAzMjAxMzUzNTlaMEQx > +HDAaBgNVBAoTE2VQb2ludCBTeXN0ZW1zIEx0ZC4xJDAiBgkqhkiG9w0BCQEWFWlu > +Zm9AZXBvaW50c3lzdGVtLm9yZzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA > +rSw+O4BB2W5FtD2b2ZtiftV20C/6iz/nKI3yjQ3bp8KXUw3RDUAl3mdXR4dFMvmk > +uXR6arAwzv2wqQ+6i099JeloWb7jbw3HW6/Kw+0kd7qD9dhft74Hi8hirXSYUC+9 > +2Gueczx3CESlLhkMIEm3T9tiF9WHm/5hp5Blj9sW6E0CAwEAAaOBpjCBozAdBgNV > +HQ4EFgQUeFzQeumXAre1yBks4j0I4RCi7PwwdAYDVR0jBG0wa4AUeFzQeumXAre1 > +yBks4j0I4RCi7PyhSKRGMEQxHDAaBgNVBAoTE2VQb2ludCBTeXN0ZW1zIEx0ZC4x > +JDAiBgkqhkiG9w0BCQEWFWluZm9AZXBvaW50c3lzdGVtLm9yZ4IJAJOWV2ZD7gtF > +MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAp84vYKYgJiHNd2p+Pkc0 > +vOGT37dRXV8hQofKf3Mra4PP2zwftsc+bMZ22qXuBKdQm06dTO4u+U8WL/MhlBVB > +y8fe4xcOeuB7hdlOClouLEAiR1AffaXfthOgdDtBLt3gsxbT0eA3MHuQ4B8z4Zxm > +mXosmLLk6bOdOeddRAQmpEg= > +-----END CERTIFICATE----- You may want to generate these either on the device or at least on the host, if you're using these in a place where security matters. > Index: net/epoint/Makefile > =================================================================== > --- net/epoint/Makefile (revision 0) > +++ net/epoint/Makefile (revision 0) > @@ -0,0 +1,56 @@ > +include $(TOPDIR)/rules.mk > + > +PKG_NAME:=epoint > +PKG_VERSION:=0.4.13 > +PKG_RELEASE:=1 > + > +include $(INCLUDE_DIR)/package.mk > + > +define Package/epoint > + SECTION:=net > + CATEGORY:=Network > + TITLE:=ePoint vending machine for public Wi-Fi networks > + MAINTAINER:=ePoint Systems Ltd <[email protected]> > + DEPENDS:=+iptables-utils +iptables-mod-nat +iptables-mod-nat-extra > +libopencdk +xinetd +matrixtunnel +luci-core +luci-admin-core +luasocket > +qrencode +code128b +ntpclient > +endef > + > +define Package/epoint/description > + ePoint vending machine for public Wi-Fi networks > +endef > + > +define Package/epoint/conffiles > +/etc/epoint.issuers > +/etc/tariffs > +/etc/config/epoint > +/etc/ssl/privkey.pem > +/etc/ssl/cert.pem > +/usr/lib/epoint/templates/error > +/usr/lib/epoint/templates/form > +/usr/lib/epoint/templates/rand.lua > +/usr/lib/epoint/templates/splash-redir > +/usr/lib/epoint/templates/time-remaining > +/usr/lib/epoint/templates/upload-form > +endef > + > +define Build/Prepare > + mkdir -p $(PKG_BUILD_DIR) > + make -C ./src clean > + $(CP) ./src/* $(PKG_BUILD_DIR) > +endef > + > +define Package/epoint/install > + tar c -C ./files . --exclude .svn --exclude '*~' | tar x -C $(1) > + $(INSTALL_DIR) $(1)/usr/bin > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/urldecode $(1)/usr/bin/ > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/epoint $(1)/usr/bin > + ln -sf epoint $(1)/usr/bin/epoint_rand > + ln -sf epoint $(1)/usr/bin/epoint_ticket > + > + $(INSTALL_DIR) $(1)/usr/lib/lua > + $(INSTALL_DIR) $(1)/usr/lib/lua/epoint > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/crypto.so $(1)/usr/lib/lua/ > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/util.so $(1)/usr/lib/lua/epoint/ > + tar c -C ./luasrc . --exclude .svn --exclude '*~' | tar x -C > $(1)/usr/lib/lua > +endef You should use $(TAR) instead of tar to keep it more portable. - Felix _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
