Date: Wednesday, August 10, 2022 @ 15:28:50 Author: eworm Revision: 452518
upgpkg: dhcp 4.4.3-3: replace `hostname` (part 2) Modified: dhcp/trunk/0001-99-replace-hostname-with-uname-n.patch dhcp/trunk/PKGBUILD ---------------------------------------------+ 0001-99-replace-hostname-with-uname-n.patch | 23 +++++++++++++++++------ PKGBUILD | 4 ++-- 2 files changed, 19 insertions(+), 8 deletions(-) Modified: 0001-99-replace-hostname-with-uname-n.patch =================================================================== --- 0001-99-replace-hostname-with-uname-n.patch 2022-08-10 15:08:25 UTC (rev 452517) +++ 0001-99-replace-hostname-with-uname-n.patch 2022-08-10 15:28:50 UTC (rev 452518) @@ -1,16 +1,18 @@ -From c8587c717eedd4841c002b3751463a070c896f87 Mon Sep 17 00:00:00 2001 +From b2482a4f7d9a06a9c10a26eb1fb2b855d83e94c7 Mon Sep 17 00:00:00 2001 From: Christian Hesse <[email protected]> Date: Thu, 4 Aug 2022 12:15:46 +0200 -Subject: [PATCH 1/1] [!99] replace `hostname` with `uname -n` +Subject: [PATCH] [!99] replace `hostname` with `uname -n` & `sysctl` The former belongs to package `inetutils`, which has some security -implications, so let's use the latter. +implications, so let's use `uname` from `coreutils` to get the hostname. + +For *setting* the hostname things are more limited. Let's use `sysctl`. --- - client/scripts/linux | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + client/scripts/linux | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/scripts/linux b/client/scripts/linux -index c4e51f6d..49eff40a 100755 +index c4e51f6d..fe4da445 100755 --- a/client/scripts/linux +++ b/client/scripts/linux @@ -113,7 +113,7 @@ set_hostname() { @@ -22,3 +24,12 @@ # current host name is empty, '(none)' or 'localhost' or differs from new one from DHCP if [ -z "$current_hostname" ] || +@@ -121,7 +121,7 @@ set_hostname() { + [ "$current_hostname" = 'localhost' ] || + [ "$current_hostname" = "$old_host_name" ]; then + if [ "$new_host_name" != "$old_host_name" ]; then +- hostname "$new_host_name" ++ sysctl -w kernel/hostname="$new_host_name" + fi + fi + fi Modified: PKGBUILD =================================================================== --- PKGBUILD 2022-08-10 15:08:25 UTC (rev 452517) +++ PKGBUILD 2022-08-10 15:28:50 UTC (rev 452518) @@ -7,7 +7,7 @@ # separate patch levels with a period to maintain proper versioning. _realver=4.4.3 pkgver=${_realver/-/.} -pkgrel=2 +pkgrel=3 arch=('x86_64') license=('custom:isc-dhcp') url='https://www.isc.org/dhcp/' @@ -23,7 +23,7 @@ '[email protected]') sha256sums=('0e3ec6b4c2a05ec0148874bcd999a66d05518378d77421f607fb0bc9d0135818' 'SKIP' - 'f3dd5fe585eae18a982bfdbe163f3e3749057cb595ee59a154348094109351c2' + '559ed9ce6318f1a3700f8b879552bd22844c7c5b96622202dbf3164cd99c444e' 'b16083e6bb572ffacaa7cd97e7fde5fcfa1b6dbeb166f162e2ec6e8ec4b928d6' 'abcd30e9e8428e34d22ab4d3074ef4bd84c2b11f5868597111b47d6f56d204da' '03fce30efab819b2d928085b0bab962a33ce56fc376acae98ad9b30aa278c9c8'
