Commit 7e01d87b authored by Vitaly Lipatov's avatar Vitaly Lipatov

distr_info: check if proc exists before use

parent 5c2f9442
...@@ -420,6 +420,7 @@ esac ...@@ -420,6 +420,7 @@ esac
echo "$DIST_BIT" echo "$DIST_BIT"
} }
# TODO: check before calc
get_memory_size() { get_memory_size() {
local detected=0 local detected=0
local DIST_OS=$(get_base_os_name) local DIST_OS=$(get_base_os_name)
...@@ -431,7 +432,7 @@ get_memory_size() { ...@@ -431,7 +432,7 @@ get_memory_size() {
detected=$((`sysctl hw.physmem | sed s/"hw.physmem: "//`/1024/1024)) detected=$((`sysctl hw.physmem | sed s/"hw.physmem: "//`/1024/1024))
elif [ $DIST_OS = "linux" ] elif [ $DIST_OS = "linux" ]
then then
detected=$((`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`/1024)) [ -r /proc/meminfo ] && detected=$((`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`/1024))
fi fi
# Exit codes only support values between 0 and 255. So use stdout. # Exit codes only support values between 0 and 255. So use stdout.
echo $detected echo $detected
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment