From 1c2186224467583a9b21991d3cd19605b9751b7d Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Sun, 17 Jan 2016 19:30:05 -0600
Subject: [PATCH] chroot: issue/issue.net just use [sudo su -c ""] permission
 issue on builder

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
 scripts/chroot.sh | 35 +++++++++++++++--------------------
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/scripts/chroot.sh b/scripts/chroot.sh
index a4e1f7e6f..30c909591 100755
--- a/scripts/chroot.sh
+++ b/scripts/chroot.sh
@@ -1009,43 +1009,38 @@ echo "Log: Complete: [sudo chroot ${tempdir} /bin/sh -e chroot_script.sh]"
 
 if [ ! "x${rfs_console_banner}" = "x" ] || [ ! "x${rfs_console_user_pass}" = "x" ] ; then
 	echo "Log: setting up: /etc/issue"
-	wfile="/tmp/issue"
+	wfile="${tempdir}/etc/issue"
 	cat "${tempdir}/etc/issue" > ${wfile}
 	if [ ! "x${rfs_etc_dogtag}" = "x" ] ; then
-		cat "${tempdir}/etc/dogtag" >> ${wfile}
-		echo "" >> ${wfile}
+		sudo sh -c "cat '${tempdir}/etc/dogtag' >> ${wfile}"
+		sudo sh -c "echo '' >> ${wfile}"
 	fi
 	if [ ! "x${rfs_console_banner}" = "x" ] ; then
-		echo "${rfs_console_banner}" >> ${wfile}
-		echo "" >> ${wfile}
+		sudo sh -c "echo '${rfs_console_banner}' >> ${wfile}"
+		sudo sh -c "echo '' >> ${wfile}"
 	fi
 	if [ ! "x${rfs_console_user_pass}" = "x" ] ; then
-		echo "default username:password is [${rfs_username}:${rfs_password}]" >> ${wfile}
-		echo "" >> ${wfile}
+		sudo sh -c "echo 'default username:password is [${rfs_username}:${rfs_password}]' >> ${wfile}"
+		sudo sh -c "echo '' >> ${wfile}"
 	fi
-	sudo mv ${wfile} "${tempdir}/etc/issue"
-	sudo chown root:root "${tempdir}/etc/issue"
 fi
 
 if [ ! "x${rfs_ssh_banner}" = "x" ] || [ ! "x${rfs_ssh_user_pass}" = "x" ] ; then
 	echo "Log: setting up: /etc/issue.net"
-	wfile="/tmp/issue.net"
-	cat "${tempdir}/etc/issue.net" > ${wfile}
-	echo "" >> ${wfile}
+	wfile="${tempdir}/etc/issue.net"
+	sudo sh -c "echo '' >> ${wfile}"
 	if [ ! "x${rfs_etc_dogtag}" = "x" ] ; then
-		cat "${tempdir}/etc/dogtag" >> ${wfile}
-		echo "" >> ${wfile}
+		sudo sh -c "cat '${tempdir}/etc/dogtag' >> ${wfile}"
+		sudo sh -c "echo '' >> ${wfile}"
 	fi
 	if [ ! "x${rfs_ssh_banner}" = "x" ] ; then
-		echo "${rfs_ssh_banner}" >> ${wfile}
-		echo "" >> ${wfile}
+		sudo sh -c "echo '${rfs_ssh_banner}' >> ${wfile}"
+		sudo sh -c "echo '' >> ${wfile}"
 	fi
 	if [ ! "x${rfs_ssh_user_pass}" = "x" ] ; then
-		echo "default username:password is [${rfs_username}:${rfs_password}]" >> ${wfile}
-		echo "" >> ${wfile}
+		sudo sh -c "echo 'default username:password is [${rfs_username}:${rfs_password}]' >> ${wfile}"
+		sudo sh -c "echo '' >> ${wfile}"
 	fi
-	sudo mv ${wfile} "${tempdir}/etc/issue.net"
-	sudo chown root:root "${tempdir}/etc/issue.net"
 fi
 
 #usually a qemu failure...
-- 
GitLab