To check for Raspbian read the file /etc/os-release and check for ID=raspbian.
PRETTY_NAME="Raspbian GNU/Linux jessie/sid"
NAME="Raspbian GNU/Linux"
ID=raspbian
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
To check for a Pi read the file /proc/cpuinfo and check for hardware BCM2708.
processor : 0
model name : ARMv6-compatible processor rev 7 (v6l)
Features : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7
Hardware : BCM2708
Revision : 0010
Serial : 00000000f7094d77