#!/bin/sh

[ -e /usr/lib/node_modules ] || mkdir /usr/lib/node_modules

[ -L /usr/lib/node_modules/node-red ] ||
  ln -s /opt/nodered/lib/node_modules/node-red /usr/lib/node_modules/node-red

[ -e /var/data/node-red ] || mkdir /var/data/node-red

cd /opt
for d in nodered*; do
  if [ -d "$d" -a "$d" != "nodered" ]; then
    /opt/$d/etc/install norestart
  fi
done
