|
@@ -0,0 +1,168 @@
|
|
1
|
+#
|
|
2
|
+# Copyright (C) 2006-2014 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:=privoxy
|
|
11
|
+PKG_VERSION:=3.0.22
|
|
12
|
+PKG_RELEASE:=1
|
|
13
|
+
|
|
14
|
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-stable-src.tar.gz
|
|
15
|
+PKG_SOURCE_URL:=@SF/ijbswa
|
|
16
|
+PKG_MD5SUM:=aa121751d332a51d37d3c6e4b7594daa
|
|
17
|
+
|
|
18
|
+PKG_LICENSE:=GPL-2.0
|
|
19
|
+PKG_LICENSE_FILES:=LICENSE
|
|
20
|
+
|
|
21
|
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-stable
|
|
22
|
+PKG_FIXUP:=autoreconf
|
|
23
|
+PKG_INSTALL:=1
|
|
24
|
+
|
|
25
|
+PKG_MAINTAINER:=christian.schoenebeck@gmail.com
|
|
26
|
+
|
|
27
|
+include $(INCLUDE_DIR)/package.mk
|
|
28
|
+
|
|
29
|
+define Package/privoxy
|
|
30
|
+ SECTION:=net
|
|
31
|
+ CATEGORY:=Network
|
|
32
|
+ SUBMENU:=Web Servers/Proxies
|
|
33
|
+ DEPENDS:=+libpcre +libpthread +zlib
|
|
34
|
+ TITLE:=web proxy with advanced filtering capabilities
|
|
35
|
+ URL:=http://www.privoxy.org/
|
|
36
|
+ USERID:=privoxy=8118:privoxy=8118
|
|
37
|
+endef
|
|
38
|
+
|
|
39
|
+define Package/privoxy/description
|
|
40
|
+Privoxy is a web proxy with advanced filtering capabilities for
|
|
41
|
+ protecting privacy, modifying web page content, managing cookies,
|
|
42
|
+ controlling access, and removing ads, banners, pop-ups and other
|
|
43
|
+ obnoxious Internet junk. Privoxy has a very flexible configuration
|
|
44
|
+ and can be customized to suit individual needs and tastes. Privoxy
|
|
45
|
+ has application for both stand-alone systems and multi-user networks.
|
|
46
|
+Version: $(PKG_VERSION)-$(PKG_RELEASE)
|
|
47
|
+endef
|
|
48
|
+
|
|
49
|
+CONFIGURE_ARGS += \
|
|
50
|
+ --sysconfdir=/etc/privoxy \
|
|
51
|
+
|
|
52
|
+# needed otherwise errors during compile
|
|
53
|
+MAKE_FLAGS:=
|
|
54
|
+
|
|
55
|
+define Build/Install
|
|
56
|
+ $(call Build/Install/Default,)
|
|
57
|
+ # rename original sample config from pkg_source to save existing one during install
|
|
58
|
+ mv $(PKG_INSTALL_DIR)/etc/privoxy/config $(PKG_INSTALL_DIR)/etc/privoxy/config.privoxy
|
|
59
|
+endef
|
|
60
|
+
|
|
61
|
+define Package/privoxy/conffiles
|
|
62
|
+/etc/config/privoxy
|
|
63
|
+/etc/privoxy/config # temporary needed if updating from old version
|
|
64
|
+endef
|
|
65
|
+
|
|
66
|
+define Package/privoxy/preinst
|
|
67
|
+ #!/bin/sh
|
|
68
|
+ # if run within buildroot exit
|
|
69
|
+ [ -n "$${IPKG_INSTROOT}" ] && exit 0
|
|
70
|
+ # stop service # if PKG_UPGRADE NOT WORKING
|
|
71
|
+ # [ "$${PKG_UPGRADE}" = "1" ] && /etc/init.d/privoxy stop
|
|
72
|
+ /etc/init.d/privoxy stop >/dev/null 2>&1
|
|
73
|
+ exit 0 # supress errors from stop command
|
|
74
|
+endef
|
|
75
|
+
|
|
76
|
+define Package/privoxy/install
|
|
77
|
+ $(INSTALL_DIR) $(1)/usr/sbin
|
|
78
|
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/privoxy $(1)/usr/sbin/
|
|
79
|
+ $(INSTALL_DIR) $(1)/etc/init.d
|
|
80
|
+ $(INSTALL_BIN) ./files/privoxy.init $(1)/etc/init.d/privoxy
|
|
81
|
+ # no longer needed because running with procd
|
|
82
|
+ # $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
|
83
|
+ # $(INSTALL_BIN) ./files/privoxy.hotplug $(1)/etc/hotplug.d/iface/80-privoxy
|
|
84
|
+
|
|
85
|
+ $(INSTALL_DIR) $(1)/etc/privoxy
|
|
86
|
+ $(CP) $(PKG_INSTALL_DIR)/etc/privoxy/* $(1)/etc/privoxy/
|
|
87
|
+ # temporary needed if updating from old version
|
|
88
|
+ # otherwise old config file will be delete by opkg
|
|
89
|
+ $(INSTALL_CONF) ./files/privoxy.oldconfig $(1)/etc/privoxy/config
|
|
90
|
+ # create .old file to be removed with next pacakge builds during update
|
|
91
|
+ $(INSTALL_CONF) ./files/privoxy.oldconfig $(1)/etc/privoxy/config.old
|
|
92
|
+
|
|
93
|
+ $(INSTALL_DIR) $(1)/etc/config
|
|
94
|
+ $(INSTALL_CONF) ./files/privoxy.config $(1)/etc/config/privoxy
|
|
95
|
+endef
|
|
96
|
+
|
|
97
|
+define Package/privoxy/postinst
|
|
98
|
+ #!/bin/sh
|
|
99
|
+
|
|
100
|
+ # if fresh install we don't need old config file in privoxy directory
|
|
101
|
+ [ "$${PKG_UPGRADE}" = "0" ] && rm -f /etc/privoxy/config
|
|
102
|
+
|
|
103
|
+ # if run within buildroot exit here
|
|
104
|
+ [ -n "$${IPKG_INSTROOT}" ] && exit 0
|
|
105
|
+
|
|
106
|
+ # if PKG_UPGRADE then build uci configuration
|
|
107
|
+ # from existing(?) old /etc/privoxy/config file
|
|
108
|
+ if [ "$${PKG_UPGRADE}" = "1" -a -f /etc/privoxy/config ]; then
|
|
109
|
+
|
|
110
|
+ echo "converting OLD config to NEW uci configuration"
|
|
111
|
+
|
|
112
|
+ SECTION="privoxy.privoxy"
|
|
113
|
+ CFGFILE=/etc/privoxy/config
|
|
114
|
+
|
|
115
|
+ echo -n > /etc/config/privoxy # clear/create uci configuration file
|
|
116
|
+ cp -f $${CFGFILE} $${CFGFILE}.old # save old configuration
|
|
117
|
+
|
|
118
|
+ # cleanup
|
|
119
|
+ sed -i 's/^[ \t]*//;s/[ \t]*$$//' $${CFGFILE} # remove invisible chars at beginning and end of lines
|
|
120
|
+ sed -i '/^#/d' $${CFGFILE} # remove lines with "#"
|
|
121
|
+ sed -i '/^$$/d' $${CFGFILE} # remove empty lines
|
|
122
|
+
|
|
123
|
+ uci -q set $${SECTION}="privoxy" # create section
|
|
124
|
+
|
|
125
|
+ cat $${CFGFILE} | while read LINE; do
|
|
126
|
+ # option is first parameter; uci did not like "-" in option names
|
|
127
|
+ OPT=$$(echo $${LINE} | awk '{print $$1}' | sed 's/-/_/g')
|
|
128
|
+ VAL=$$(echo $${LINE} | awk '{print $$2}')
|
|
129
|
+ case $${OPT} in
|
|
130
|
+ # debug 1024 => debug_1024 '1'
|
|
131
|
+ debug)
|
|
132
|
+ uci -q set $${SECTION}.debug_$${VAL}="1"
|
|
133
|
+ ;;
|
|
134
|
+ # handle list values; splitted case for better reading
|
|
135
|
+ actionsfile|filterfile|listen_address)
|
|
136
|
+ uci -q add_list $${SECTION}.$${OPT}="$${VAL}"
|
|
137
|
+ ;;
|
|
138
|
+ permit_access|deny_access)
|
|
139
|
+ uci -q add_list $${SECTION}.$${OPT}="$${VAL}"
|
|
140
|
+ ;;
|
|
141
|
+ trust_info_url|forward)
|
|
142
|
+ uci -q add_list $${SECTION}.$${OPT}="$${VAL}"
|
|
143
|
+ ;;
|
|
144
|
+ forward_socks4|forward_socks4a)
|
|
145
|
+ uci -q add_list $${SECTION}.$${OPT}="$${VAL}"
|
|
146
|
+ ;;
|
|
147
|
+ forward_socks5|forward_socks5t)
|
|
148
|
+ uci -q add_list $${SECTION}.$${OPT}="$${VAL}"
|
|
149
|
+ ;;
|
|
150
|
+ # all others are normal options
|
|
151
|
+ *)
|
|
152
|
+ uci -q set $${SECTION}.$${OPT}="$${VAL}"
|
|
153
|
+ ;;
|
|
154
|
+ esac
|
|
155
|
+ done
|
|
156
|
+ uci -q commit privoxy # commit changes
|
|
157
|
+ rm -f $${CFGFILE} # remove old configuration file
|
|
158
|
+ fi
|
|
159
|
+
|
|
160
|
+ # set permissions to privoxy group
|
|
161
|
+ echo "setting permissions"
|
|
162
|
+ chgrp -R privoxy /etc/privoxy/*
|
|
163
|
+ chmod 664 /etc/privoxy/*
|
|
164
|
+ chmod 755 /etc/privoxy/templates
|
|
165
|
+ chmod 644 /etc/privoxy/templates/*
|
|
166
|
+endef
|
|
167
|
+
|
|
168
|
+$(eval $(call BuildPackage,privoxy))
|