Brian O'Connor | 8a0c20e | 2015-09-16 22:54:24 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | ONOS_USER=sdn |
| 4 | |
| 5 | # Check to see if user exists, and if not, create a service account |
| 6 | getent passwd $ONOS_USER >/dev/null 2&>1 || ( useradd -M $ONOS_USER && usermod -L $ONOS_USER ) |
| 7 | |
| 8 | # Create ONOS options file |
| 9 | [ ! -f /opt/onos/options ] && cat << EOF > /opt/onos/options |
| 10 | export ONOS_OPTS=server |
| 11 | export ONOS_USER="$ONOS_USER" |
| 12 | EOF |
| 13 | |
| 14 | # Change permissions for onos directory |
| 15 | [ -d /opt/onos ] && chown -R $ONOS_USER.$ONOS_USER /opt/onos |
| 16 | |