reformat memory messages

This commit is contained in:
Tobias Powalowski 2022-05-19 14:56:53 +02:00
parent 1833753db2
commit 2c61c4ef30
2 changed files with 33 additions and 23 deletions

View file

@ -19,8 +19,28 @@ usage () {
echo -e "\033[1mUpdate installer, launch environments or create latest image files:\033[0m"
echo -e "\033[1m-------------------------------------------------------------------\033[0m"
echo -e "\033[1mPARAMETERS:\033[0m"
echo -e " \033[1m-h\033[0m This message."
echo -e ""
echo -e " \033[1m-u\033[0m Update scripts: setup, quickinst, tz, km and helpers."
echo -e ""
if [[ "$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g')" -gt 2500000 ]]; then
echo -e " \033[1m-launch-xfce\033[0m Launch XFCE desktop with VNC sharing enabled."
echo -e " This operation needs at least \033[1m2.5 GB RAM\033[0m."
echo ""
fi
if [[ "$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g')" -gt 3900000 ]]; then
echo -e " \033[1m-latest-image\033[0m Generate latest image files in /archboot directory"
echo -e " This operation needs at least \033[1m3.9 GB RAM\033[0m."
echo ""
fi
if [[ $(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g') -lt 4400000 &&\
$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g') -gt 4015000 ]]; then
echo -e "\033[1m\033[91mMemory check failed:\033[0m"
echo -e "\033[91m - Memory gap detected: \033[1m4.0G - 4.4G RAM\033[0m"
echo -e "\033[91m - Possibility of not working \033[1mkexec\033[0m\033[91m boot is given.\033[0m"
echo -e "\033[93m - Please add \033[1mmore\033[0m\033[93m or \033[1mless\033[0m\033[93m RAM to enable the missing \033[1mupdate\033[0m\033[93m options.\033[0m"
echo ""
else
if [[ "$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g')" -gt 2000000 ]]; then
echo -e " \033[1m-latest\033[0m Launch latest archboot environment (using kexec)."
echo -e " This operation needs at least \033[1m2.0 GB RAM\033[0m."
@ -32,17 +52,7 @@ usage () {
echo -e " This operation needs at least \033[1m3.2 GB RAM\033[0m."
echo ""
fi
if [[ "$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g')" -gt 3900000 ]]; then
echo -e " \033[1m-latest-image\033[0m Generate latest image files in /archboot directory"
echo -e " This operation needs at least \033[1m3.9 GB RAM\033[0m."
echo ""
fi
if [[ "$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g')" -gt 2500000 ]]; then
echo -e " \033[1m-launch-xfce\033[0m Launch XFCE desktop with VNC sharing enabled."
echo -e " This operation needs at least \033[1m2.5 GB RAM\033[0m."
echo ""
fi
echo -e " \033[1m-h\033[0m This message."
exit 0
}

View file

@ -19,27 +19,27 @@ if [[ -e /usr/bin/setup ]]; then
elif [[ "$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g')" -lt 3200000 ]]; then
_welcome
echo -e "\033[1m\033[91mMemory check failed:\033[0m"
echo -e "\033[1m\033[91m- Not engough memory detected! \033[0m"
echo -e "\033[1m\033[93m- Please add more than 3.2GB RAM.\033[0m"
echo -e "\033[1m\033[91mAborting ...\033[0m"
echo -e "\033[91m- Not engough memory detected! \033[0m"
echo -e "\033[93m- Please add \033[1mmore\033[0m\033[93m than \033[1m3.2GB\033[0m\033[93m RAM.\033[0m"
echo -e "\033[91mAborting ...\033[0m"
_enter_shell
elif [[ $(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g') -lt 4400000 &&\
$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g') -gt 4015000 ]]; then
_welcome
echo -e "\033[1m\033[91mMemory check failed:\033[0m"
echo -e "\033[1m\033[91m- Memory gap detected (4.0G - 4.4G RAM)\033[0m"
echo -e "\033[1m\033[93m- Possibility of not working kexec boot.\033[0m"
echo -e "\033[1m\033[93m- Please use more or less RAM.\033[0m"
echo -e "\033[1m\033[91mAborting ...\033[0m"
echo -e "\033[91m- Memory gap detected: \033[1m4.0G - 4.4G RAM\033[0m"
echo -e "\033[91m- Possibility of not working \033[1mkexec\033[0m\033[91m boot is given.\033[0m"
echo -e "\033[93m- Please use \033[1mmore\033[0m\033[93m or \033[1mless\033[0m\033[93m RAM.\033[0m"
echo -e "\033[91mAborting ...\033[0m"
_enter_shell
else
[[ -z $TTY ]] && TTY=$(tty)
TTY=${TTY#/dev/}
cd /
_welcome
echo -e "\033[1m\033[92mMemory checks finished successfully:\033[0m"
echo -e "\033[1m\033[93mGo and get a cup of coffee. Depending on your system setup,\033[0m"
echo -e "\033[1m\033[93myou can start with your tasks in about 5 minutes ...\033[0m"
echo -e "\033[1m\033[92mMemory checks run successfully:\033[0m"
echo -e "\033[93mGo and get a cup of coffee. Depending on your system setup,\033[0m"
echo -e "\033[93myou can \033[1mstart\033[0m\033[93m with your tasks in about \033[1m5\033[0m\033[93m minutes ...\033[0m"
echo ""
if [[ "${TTY}" == "tty1" ]]; then
echo -e "\033[1m\033[91m10 seconds\033[0;25m time to hit \033[1m\033[92mCTRL-C\033[0m to \033[1m\033[91mstop\033[0m the process \033[1m\033[1mnow ...\033[0m"