diff --git a/contrib/blocklist/FreeBSD-upgrade b/contrib/blocklist/FreeBSD-upgrade new file mode 100644 --- /dev/null +++ b/contrib/blocklist/FreeBSD-upgrade @@ -0,0 +1,86 @@ +FreeBSD maintainer's guide to blocklist +======================================= + +These instructions describe the blocklist vendor import procedure, +following the Committer's Guide +(https://docs.freebsd.org/en/articles/committers-guide/#vendor-import-git). + +> [!NOTE] +> This guide follows the convention that the `freebsd` remote is +> pointing to gitrepo.FreeBSD.org/src.git. + +1. Grab our top level directory: + + freebsd=$(git rev-parse --show-toplevel) + +2. Create a Git worktree under a temporary directory: + + worktree=$(mktemp -d -t blocklist) + git worktree add ${worktree} vendor/blocklist + +3. Clone the blocklist repo (https://github.com/zoulasc/blocklist.git): + + blocklist_repo=$(mktemp -d -t blocklist-repo) + git clone https://github.com/zoulasc/blocklist.git ${blocklist_repo} + cd ${blocklist_repo} + version=$(git rev-parse --short HEAD) + +4. Copy to the vendor branch using rsync (net/rsync): + + rsync -va --del --exclude=".git" ${blocklist_repo}/ ${worktree} + +5. Take care of added/deleted files: + + cd ${worktree} + git add -A ${worktree} + git status + git diff --staged + +6. Commit: + + git commit -m "Vendor import of blocklist (${version})" + +7. Tag: + + git tag -a -m "Tag blocklist ${version}" vendor/blocklist/${version} + + At this point, the vendor branch can be pushed to the FreeBSD repo + via: + + git push --follow-tags freebsd vendor/blocklist + +8. Merge from the vendor branch: + + cd ${freebsd} + git subtree merge -P contrib/blocklist vendor/blocklist + + Some files may have been deleted from FreeBSD's copy of blocklist. + When git prompts for these deleted files during the merge, choose 'd' + (leaving them deleted). + +9. Resolve conflicts. + +10. Diff against the vendor branch: + + git diff --diff-filter=M vendor/blocklist/${version} HEAD:contrib/blocklist + + Review the diff for any unexpected changes. + +11. Run the local changes scripts: + + cd contrib/blocklist + sh ./freebsd-changes.sh + sh ./freebsd-rename.sh + +12. If source files have been added or removed, update the appropriate + makefiles to reflect changes in the vendor's Makefile.in. + +13. Build and install world, reboot, test. Pay particular attention + to the ftpd(8) and sshd(8) integration. + +14. Commit. + +15. Cleanup: + + rm -fr ${blocklist_repo} ${worktree} + git worktree prune diff --git a/contrib/blocklist/freebsd-changes.sh b/contrib/blocklist/freebsd-changes.sh new file mode 100644 --- /dev/null +++ b/contrib/blocklist/freebsd-changes.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# +# FreeBSD-specific changes from upstream +# + +# Remove Debian port +rm -fr port/debian + +# /libexec -> /usr/libexec +sed -i "" -e 's|/libexec|/usr/libexec|g' bin/blocklistd.8 + +# NetBSD: RT_ROUNDUP -> FreeBSD: SA_SIZE (from net/route.h) +sed -i "" -e 's/RT_ROUNDUP/SA_SIZE/g' bin/conf.c + +# npfctl(8) -> ipf(8), ipfw(8), pfctl(8) +sed -i "" -e 's/npfctl 8 ,/ipf 8 ,\n.Xr ipfw 8 ,\n.Xr pfctl 8 ,/g' bin/blocklistd.8 + +# TODO: etc/rc.d/blocklistd: should we change it to: +# REQUIRE: ipfw pf ipfilter diff --git a/contrib/blocklist/freebsd-rename.sh b/contrib/blocklist/freebsd-rename.sh new file mode 100644 --- /dev/null +++ b/contrib/blocklist/freebsd-rename.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +########################################## +# This file should eventually dissappear # +########################################## + +# +# Rename blocklist to blacklist +# + +# Change within files blocklist -> blacklist +files="$(find . -type f)" +for file in $files; do + sed -i "" -e 's/blocklist/blacklist/g' "$file" + sed -i "" -e 's/Blocklist/Blacklist/g' "$file" + sed -i "" -e 's/BLOCKLIST/BLACKLIST/g' "$file" +done + +# Rename blocklist -> blacklist +mv bin/blocklistctl.8 bin/blacklistctl.8 +mv bin/blocklistctl.c bin/blacklistctl.c +mv bin/blocklistd.8 bin/blacklistd.8 +mv bin/blocklistd.c bin/blacklistd.c +mv bin/blocklistd.conf.5 bin/blacklistd.conf.5 +mv etc/blocklistd.conf etc/blacklistd.conf +mv etc/rc.d/blocklistd etc/rc.d/blacklistd +mv include/blocklist.h include/blacklist.h +mv lib/blocklist.c lib/blacklist.c +mv lib/libblocklist.3 lib/libblacklist.3 +mv libexec/blocklistd-helper libexec/blacklistd-helper