2 # Copyright (C) 2006-2015 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
14 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
)-stable-src.
tar.gz
15 PKG_SOURCE_URL
:=@SF
/ijbswa
16 PKG_MD5SUM
:=bbe47d5ff1a54d9f9fc93a160532697f
17 PKG_BUILD_DIR
:=$(BUILD_DIR
)/$(PKG_NAME
)-$(PKG_VERSION
)-stable
22 PKG_LICENSE_FILES
:=LICENSE
24 PKG_MAINTAINER
:=christian.schoenebeck@gmail.com
26 include $(INCLUDE_DIR
)/package.mk
28 define Package
/$(PKG_NAME
)
31 SUBMENU
:=Web Servers
/Proxies
32 DEPENDS
:=+libpcre
+libpthread
+zlib
33 TITLE
:=Privoxy WEB Proxy
34 URL
:=http
://www.privoxy.org
/
35 USERID
:=privoxy
=8118:privoxy
=8118
38 # shown in LuCI package description
39 define Package
/$(PKG_NAME
)/description
40 $(TITLE
) - Homepage
: www.privoxy.org
43 # shown in make menuconfig <Help>
44 define Package
/$(PKG_NAME
)/config
46 Privoxy is a web proxy with advanced filtering capabilities for protecting
47 privacy
, modifying web page content
, managing cookies
, controlling access
,
48 and removing ads
, banners
, pop-ups and other obnoxious Internet junk.
49 Privoxy has a very flexible configuration and can be customized to suit
50 individual needs and tastes.
51 Privoxy has application for both stand-alone systems and multi-user networks.
54 Version
: $(PKG_VERSION
)-$(PKG_RELEASE
)
61 --sysconfdir
=/etc
/privoxy
63 # needed otherwise errors during compile
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
72 # "/etc/privoxy/config" temporary needed if updating from old version
73 define Package
/$(PKG_NAME
)/conffiles
78 define Package
/$(PKG_NAME
)/preinst
80 # if run within buildroot exit
81 [ -n
"$${IPKG_INSTROOT}" ] && exit
0
82 # stop service if PKG_UPGRADE
83 [ "$${PKG_UPGRADE}" = "1" ] && /etc
/init.d
/privoxy stop
>/dev
/null
2>&1
84 exit
0 # supress errors from stop command
87 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
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
103 $(INSTALL_DIR
) $(1)/etc
/config
104 $(INSTALL_CONF
) .
/files
/privoxy.config
$(1)/etc
/config
/privoxy
107 define Package
/$(PKG_NAME
)/postinst
110 # if fresh install we don't need old config file in privoxy directory
111 [ "$${PKG_UPGRADE}" = "0" ] && rm -f
/etc
/privoxy
/config
113 # if run within buildroot exit here
114 [ -n
"$${IPKG_INSTROOT}" ] && exit
0
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
120 echo
"converting OLD config to NEW uci configuration"
122 SECTION
="privoxy.privoxy"
123 CFGFILE
=/etc
/privoxy
/config
125 echo
-n
> /etc
/config
/privoxy
# clear/create uci configuration file
126 cp
-f
$${CFGFILE} $${CFGFILE}.old
# save old configuration
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
133 uci
-q set
$${SECTION}="privoxy" # create section
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}')
140 # debug 1024 => debug_1024 '1'
142 uci
-q set
$${SECTION}.debug_
$${VAL}="1"
144 # handle list values; splitted case for better reading
145 actionsfile|filterfile|listen_address
)
146 uci
-q add_list
$${SECTION}.
$${OPT}="$${VAL}"
148 permit_access|deny_access
)
149 uci
-q add_list
$${SECTION}.
$${OPT}="$${VAL}"
151 trust_info_url|forward
)
152 uci
-q add_list
$${SECTION}.
$${OPT}="$${VAL}"
154 forward_socks4|forward_socks4a
)
155 uci
-q add_list
$${SECTION}.
$${OPT}="$${VAL}"
157 forward_socks5|forward_socks5t
)
158 uci
-q add_list
$${SECTION}.
$${OPT}="$${VAL}"
160 # all others are normal options
162 uci
-q set
$${SECTION}.
$${OPT}="$${VAL}"
166 uci
-q commit privoxy
# commit changes
167 rm -f
$${CFGFILE} # remove old configuration file
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
/*
178 $(eval
$(call BuildPackage
,$(PKG_NAME
)))