fix tor postinst script
[openwrt/svn-archive/archive.git] / net / tor / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=tor
12 PKG_VERSION:=0.1.0.17
13 PKG_RELEASE:=1
14 PKG_MD5SUM:=83c4afe29fa82473afcb2ec7e17771b9
15
16 PKG_SOURCE_URL:=http://tor.eff.org/dist/ \
17 http://ftp.se.linux.org/crypto/tor/ \
18 http://tor.meulie.net/
19 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
20 PKG_CAT:=zcat
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
23 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
24
25 include $(INCLUDE_DIR)/package.mk
26
27 define Package/tor
28 SECTION:=net
29 CATEGORY:=Network
30 DEPENDS:=+libevent +libopenssl +libpthread +zlib
31 TITLE:=An anonymous Internet communication system
32 DESCRIPTION:=Tor is a toolset for a wide range of organizations and people that want\\\
33 to improve their safety and security on the Internet. Using Tor can\\\
34 help you anonymize web browsing and publishing, instant messaging,\\\
35 IRC, SSH, and more. Tor also provides a platform on which software\\\
36 developers can build new applications with built-in anonymity, safety,\\\
37 and privacy features.\\\
38 URL:=http://tor.eff.org/
39 endef
40
41 define Package/tor/conffiles
42 /etc/tor/torrc
43 endef
44
45 define Package/tor/postinst
46 #!/bin/sh
47
48 name=tor
49 id=52
50
51 # do not change below
52 # # check if we are on real system
53 if [ -z "$${IPKG_INSTROOT}" ]; then
54 # create copies of passwd and group, if we use squashfs
55 rootfs=`mount |awk '/root/ { print $$5 }'`
56 if [ "$$rootfs" = "squashfs" ]; then
57 if [ -h /etc/group ]; then
58 rm /etc/group
59 cp /rom/etc/group /etc/group
60 fi
61 if [ -h /etc/passwd ]; then
62 rm /etc/passwd
63 cp /rom/etc/passwd /etc/passwd
64 fi
65 fi
66 fi
67
68 echo ""
69 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
70 echo "adding group $$name to /etc/group"
71 echo "$${name}:x:$${id}:" >> ${IPKG_INSTROOT}/etc/group
72 fi
73
74 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
75 echo "adding user $name to /etc/passwd"
76 echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
77 fi
78 endef
79
80 define Build/Configure
81 $(call Build/Configure/Default,--enable-shared \
82 --disable-static,ac_cv_libevent_normal=yes \
83 ac_cv_openssldir="$(STAGING_DIR)/usr" \
84 tor_cv_null_is_zero=yes \
85 tor_cv_unaligned_ok=yes)
86 endef
87
88 define Build/Compile
89 $(call Build/Compile/Default,DESTDIR="$(PKG_INSTALL_DIR)" \
90 all install)
91 endef
92
93 define Package/tor/install
94 install -d -m0755 $(1)/etc/init.d
95 install -m0755 ./files/tor.init $(1)/etc/init.d/tor
96 install -d -m0755 $(1)/etc/tor
97 install -m0644 ./files/torrc $(1)/etc/tor/torrc
98 install -d -m0755 $(1)/usr/sbin
99 $(CP) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/
100 endef
101
102 $(eval $(call BuildPackage,tor))
103