]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
upgrade-4-to-5: remove the rest of occurrences
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 22 Jun 2023 14:02:40 +0000 (16:02 +0200)
committerJakub Ružička <jakub.ruzicka@nic.cz>
Thu, 22 Jun 2023 14:06:26 +0000 (16:06 +0200)
distro/pkg/nix/default.nix
distro/pkg/rpm/knot-resolver.spec
utils/meson.build
utils/upgrade/meson.build [deleted file]
utils/upgrade/upgrade-4-to-5.lua.in [deleted file]

index 16c66d0546397b11536d5f9d3ddce2a589ae1842..6d975bf8511e19d10c14ad6a085968461dae4aae 100644 (file)
@@ -75,7 +75,6 @@ unwrapped = stdenv.mkDerivation rec {
 
   postInstall = ''
     rm "$out"/lib/libkres.a
-    rm "$out"/lib/knot-resolver/upgrade-4-to-5.lua # not meaningful on NixOS
   '' + optionalString stdenv.targetPlatform.isLinux ''
     rm -r "$out"/lib/sysusers.d/ # ATM more likely to harm than help
   '';
index 55c0a19989775fdd214d609be4b1aa14821f6604..dd55123eaafffe56d5e4de7b2def8d67f7352c88 100644 (file)
@@ -243,44 +243,7 @@ popd
 getent group knot-resolver >/dev/null || groupadd -r knot-resolver
 getent passwd knot-resolver >/dev/null || useradd -r -g knot-resolver -d %{_sysconfdir}/knot-resolver -s /sbin/nologin -c "Knot Resolver" knot-resolver
 
-%if "x%{?rhel}" == "x"
-# upgrade-4-to-5
-if [ -f %{_unitdir}/kresd.socket ] ; then
-       export UPG_DIR=%{_sharedstatedir}/knot-resolver/.upgrade-4-to-5
-       mkdir -p ${UPG_DIR}
-       touch ${UPG_DIR}/.unfinished
-
-       for sock in kresd.socket kresd-tls.socket kresd-webmgmt.socket kresd-doh.socket ; do
-               if systemctl is-enabled ${sock} 2>/dev/null | grep -qv masked ; then
-                       systemctl show ${sock} -p Listen > ${UPG_DIR}/${sock}
-                       case "$(systemctl show ${sock} -p BindIPv6Only)" in
-                       *ipv6-only)
-                               touch ${UPG_DIR}/${sock}.v6only
-                               ;;
-                       *default)
-                               if cat /proc/sys/net/ipv6/bindv6only | grep -q 1 ; then
-                                       touch ${UPG_DIR}/${sock}.v6only
-                               fi
-                               ;;
-                       esac
-               fi
-       done
-fi
-%endif
-
 %post core
-# upgrade-4-to-5
-%if "x%{?rhel}" == "x"
-export UPG_DIR=%{_sharedstatedir}/knot-resolver/.upgrade-4-to-5
-if [ -f ${UPG_DIR}/.unfinished ] ; then
-       rm -f ${UPG_DIR}/.unfinished
-       kresd -c %{_libdir}/knot-resolver/upgrade-4-to-5.lua &>/dev/null
-       echo -e "\n   !!! WARNING !!!"
-       echo -e "Knot Resolver configuration file requires manual upgrade.\n"
-       cat ${UPG_DIR}/kresd.conf.net 2>/dev/null
-fi
-%endif
-
 # 5.0.1 fix to force restart of kres-cache-gc.service, which was missing in systemd_postun_with_restart
 # TODO: remove once most users upgrade to 5.0.1+
 systemctl daemon-reload >/dev/null 2>&1 || :
index 0487538460452804aa49ff931fa82045f5701440..931ef3c5a427085674302d19faf06e94b7ce0782 100644 (file)
@@ -5,4 +5,3 @@ build_utils = get_option('utils') != 'disabled'
 
 subdir('client')
 subdir('cache_gc')
-subdir('upgrade')
diff --git a/utils/upgrade/meson.build b/utils/upgrade/meson.build
deleted file mode 100644 (file)
index 33983e8..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-## utils/upgrade
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-upgrade_config = configuration_data()
-upgrade_config.set('etc_dir', etc_dir)
-upgrade_config.set('systemd_work_dir', systemd_work_dir)
-
-configure_file(
-  input: 'upgrade-4-to-5.lua.in',
-  output: 'upgrade-4-to-5.lua',
-  configuration: upgrade_config,
-  install_dir: lib_dir
-)
diff --git a/utils/upgrade/upgrade-4-to-5.lua.in b/utils/upgrade/upgrade-4-to-5.lua.in
deleted file mode 100644 (file)
index 28f800b..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
--- SPDX-License-Identifier: GPL-3.0-or-later
-
-local upg_dir = '@systemd_work_dir@/.upgrade-4-to-5'
-local out = upg_dir..'/kresd.conf.net'
-local sockets = {
-       { file='kresd.socket', kind='dns' },
-       { file='kresd-tls.socket', kind='tls' },
-       { file='kresd-doh.socket', kind='doh2' },
-       { file='kresd-webmgmt.socket', kind='webmgmt' },
-}
-
--- globals
-addr_port = {}
-outfile = io.open(out, 'w')
-
-if outfile == nil then
-       -- this is technically an error, but upgrade script shouldn't fail in scriptlets
-       os.exit(0)  -- make no changes and exit
-end
-
-outfile:write("-- Suggested network interface configuration\n")
-outfile:write("-- See https://knot-resolver.readthedocs.io/en/stable/upgrading.html\n\n")
-outfile:write("-- Please remove any unused or undesired interfaces and add them to\n")
-outfile:write("-- @etc_dir@/kresd.conf\n\n")
-
-local function write_net_listen(addr, port, kind)
-       -- make sure (addr, port) combination is unique
-       for _, val in ipairs(addr_port) do
-               if val.addr == addr and val.port == port then
-                       return
-               end
-       end
-
-       table.insert(addr_port, { addr=addr, port=port })
-       outfile:write(
-               "net.listen('"..addr.."', "..tostring(port)..
-               ", { kind = '"..kind.."', freebind = true })\n")
-end
-
-local function convert(line, kind, ipv6only)
-       local patterns = {
-               '^[^=]+=(%d+%.%d+%.%d+%.%d+):(%d+)',  -- IPv4
-               '^[^=]+=%[([^%]]+)%]:(%d+)',  -- IPv6
-               '^[^=]+=(/.*)',  -- UNIX
-       }
-
-       -- Datagram is either implied (dns) or unsupported (tls/doh/webmgmt)
-       if not line:match('^Listen.*Stream') then
-               return
-       end
-
-       for _, pattern in ipairs(patterns) do
-               local addr, port = line:match(pattern)
-               if addr ~= nil then
-                       write_net_listen(addr, port, kind)
-                       if not ipv6only then
-                               if addr:match('^::$') then
-                                       write_net_listen('0.0.0.0', port, kind)
-                               end
-                               if addr:match('^::1$') then
-                                       write_net_listen('127.0.0.1', port, kind)
-                               end
-                       end
-               end
-       end
-       return
-end
-
-for _, socket in pairs(sockets) do
-       local ipv6only = false
-       local ipv6only_f = io.open(upg_dir..'/'..socket.file..'.v6only', 'r')
-       if ipv6only_f ~= nil then
-               ipv6only = true
-               io.close(ipv6only_f)
-       end
-       local sockinfo = io.open(upg_dir..'/'..socket.file, 'r')
-       if sockinfo ~= nil then
-               for line in sockinfo:lines() do
-                       convert(line, socket.kind, ipv6only)
-               end
-       end
-end
-
-outfile:write("\n")
-
-io.close(outfile)
-os.exit(0)