code.gitea.io/gitea@v1.21.7/build/test-env-check.sh (about)

     1  #!/bin/sh
     2  
     3  set -e
     4  
     5  if [ ! -f ./build/test-env-check.sh ]; then
     6    echo "${0} can only be executed in gitea source root directory"
     7    exit 1
     8  fi
     9  
    10  
    11  echo "check uid ..."
    12  
    13  # the uid of gitea defined in "https://gitea.com/gitea/test-env" is 1000
    14  gitea_uid=$(id -u gitea)
    15  if [ "$gitea_uid" != "1000" ]; then
    16    echo "The uid of linux user 'gitea' is expected to be 1000, but it is $gitea_uid"
    17    exit 1
    18  fi
    19  
    20  cur_uid=$(id -u)
    21  if [ "$cur_uid" != "0" -a "$cur_uid" != "$gitea_uid" ]; then
    22    echo "The uid of current linux user is expected to be 0 or $gitea_uid, but it is $cur_uid"
    23    exit 1
    24  fi