5 if ! grep "^arvbox:" /etc/passwd >/dev/null 2>/dev/null ; then
6 HOSTUID=$(ls -nd /usr/src/arvados | sed 's/ */ /' | cut -d' ' -f4)
7 HOSTGID=$(ls -nd /usr/src/arvados | sed 's/ */ /' | cut -d' ' -f5)
8 FUSEGID=$(ls -nd /dev/fuse | sed 's/ */ /' | cut -d' ' -f5)
10 mkdir -p /var/lib/arvados/git /var/lib/gems /var/lib/passenger
12 groupadd --gid $HOSTGID --non-unique arvbox
13 groupadd --gid $FUSEGID --non-unique fuse
14 groupadd --gid $HOSTGID --non-unique git
15 useradd --home-dir /var/lib/arvados \
16 --uid $HOSTUID --gid $HOSTGID \
18 --groups docker,fuse \
20 useradd --home-dir /var/lib/arvados/git --uid $HOSTUID --gid $HOSTGID --non-unique git
21 useradd --groups docker,fuse crunch
23 chown arvbox:arvbox -R /usr/local /var/lib/arvados /var/lib/gems \
24 /var/lib/passenger /var/lib/postgresql \
25 /var/lib/nginx /var/log/nginx /etc/ssl/private
27 mkdir -p /var/lib/gems/ruby/2.1.0
28 chown arvbox:arvbox -R /var/lib/gems/ruby/2.1.0
30 mkdir -p /tmp/crunch0 /tmp/crunch1
31 chown crunch:crunch -R /tmp/crunch0 /tmp/crunch1
33 echo "arvbox ALL=(crunch) NOPASSWD: ALL" >> /etc/sudoers