|
@@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
|
9
|
9
|
|
10
|
10
|
PKG_NAME:=privoxy
|
11
|
11
|
PKG_VERSION:=3.0.23
|
12
|
|
-PKG_RELEASE:=2
|
|
12
|
+PKG_RELEASE:=3
|
13
|
13
|
|
14
|
|
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-stable-src.tar.gz
|
|
14
|
+PKG_SOURCE:=privoxy-$(PKG_VERSION)-stable-src.tar.gz
|
15
|
15
|
PKG_SOURCE_URL:=@SF/ijbswa
|
16
|
16
|
PKG_MD5SUM:=bbe47d5ff1a54d9f9fc93a160532697f
|
17
|
|
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-stable
|
|
17
|
+PKG_BUILD_DIR:=$(BUILD_DIR)/privoxy-$(PKG_VERSION)-stable
|
18
|
18
|
PKG_FIXUP:=autoreconf
|
19
|
19
|
PKG_INSTALL:=1
|
20
|
20
|
|
|
@@ -63,116 +63,47 @@ CONFIGURE_ARGS += \
|
63
|
63
|
# needed otherwise errors during compile
|
64
|
64
|
MAKE_FLAGS:=
|
65
|
65
|
|
66
|
|
-define Build/Install
|
67
|
|
- $(call Build/Install/Default,)
|
68
|
|
- # rename original sample config from pkg_source to save existing one during install
|
69
|
|
- mv $(PKG_INSTALL_DIR)/etc/privoxy/config $(PKG_INSTALL_DIR)/etc/privoxy/config.privoxy
|
70
|
|
-endef
|
71
|
|
-
|
72
|
|
-# "/etc/privoxy/config" temporary needed if updating from old version
|
73
|
66
|
define Package/$(PKG_NAME)/conffiles
|
74
|
67
|
/etc/config/privoxy
|
75
|
|
-/etc/privoxy/config
|
|
68
|
+/etc/privoxy/user.action
|
|
69
|
+/etc/privoxy/user.filter
|
|
70
|
+/etc/privoxy/user.trust
|
76
|
71
|
endef
|
77
|
72
|
|
78
|
73
|
define Package/$(PKG_NAME)/preinst
|
79
|
74
|
#!/bin/sh
|
80
|
|
- # if run within buildroot exit
|
81
|
|
- [ -n "$${IPKG_INSTROOT}" ] && exit 0
|
|
75
|
+ [ -n "$${IPKG_INSTROOT}" ] && exit 0 # if run within buildroot exit
|
|
76
|
+
|
82
|
77
|
# stop service if PKG_UPGRADE
|
83
|
78
|
[ "$${PKG_UPGRADE}" = "1" ] && /etc/init.d/privoxy stop >/dev/null 2>&1
|
|
79
|
+
|
84
|
80
|
exit 0 # supress errors from stop command
|
85
|
81
|
endef
|
86
|
82
|
|
87
|
83
|
define Package/$(PKG_NAME)/install
|
88
|
|
- $(INSTALL_DIR) $(1)/usr/sbin
|
89
|
|
- $(CP) $(PKG_INSTALL_DIR)/usr/sbin/privoxy $(1)/usr/sbin/
|
90
|
|
- $(INSTALL_DIR) $(1)/etc/init.d
|
91
|
|
- $(INSTALL_BIN) ./files/privoxy.init $(1)/etc/init.d/privoxy
|
92
|
|
- $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
93
|
|
- $(INSTALL_BIN) ./files/privoxy.hotplug $(1)/etc/hotplug.d/iface/80-privoxy
|
94
|
|
-
|
95
|
|
- $(INSTALL_DIR) $(1)/etc/privoxy
|
96
|
|
- $(CP) $(PKG_INSTALL_DIR)/etc/privoxy/* $(1)/etc/privoxy/
|
97
|
|
- # temporary needed if updating from old version
|
98
|
|
- # otherwise old config file will be delete by opkg
|
99
|
|
- $(INSTALL_CONF) ./files/privoxy.oldconfig $(1)/etc/privoxy/config
|
100
|
|
- # create .old file to be removed with next pacakge builds during update
|
101
|
|
- $(INSTALL_CONF) ./files/privoxy.oldconfig $(1)/etc/privoxy/config.old
|
102
|
|
- # copy NEW config
|
103
|
|
- $(INSTALL_DIR) $(1)/etc/config
|
104
|
|
- $(INSTALL_CONF) ./files/privoxy.config $(1)/etc/config/privoxy
|
105
|
|
-endef
|
106
|
|
-
|
107
|
|
-define Package/$(PKG_NAME)/postinst
|
108
|
|
- #!/bin/sh
|
109
|
|
-
|
110
|
|
- # if fresh install we don't need old config file in privoxy directory
|
111
|
|
- [ "$${PKG_UPGRADE}" = "0" ] && rm -f /etc/privoxy/config
|
112
|
|
-
|
113
|
|
- # if run within buildroot exit here
|
114
|
|
- [ -n "$${IPKG_INSTROOT}" ] && exit 0
|
115
|
|
-
|
116
|
|
- # if PKG_UPGRADE then build uci configuration
|
117
|
|
- # from existing(?) old /etc/privoxy/config file
|
118
|
|
- if [ "$${PKG_UPGRADE}" = "1" -a -f /etc/privoxy/config ]; then
|
119
|
|
-
|
120
|
|
- echo "converting OLD config to NEW uci configuration"
|
121
|
|
-
|
122
|
|
- SECTION="privoxy.privoxy"
|
123
|
|
- CFGFILE=/etc/privoxy/config
|
124
|
|
-
|
125
|
|
- echo -n > /etc/config/privoxy # clear/create uci configuration file
|
126
|
|
- cp -f $${CFGFILE} $${CFGFILE}.old # save old configuration
|
127
|
|
-
|
128
|
|
- # cleanup
|
129
|
|
- sed -i 's/^[ \t]*//;s/[ \t]*$$//' $${CFGFILE} # remove invisible chars at beginning and end of lines
|
130
|
|
- sed -i '/^#/d' $${CFGFILE} # remove lines with "#"
|
131
|
|
- sed -i '/^$$/d' $${CFGFILE} # remove empty lines
|
132
|
|
-
|
133
|
|
- uci -q set $${SECTION}="privoxy" # create section
|
134
|
|
-
|
135
|
|
- cat $${CFGFILE} | while read LINE; do
|
136
|
|
- # option is first parameter; uci did not like "-" in option names
|
137
|
|
- OPT=$$(echo $${LINE} | awk '{print $$1}' | sed 's/-/_/g')
|
138
|
|
- VAL=$$(echo $${LINE} | awk '{print $$2}')
|
139
|
|
- case $${OPT} in
|
140
|
|
- # debug 1024 => debug_1024 '1'
|
141
|
|
- debug)
|
142
|
|
- uci -q set $${SECTION}.debug_$${VAL}="1"
|
143
|
|
- ;;
|
144
|
|
- # handle list values; splitted case for better reading
|
145
|
|
- actionsfile|filterfile|listen_address)
|
146
|
|
- uci -q add_list $${SECTION}.$${OPT}="$${VAL}"
|
147
|
|
- ;;
|
148
|
|
- permit_access|deny_access)
|
149
|
|
- uci -q add_list $${SECTION}.$${OPT}="$${VAL}"
|
150
|
|
- ;;
|
151
|
|
- trust_info_url|forward)
|
152
|
|
- uci -q add_list $${SECTION}.$${OPT}="$${VAL}"
|
153
|
|
- ;;
|
154
|
|
- forward_socks4|forward_socks4a)
|
155
|
|
- uci -q add_list $${SECTION}.$${OPT}="$${VAL}"
|
156
|
|
- ;;
|
157
|
|
- forward_socks5|forward_socks5t)
|
158
|
|
- uci -q add_list $${SECTION}.$${OPT}="$${VAL}"
|
159
|
|
- ;;
|
160
|
|
- # all others are normal options
|
161
|
|
- *)
|
162
|
|
- uci -q set $${SECTION}.$${OPT}="$${VAL}"
|
163
|
|
- ;;
|
164
|
|
- esac
|
165
|
|
- done
|
166
|
|
- uci -q commit privoxy # commit changes
|
167
|
|
- rm -f $${CFGFILE} # remove old configuration file
|
|
84
|
+ if [ -f $(PKG_INSTALL_DIR)/etc/privoxy/trust ]; then \
|
|
85
|
+ mv -f $(PKG_INSTALL_DIR)/etc/privoxy/trust $(PKG_INSTALL_DIR)/etc/privoxy/user.trust; \
|
|
86
|
+ fi
|
|
87
|
+ if [ -f $(PKG_INSTALL_DIR)/etc/privoxy/config ]; then \
|
|
88
|
+ rm -f $(PKG_INSTALL_DIR)/etc/privoxy/config; \
|
168
|
89
|
fi
|
169
|
90
|
|
170
|
|
- # set permissions to privoxy group
|
171
|
|
- echo "setting permissions"
|
172
|
|
- chgrp -R privoxy /etc/privoxy/*
|
173
|
|
- chmod 664 /etc/privoxy/*
|
174
|
|
- chmod 755 /etc/privoxy/templates
|
175
|
|
- chmod 644 /etc/privoxy/templates/*
|
|
91
|
+ $(INSTALL_DIR) \
|
|
92
|
+ $(1)/usr/sbin\
|
|
93
|
+ $(1)/etc/privoxy/templates
|
|
94
|
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/privoxy $(1)/usr/sbin/
|
|
95
|
+ find $(PKG_INSTALL_DIR)/etc/privoxy/templates -maxdepth 1 -type f \
|
|
96
|
+ -exec $(INSTALL_DATA) -t $(1)/etc/privoxy/templates {} \;
|
|
97
|
+ find $(PKG_INSTALL_DIR)/etc/privoxy -maxdepth 1 -type f \
|
|
98
|
+ -exec install -m0664 -t $(1)/etc/privoxy {} \;
|
|
99
|
+
|
|
100
|
+ $(INSTALL_DIR) \
|
|
101
|
+ $(1)/etc/init.d \
|
|
102
|
+ $(1)/etc/hotplug.d/iface \
|
|
103
|
+ $(1)/etc/config
|
|
104
|
+ $(INSTALL_BIN) ./files/privoxy.init $(1)/etc/init.d/privoxy
|
|
105
|
+ $(INSTALL_BIN) ./files/privoxy.hotplug $(1)/etc/hotplug.d/iface/80-privoxy
|
|
106
|
+ $(INSTALL_CONF) ./files/privoxy.config $(1)/etc/config/privoxy
|
176
|
107
|
endef
|
177
|
108
|
|
178
|
109
|
$(eval $(call BuildPackage,$(PKG_NAME)))
|