aboutsummaryrefslogtreecommitdiff
path: root/net/privoxy/Makefile
diff options
context:
space:
mode:
authorJosh Powers <powersj@fastmail.com>2022-10-25 19:54:43 -0600
committerRosen Penev <rosenp@gmail.com>2022-11-11 15:16:45 -0800
commit95edfa723c9e7b1b99361a86022b9b20ac6f8ead (patch)
treec790d644809aa6b029df42e4b3f360c74d636a3a /net/privoxy/Makefile
parenteb283ea8a3d0ff573b04242b045934541a460f06 (diff)
privoxy: correctly format /etc/services additions
This adds the missing protocol (e.g. /tcp and /udp) to the entry in /etc/services. If the entry already exists, it will add the /tcp to it. Otherwise, it will look and add the tcp and udp entries if either is missing. fixes: openwrt#19665 Signed-off-by: Josh Powers <powersj@fastmail.com>
Diffstat (limited to 'net/privoxy/Makefile')
-rw-r--r--net/privoxy/Makefile11
1 files changed, 9 insertions, 2 deletions
diff --git a/net/privoxy/Makefile b/net/privoxy/Makefile
index 1f8e72a09..6ce0574af 100644
--- a/net/privoxy/Makefile
+++ b/net/privoxy/Makefile
@@ -157,8 +157,15 @@ endef
define Package/privoxy/postinst
#!/bin/sh
- grep -i privoxy $${IPKG_INSTROOT}/etc/services >/dev/null 2>&1 || \
- echo -e "privoxy\t8118" >> $${IPKG_INSTROOT}/etc/services
+ # if exists, update previous version entry missing protocol
+ (grep -E "privoxy.*8118$" $${IPKG_INSTROOT}/etc/services) > /dev/null \
+ && sed -i "s/privoxy.*8118/privoxy\t\t8118\/tcp/" $${IPKG_INSTROOT}/etc/services
+
+ # add missing tcp and udp entries
+ (grep -E "privoxy.*8118\/tcp" $${IPKG_INSTROOT}/etc/services) > /dev/null \
+ || echo -e "privoxy\t\t8118/tcp" >> $${IPKG_INSTROOT}/etc/services
+ (grep -E "privoxy.*8118\/udp" $${IPKG_INSTROOT}/etc/services) > /dev/null \
+ || echo -e "privoxy\t\t8118/udp" >> $${IPKG_INSTROOT}/etc/services
endef
$(eval $(call BuildPackage,privoxy))