Updated sms to detect env and install self on attached device