fix some more postinst brokenness
[openwrt/svn-archive/archive.git] / net / atftp / Makefile
1 # Copyright (C) 2006 OpenWrt.org
2 #
3 # This is free software, licensed under the GNU General Public License v2.
4 # See /LICENSE for more information.
5 #
6 # $Id$
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=atftp
11 PKG_VERSION:=0.7
12 PKG_RELEASE:=1
13 PKG_MD5SUM:=3b27365772d918050b2251d98a9c7c82
14
15 PKG_SOURCE_URL:=ftp://ftp.mamalinux.com/pub/atftp/
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17 PKG_CAT:=zcat
18
19 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
20 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/atftp
25 SECTION:=net
26 CATEGORY:=Network
27 DEPENDS:=+libreadline +libpcre
28 MENU:=1
29 TITLE:=TFTP client
30 DESCRIPTION:=TFTP client
31 URL:=ftp://ftp.mamalinux.com/pub/atftp/
32 endef
33
34 define Package/atftpd
35 SECTION:=net
36 CATEGORY:=Network
37 DEPENDS:=atftp +libreadline +libpcre
38 TITLE:=TFTP server
39 DESCRIPTION:=TFTP server
40 URL:=ftp://ftp.mamalinux.com/pub/atftp/
41 endef
42
43 define Package/atftpd/postinst
44 #!/bin/sh
45 grep -q '^tftp[[:space:]]*69/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
46 if [ $$? -ne 0 ]; then
47 echo "tftp 69/tcp" >>$${IPKG_INSTROOT}/etc/services
48 echo "tftp 69/udp" >>$${IPKG_INSTROOT}/etc/services
49 echo "tftp-mcast 1758/tcp" >>$${IPKG_INSTROOT}/etc/services
50 echo "tftp-mcast 1758/udp" >>$${IPKG_INSTROOT}/etc/services
51 fi
52 endef
53
54 define Build/Compile
55 rm -rf $(PKG_INSTALL_DIR)
56 mkdir -p $(PKG_INSTALL_DIR)
57 $(MAKE) -C $(PKG_BUILD_DIR) \
58 $(TARGET_CONFIGURE_OPTS) \
59 CFLAGS="$(TARGET_CFLAGS) -Wall -D_REENTRANT" \
60 DESTDIR=$(PKG_INSTALL_DIR) \
61 all install
62 endef
63
64 define Package/atftp/install
65 install -m0755 -d $(1)/usr/sbin
66 $(CP) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin
67 endef
68
69 define Package/atftpd/install
70 install -m0755 -d $(1)/usr/sbin
71 $(CP) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
72 endef
73
74 $(eval $(call BuildPackage,atftp))
75 $(eval $(call BuildPackage,atftpd))