diff options
author | 2016-06-22 23:48:43 -0400 | |
---|---|---|
committer | 2016-06-22 23:48:43 -0400 | |
commit | cc02d07dedbc737855ec0711dd52d4654c9a7404 (patch) | |
tree | 3b194f11b878dc4d7ecbb86e8e463f94f63a0e12 /netboot | |
parent | genkernel: simplify/robustify --config parsing (diff) | |
download | genkernel-cc02d07dedbc737855ec0711dd52d4654c9a7404.tar.gz genkernel-cc02d07dedbc737855ec0711dd52d4654c9a7404.tar.bz2 genkernel-cc02d07dedbc737855ec0711dd52d4654c9a7404.zip |
clean up extended echo usage
Switch to printf where appropriate, and simplify other locations where
the -e option was pointless.
Diffstat (limited to 'netboot')
-rw-r--r-- | netboot/linuxrc.x | 67 | ||||
-rwxr-xr-x | netboot/misc/bin/net-setup | 19 |
2 files changed, 45 insertions, 41 deletions
diff --git a/netboot/linuxrc.x b/netboot/linuxrc.x index 31b19d0c..4bd711c3 100644 --- a/netboot/linuxrc.x +++ b/netboot/linuxrc.x @@ -100,14 +100,14 @@ StartUp() { if [ -n "`which dropbear 2>/dev/null`" ] then # Setup dropbear (sshd) - echo -e "" + echo mkdir /etc/dropbear - echo -e ">>> Generating RSA hostkey ..." + echo ">>> Generating RSA hostkey ..." dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key - echo -e "" - echo -e ">>> Generating DSS hostkey ..." + echo + echo ">>> Generating DSS hostkey ..." dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key - echo -e "" + echo dropbear fi @@ -126,8 +126,7 @@ StartUp() { #// show an informative message (with a newline) einfo() { - echo -e " * ${*}" - return 0 + printf " * %b\n" "$*" } #//-------------------------------------------------------------------------------- @@ -266,35 +265,41 @@ SubGenius() { #//-------------------------------------------------------------------------------- GenMotd() { - echo -e "" > /etc/motd - echo -e "" >> /etc/motd - echo -e "Gentoo Linux; http://www.gentoo.org/" >> /etc/motd - echo -e " Copyright 2001-${CPYYEAR} Gentoo Foundation; Distributed under the GPL" >> /etc/motd - echo -e "" >> /etc/motd - echo -e " Gentoo/${MYARCH} Netboot for ${MACHTYPE} Systems" >> /etc/motd - echo -e " ${BUILDDATE}" >> /etc/motd - echo -e "" >> /etc/motd + cat <<-EOF >/etc/motd + + + Gentoo Linux; http://www.gentoo.org/ + Copyright 2001-${CPYYEAR} Gentoo Foundation; Distributed under the GPL + + Gentoo/${MYARCH} Netboot for ${MACHTYPE} Systems + ${BUILDDATE} + +EOF #// If this is the initial startup, then display some messages, otherwise just execute a shell for the user if [ ! -f "/tmp/.startup" ]; then if [ -z "${MYIP}" ]; then - einfo "To configure networking (eth0), do the following:" > /etc/motd2 - echo -e "" >> /etc/motd2 - einfo "For Static IP:" >> /etc/motd2 - einfo "/bin/net-setup <IP Address> <Gateway Address>" >> /etc/motd2 - echo -e "" >> /etc/motd2 - einfo "For Dynamic IP:" >> /etc/motd2 - einfo "/bin/net-setup dhcp" >> /etc/motd2 - echo -e "" >> /etc/motd2 + ( + einfo "To configure networking (eth0), do the following:" + echo + einfo "For Static IP:" + einfo "/bin/net-setup <IP Address> <Gateway Address>" + echo + einfo "For Dynamic IP:" + einfo "/bin/net-setup dhcp" + echo + ) > /etc/motd2 else - echo -e "" > /etc/motd2 - einfo "Network interface eth0 has been started:" >> /etc/motd2 - einfo " IP Address: ${MYIP}" >> /etc/motd2 - einfo " Gateway: ${MYGW}" >> /etc/motd2 - echo -e "" >> /etc/motd2 - einfo "An sshd server is available on port 22. Please set a root" >> /etc/motd2 - einfo "password via \"passwd\" before using." >> /etc/motd2 - echo -e "" >> /etc/motd2 + ( + echo + einfo "Network interface eth0 has been started:" + einfo " IP Address: ${MYIP}" + einfo " Gateway: ${MYGW}" + echo + einfo "An sshd server is available on port 22. Please set a root" + einfo "password via \"passwd\" before using." + echo + ) > /etc/motd2 fi fi } diff --git a/netboot/misc/bin/net-setup b/netboot/misc/bin/net-setup index 91c408a3..134065d1 100755 --- a/netboot/misc/bin/net-setup +++ b/netboot/misc/bin/net-setup @@ -10,8 +10,7 @@ MYGW="" # void einfo(char* message) # show an informative message (with a newline) einfo() { - echo -e " * ${*}" - return 0 + printf " * %b\n" "$*" } #//-------------------------------------------------------------------------------- @@ -30,9 +29,9 @@ SetupNetwork() { #// Check second param if [ -z "${2}" ]; then - echo -e "" + echo einfo "Please specify a gateway address." - echo -e "" + echo exit fi @@ -63,11 +62,11 @@ SetupNetwork() { #// Check first param if [ -z "${1}" ]; then - echo -e "" + echo einfo "Please specify \"dhcp\" for setting up networking via dhcp or" einfo "specify an IP Address and gateway address to configure static" einfo "networking." - echo -e "" + echo exit 0 fi @@ -78,15 +77,15 @@ SetupNetwork ${1} ${2} ${3} #// Was the network setup? if [ ! -z "$(ifconfig | grep "eth0")" ]; then - echo -e "" + echo einfo "Network interface eth0 has been started:" einfo " IP Address: ${MYIP}" einfo " Gateway: ${MYGW}" - echo -e "" + echo einfo "An sshd server is available on port 22. Please set a root" einfo "password via \"passwd\" before using." - echo -e "" - echo -e "" + echo + echo fi #//-------------------------------------------------------------------------------- |