lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210407053419.449796-4-gregkh@linuxfoundation.org>
Date:   Wed,  7 Apr 2021 07:34:02 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Masahiro Yamada <masahiroy@...nel.org>,
        Michal Marek <michal.lkml@...kovi.net>
Cc:     linux-kbuild@...r.kernel.org, linux-arch@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: [PATCH 03/20] kbuild: scripts/install.sh: provide a "install" function

Instead of open-coding the "test for file, if present make a backup,
then copy the file to the new location" in multiple places, make a
single function, install(), to do all of this in one place.

Note, this does change the default x86 kernel map file saved name from
"System.old" to "System.map.old".  This brings it into unification with
the other architectures as to what they call their backup file for the
kernel map file.  As this is a text file, and nothing parses this from a
backup file, there should not be any operational differences.

Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
 scripts/install.sh | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/scripts/install.sh b/scripts/install.sh
index c183d6ddd00c..af36c0a82f01 100644
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -27,6 +27,19 @@ verify () {
  	fi
 }
 
+install () {
+	install_source=${1}
+	install_target=${2}
+
+	echo "installing '${install_source}' to '${install_target}'"
+
+	# if the target is already present, move it to a .old filename
+	if [ -f "${install_target}" ]; then
+		mv "${install_target}" "${install_target}".old
+	fi
+	cat "${install_source}" > "${install_target}"
+}
+
 # Make sure the files actually exist
 verify "$2"
 verify "$3"
@@ -37,17 +50,8 @@ if [ -x ~/bin/"${INSTALLKERNEL}" ]; then exec ~/bin/"${INSTALLKERNEL}" "$@"; fi
 if [ -x /sbin/"${INSTALLKERNEL}" ]; then exec /sbin/"${INSTALLKERNEL}" "$@"; fi
 
 # Default install - same as make zlilo
-
-if [ -f "$4"/vmlinuz ]; then
-	mv "$4"/vmlinuz "$4"/vmlinuz.old
-fi
-
-if [ -f "$4"/System.map ]; then
-	mv "$4"/System.map "$4"/System.old
-fi
-
-cat "$2" > "$4"/vmlinuz
-cp "$3" "$4"/System.map
+install "$2" "$4"/vmlinuz
+install "$3" "$4"/System.map
 
 if [ -x /sbin/lilo ]; then
        /sbin/lilo
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ