github.com/ipni/storetheindex@v0.8.30/assigner/scripts/start_assigner (about)

     1  #!/bin/sh
     2  #
     3  # This script is the entrypoint for the assigner docker container
     4  set -e
     5  user=storetheindex
     6  repo="$ASSIGNER_PATH"
     7  
     8  if [ `id -u` -eq 0 ]; then
     9    echo "Changing user to $user"
    10    # ensure folder is writable
    11    su-exec "$user" test -w "$repo" || chown -R -- "$user" "$repo"
    12    # restart script with new privileges
    13    exec su-exec "$user" "$0" "$@"
    14  fi
    15  
    16  # 2nd invocation with regular user
    17  
    18  if [ -e "$repo/config" ]; then
    19    echo "Found assigner repo at $repo"
    20  else
    21    assigner init
    22  fi
    23  
    24  exec assigner "$@"