#!/bin/sh
memreqd=131072; #128 MB
if [ -f /proc/meminfo -a -z "${SYMFORM_SKIP_MEMCHECK}" \
     -a ! -z "${SYNOPKG_TEMP_LOGFILE}" ]; then
    kbmemtotal=$( awk '/^MemTotal/{print $2}'  /proc/meminfo)
    if [ ${kbmemtotal} -lt ${memreqd} ]; then
        cat > "${SYNOPKG_TEMP_LOGFILE}" << EOF
Symform has detected that this device does not meet Symform's minimum system requirements for memory. Please consider installing Symform on a Synology device with 256MB or more of memory. For more information, please see our system requirements page: <a href="http://www.symform.com/join-the-revolution/getting-started/system-requirements/">http://www.symform.com/join-the-revolution/getting-started/system-requirements/</a>
EOF
        exit 1
    fi
fi
exit 0
