aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--download.sh6
-rw-r--r--insidechroot.sh2
-rwxr-xr-xlfs.sh28
-rw-r--r--packageinstall.sh12
-rw-r--r--preparechroot.sh22
-rw-r--r--spinner.sh2
6 files changed, 36 insertions, 36 deletions
diff --git a/download.sh b/download.sh
index 179990d..9446d82 100644
--- a/download.sh
+++ b/download.sh
@@ -9,7 +9,7 @@ download()
echo -n " "
wget -nc -q --show-progress --progress=dot "$url" 2>&1 | grep --line-buffered "%" | \
sed -u -e "s,\.,,g" | awk '{printf("\b\b\b\b%4s", $2)}'
- echo -ne "\b\b\b\b\n"
+ printf "%b" "\b\b\b\b\n"
tput cnorm
}
@@ -23,12 +23,12 @@ cat packages.csv patches.csv | while read -r line; do
if [ ! -f "${CACHEFILE}" ]; then
- echo -ne "${PRP}Downloading ${YLW}${CACHEFILE}${RST}... "
+ printf "%b" "${PRP}Downloading ${YLW}${CACHEFILE}${RST}... "
#wget -nc ${URL} -O ${LFS}/sources/${CACHEFILE} --progress=dot -q --show-progress 2>&1 | awk 'NF>2 && $(NF-2) ~ /%/{printf "\r \t\t\t\t\t\t%s",$(NF-2)} END{print "\r "}'
download "${URL}"
if ! echo "${MD5SUM} ${LFS}/sources/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then
rm -f "${LFS}/sources/${CACHEFILE}"
- echo -e "\n${GRN}Verification of ${YLW}${CACHEFILE} ${RED}failed! MD5 mismatch!${RST}"
+ printf "%b" "\n${GRN}Verification of ${YLW}${CACHEFILE} ${RED}failed! MD5 mismatch!${RST}\n"
exit 1
fi
fi
diff --git a/insidechroot.sh b/insidechroot.sh
index 3c262e9..0364198 100644
--- a/insidechroot.sh
+++ b/insidechroot.sh
@@ -2,4 +2,4 @@
source /sources/colors.sh
-echo -e "${GRN}Successfully entered ${RED}CHROOT${RST}!"
+printf "%b" "${GRN}Successfully entered ${RED}CHROOT${RST}!"
diff --git a/lfs.sh b/lfs.sh
index db1c2dd..c154c19 100755
--- a/lfs.sh
+++ b/lfs.sh
@@ -2,48 +2,48 @@
clear
-echo "Sourcing colors..."
+printf "%b" "Sourcing colors...\n"
# Colors defined for text
source colors.sh
-echo "Sourcing environment variables..."
+printf "%b" "Sourcing environment variables...\n"
# LFS build environment settings
source env.sh
-echo "Sourcing spinner..."
+printf "%b" "Sourcing spinner...\n"
# Spinner function (returns an exit value)
source spinner.sh
# Version check script
#source versioncheck.sh
-echo -e "\n\n\n${CYN}BUILDING ${YLW}${LFS_VER} $(uname -m)${CYN} at \
+printf "%b" "\n\n\n${CYN}BUILDING ${YLW}${LFS_VER} $(uname -m)${CYN} at \
${PRP}${LFS}${CYN} on ${PRP}${LFS_DISK}${LFS_PART}${RST}\n\n\n"
# Continue or Abort
-echo -e "${IGRN}CONTINUE ${IWHTB}(C)${RST} / ${IRED}ABORT ${IWHTB}(OTHER)${RST}"
+printf "%b" "${IGRN}CONTINUE ${IWHTB}(C)${RST} / ${IRED}ABORT ${IWHTB}(OTHER)${RST}\n"
if read -r -n 1 contabort; then
if [ "$contabort" == "C" ] || [ "$contabort" == "c" ]; then
- echo -e "\b${IWHT}Build is ${IGRN}CONTINUING${RST}"
+ printf "%b" "\b${IWHT}Build is ${IGRN}CONTINUING${RST}\n"
else
- echo -e "\b${IWHT}Build ${IRED}ABORTED!"
+ printf "%b" "\b${IWHT}Build ${IRED}ABORTED!\n"
exit 0
fi
else
- echo -e "\b${IWHT}Selection ${IRED}FAILURE!${RST}"
+ printf "%b" "\b${IWHT}Selection ${IRED}FAILURE!${RST}\n"
exit 1
fi
-echo -e "${GRN}Creating LFS directory at ${YLW}${LFS}${GRN} if it does not exist...${RST}"
+printf "%b" "${GRN}Creating LFS directory at ${YLW}${LFS}${GRN} if it does not exist...${RST}\n"
# Create LFS directory if it doesn't exist
[[ -d /mnt/lfs ]] || sudo mkdir "${LFS}"
# Setup partition, filesystem, format and mount if
# LFS filesystem is not previously mounted
if ! grep -q "${LFS}" /proc/mounts; then
- echo -e "${GRN}Setting up partition on ${YLW}${LFS_DISK} ${GRN}\
+ printf "%b" "${GRN}Setting up partition on ${YLW}${LFS_DISK} ${GRN}\
with ${YLW}ext4${GRN} filesystem at ${YLW}${LFS_DISK}${LFS_ROOT} ${GRN}\
-and mounting at ${YLW}${LFS}${RST}..."
+and mounting at ${YLW}${LFS}${RST}...\n"
source setupdisk.sh "${LFS_DISK}" "${LFS_PART}"
sudo mount "${LFS_DISK}${LFS_PART}" "${LFS}"
@@ -68,7 +68,7 @@ esac
#sudo groupadd lfs
#sudo useradd -s /bin/bash -g lfs -m -k /dev/null lfs
-#echo -e "${LFS_PWD}\n${LFS_PWD}\n" | sudo passwd lfs
+#printf "%b" "${LFS_PWD}\n${LFS_PWD}\n" | sudo passwd lfs
# Copy scripts and csv files to LFS sources target
cp -rf ./*.sh chapter* ./*.csv "${LFS}/sources"
@@ -104,9 +104,9 @@ done
chmod ugo+x preparechroot.sh
chmod ugo+x insidechroot.sh
-echo -e "${CYN}PREPARING CHROOT ENVIRONMENT...${RST}"
+printf "%b" "${CYN}PREPARING CHROOT ENVIRONMENT...${RST}\n"
sudo ./preparechroot.sh "${LFS}"
-echo -e "${CYN}ENTERING CHROOT ENVIRONMENT...${RST}"
+printf "%b" "${CYN}ENTERING CHROOT ENVIRONMENT...${RST}\n"
sleep 3
sudo chroot "${LFS}" /usr/bin/env \
diff --git a/packageinstall.sh b/packageinstall.sh
index a890ded..c08710a 100644
--- a/packageinstall.sh
+++ b/packageinstall.sh
@@ -4,7 +4,7 @@ CHAPTER="$1"
PACKAGE="$2"
if [ -f "${LFS}/sources/chapter${CHAPTER}/${PACKAGE}" ]; then
- echo -e "${GRN}Package ${YLW}${PACKAGE} ${GRN}already built and installed for ${YLW}Chapter ${CHAPTER}.${RST}"
+ printf "%b" "${GRN}Package ${YLW}${PACKAGE} ${GRN}already built and installed for ${YLW}Chapter ${CHAPTER}.${RST}\n"
else
grep -i "^${PACKAGE}" packages.csv | grep -i -v "\.patch;" | while read -r line; do
@@ -17,18 +17,18 @@ else
# Remove existing if exists
rm -rf "${DIRNAME}"
- echo -ne "${IBLU}Extracting ${YLW}${CACHEFILE}... "
+ printf "%b" "${IBLU}Extracting ${YLW}${CACHEFILE}... "
tar xf "${CACHEFILE}" > /dev/null 2>&1 & pid=$!
spinner "$pid"
retval=$?
if [ "$retval" -ne 0 ]; then
- echo -e "${GRN}Extraction ${RED}FAILED!${RST}"
+ printf "%b" "${GRN}Extraction ${RED}FAILED!${RST}\n"
return $retval
fi
pushd "${DIRNAME}" > /dev/null || return 1
- echo -ne "\n${CYN}Compiling ${YLW}${PACKAGE}${RST}... "
+ printf "%b" "\n${CYN}Compiling ${YLW}${PACKAGE}${RST}... "
sleep 5
mkdir -p "${LFS}/sources/log/chapter${CHAPTER}/"
@@ -36,11 +36,11 @@ else
spinner "$pid"
retval=$?
if [ "$retval" -ne 0 ]; then
- echo -e "\n${GRN}Compiling ${YLW}${PACKAGE} ${RED}FAILED!${RST}"
+ printf "%b" "${RED}FAILED!${RST}\n"
popd > /dev/null || return 1
return $retval
else
- echo -e "\n${GRN}Done Compiling ${YLW}${PACKAGE}${RST}"
+ printf "%b" "${GRN}OK${RST}\n"
touch "${LFS}"/sources/chapter"${CHAPTER}"/"${PACKAGE}"
rm -rf "${LFS}"/sources/"${DIRNAME}"
fi
diff --git a/preparechroot.sh b/preparechroot.sh
index 302fd9b..b460175 100644
--- a/preparechroot.sh
+++ b/preparechroot.sh
@@ -5,12 +5,12 @@ source colors.sh
export LFS="$1"
if [ -z "${LFS}" ]; then
- echo -e "${RED}Require first argument as path to LFS build!${RST}"
+ printf "%b" "${RED}Require first argument as path to LFS build!${RST}\n"
exit 1
fi
if [ "${USER}" == "root" ]; then
- echo -e "${GRN}Changing ownership to root...${RST}"
+ printf "%b" "${GRN}Changing ownership to root...${RST}\n"
chown -R root:root "${LFS}"/bin
chown -R root:root "${LFS}"/etc
chown -R root:root "${LFS}"/lib
@@ -23,41 +23,41 @@ if [ "${USER}" == "root" ]; then
x86_64) chown -R root:root "${LFS}"/lib64 ;;
esac
- echo -e "${GRN}Creating virtual kernel filesystem mountpoints...${RST}"
+ printf "%b" "${GRN}Creating virtual kernel filesystem mountpoints...${RST}\n"
mkdir -p "${LFS}"/dev
mkdir -p "${LFS}"/proc
mkdir -p "${LFS}"/run
mkdir -p "${LFS}"/sys
- echo -e "${GRN}Creating initial device nodes...${RST}"
+ printf "%b" "${GRN}Creating initial device nodes...${RST}\n"
mknod -m 600 "${LFS}"/dev/console c 5 1 >/dev/null 2>&1
mknod -m 666 "${LFS}"/dev/null c 1 3 >/dev/null 2>&1
- echo -e "${GRN}Mounting virtual kernel filesystems...${RST}"
+ printf "%b" "${GRN}Mounting virtual kernel filesystems...${RST}\n"
if ! mountpoint "${LFS}"/dev >/dev/null 2>&1; then
mount -v --bind /dev "${LFS}"/dev
else
- echo -e " ${YLW}${LFS}/dev${GRN} is already mounted${RST}"
+ printf "%b" " ${YLW}${LFS}/dev${GRN} is already mounted${RST}\n"
fi
if ! mountpoint "${LFS}"/dev/pts >/dev/null 2>&1; then
mount -v --bind /dev/pts "${LFS}"/dev/pts
else
- echo -e " ${YLW}${LFS}/dev/pts${GRN} is already mounted${RST}"
+ printf "%b" " ${YLW}${LFS}/dev/pts${GRN} is already mounted${RST}\n"
fi
if ! mountpoint "${LFS}"/proc >/dev/null 2>&1; then
mount -v --bind /proc "${LFS}"/proc
else
- echo -e " ${YLW}${LFS}/proc${GRN} is already mounted${RST}"
+ printf "%b" " ${YLW}${LFS}/proc${GRN} is already mounted${RST}\n"
fi
if ! mountpoint "${LFS}"/sys >/dev/null 2>&1; then
mount -v --bind /sys "${LFS}"/sys
else
- echo -e " ${YLW}${LFS}/sys${GRN} is already mounted${RST}"
+ printf "%b" " ${YLW}${LFS}/sys${GRN} is already mounted${RST}\n"
fi
if ! mountpoint "${LFS}"/run >/dev/null 2>&1; then
mount -v --bind /run "${LFS}"/run
else
- echo -e " ${YLW}${LFS}/run${GRN} is already mounted${RST}"
+ printf "%b" " ${YLW}${LFS}/run${GRN} is already mounted${RST}\n"
fi
if [ -h "${LFS}"/dev/shm ]; then
@@ -65,5 +65,5 @@ if [ "${USER}" == "root" ]; then
fi
else
- echo -e "${RED}preparechroot.sh must be ran as ${YLW}root${RED} user!${RST}"
+ printf "%b" "${RED}preparechroot.sh must be ran as ${YLW}root${RED} user!${RST}\n"
fi
diff --git a/spinner.sh b/spinner.sh
index 83fc536..5332ee1 100644
--- a/spinner.sh
+++ b/spinner.sh
@@ -9,7 +9,7 @@ spinner() {
local str=""
local delay="0.1"
tput civis # hide cursor
- echo -ne "${WHT}"
+ printf "%b" "${WHT}"
while [ -d /proc/"$PROC" ]; do
#-\|/
#⠁⠂⠄⡀⢀⠠⠐⠈