beb9e5c3541117b68055403903e91b028cf818b9
[openwrt/svn-archive/archive.git] / net / proftpd / Makefile
1 #
2 # Copyright (C) 2009-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=proftpd
11 PKG_VERSION:=1.3.3
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=ftp://ftp.proftpd.org/distrib/source
16 PKG_MD5SUM:=3951244f1940f0a40e8af142a9cf67fe
17
18 PKG_FIXUP:=libtool
19 PKG_INSTALL:=1
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/proftpd
24 SUBMENU:=FTP
25 SECTION:=net
26 CATEGORY:=Network
27 TITLE:=ProFTPD FTP server
28 URL:=http://www.proftpd.org/
29 endef
30
31 define Package/proftpd/conffiles
32 /etc/proftpd.conf
33 endef
34
35 TARGET_CPPFLAGS += \
36 -I$(LINUX_DIR)/include
37
38 MAKE_FLAGS += \
39 INSTALL_USER=$(shell id -u) \
40 INSTALL_GROUP=$(shell id -g)
41
42 CONFIGURE_ARGS += \
43 --disable-cap \
44 --enable-devel \
45
46 define Package/proftpd/install
47 $(INSTALL_DIR) $(1)/etc
48 $(if $(CONFIG_IPV6),,$(SED) 's/^UseIPv6/#UseIPv6/' $(PKG_INSTALL_DIR)/etc/proftpd.conf)
49 $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/proftpd.conf $(1)/etc/
50 $(INSTALL_DIR) $(1)/etc/init.d
51 $(INSTALL_BIN) ./files/proftpd.init $(1)/etc/init.d/proftpd
52 $(INSTALL_DIR) $(1)/usr/bin
53 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ftp{count,top,who} $(1)/usr/bin/
54 $(INSTALL_DIR) $(1)/usr/sbin
55 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{ftpshut,proftpd} $(1)/usr/sbin/
56 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/in.proftpd $(1)/usr/sbin/
57 endef
58
59 define Package/proftpd/postinst
60 #!/bin/sh
61
62 name=ftp
63 id=55
64 home=/home/$${name}
65 shell=/bin/ash
66
67 # do not change below
68 # # check if we are on real system
69 if [ -z "$${IPKG_INSTROOT}" ]; then
70 # create copies of passwd and group, if we use squashfs
71 rootfs=`mount |awk '/root/ { print $$5 }'`
72 if [ "$$rootfs" = "squashfs" ]; then
73 if [ -h /etc/group ]; then
74 rm /etc/group
75 cp /rom/etc/group /etc/group
76 fi
77 if [ -h /etc/passwd ]; then
78 rm /etc/passwd
79 cp /rom/etc/passwd /etc/passwd
80 fi
81 fi
82 fi
83
84 echo ""
85 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
86 echo "adding group $$name to /etc/group"
87 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
88 fi
89
90 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
91 echo "adding user $$name to /etc/passwd"
92 echo "$${name}:x:$${id}:$${id}:$${name}:$${home}:$${shell}" >> $${IPKG_INSTROOT}/etc/passwd
93 fi
94 endef
95
96 $(eval $(call BuildPackage,proftpd))