From 5b4fdaddb251c2ef66b90960391f630f89a71eae Mon Sep 17 00:00:00 2001 From: christos Date: Mon, 15 Jun 2020 14:25:40 +0000 Subject: [PATCH] deal with blacklist -> blocklist --- usr.sbin/postinstall/postinstall.in | 34 ++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/usr.sbin/postinstall/postinstall.in b/usr.sbin/postinstall/postinstall.in index 48cf105c8711..d0bd653c1dc4 100755 --- a/usr.sbin/postinstall/postinstall.in +++ b/usr.sbin/postinstall/postinstall.in @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.23 2020/06/03 11:47:46 roy Exp $ +# $NetBSD: postinstall.in,v 1.24 2020/06/15 14:25:40 christos Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -844,6 +844,38 @@ do_bluetooth() return ${failed} } +fixblock() { + for i; do + if [ ! -f "$i" ]; then + continue + fi + local p=$(stat -f %Lp "$i") + chmod u+w "$i" + sed -i -e s/black/block/g "$i" + chmod "$p" "$i" + done +} + +# +# blocklist update +# +additem blocklist "rename old files to blocklist" +do_blocklist() +{ + # if we are actually using blocklistd + if [ -f /var/db/blacklist.db ]; then + mv /var/db/blocklist.db /var/db/blacklist.db + fi + + # if we have fixed the rc files we are done + if [ ! -f /etc/rc.d/blacklist ]; then + return + fi + + fixblock /etc/rc.conf /etc/npf.conf /etc/defaults/rc.conf + rm -f /etc/rc.d/blacklist +} + # # ddbonpanic #