mirror of
				https://github.com/casjaysdevdocker/gitea
				synced 2025-11-04 07:02:12 -05:00 
			
		
		
		
	🗃️ Committing everything that changed 🗃️
rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh
This commit is contained in:
		@@ -59,28 +59,28 @@ printf '%s\n' "# - - - Initializing $SERVICE_NAME - - - #"
 | 
				
			|||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
					# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
				
			||||||
# Custom functions
 | 
					# Custom functions
 | 
				
			||||||
__gen_auth_token() {
 | 
					__gen_auth_token() {
 | 
				
			||||||
  local user conf_file auth_token token_dir
 | 
					  set -x
 | 
				
			||||||
 | 
					  local user conf_file auth_token token_dir gitea_bin exitCode
 | 
				
			||||||
 | 
					  exitCode=1
 | 
				
			||||||
 | 
					  user="${GITEA_USER:-git}"
 | 
				
			||||||
  token_dir="$CONF_DIR/tokens"
 | 
					  token_dir="$CONF_DIR/tokens"
 | 
				
			||||||
 | 
					  gitea_bin="$(command -v gitea)"
 | 
				
			||||||
  mkdir -p "$token_dir" >/dev/null 2>&1
 | 
					  mkdir -p "$token_dir" >/dev/null 2>&1
 | 
				
			||||||
 | 
					  conf_file="$(find "/config" "/etc" -type f -name '*.ini' 2>/dev/null | grep -E 'git/app.ini|gitea/app.ini|gitea.ini' | head -n1 | grep '^')"
 | 
				
			||||||
  if [ -n "$SYS_AUTH_TOKEN" ]; then
 | 
					  if [ -n "$SYS_AUTH_TOKEN" ]; then
 | 
				
			||||||
    auth_token="$SYS_AUTH_TOKEN"
 | 
					    auth_token="$SYS_AUTH_TOKEN"
 | 
				
			||||||
  else
 | 
					  elif [ -s "$CONF_DIR/tokens/system" ]; then
 | 
				
			||||||
    user="${GITEA_USER:-git}"
 | 
					    auth_token="$(<"$CONF_DIR/tokens/system")"
 | 
				
			||||||
    conf_file="$(find "/config" "/etc" -type f -name '*.ini' 2>/dev/null | grep -E 'gitea/app.ini|gitea.ini' | head -n1 | grep '^')"
 | 
					 | 
				
			||||||
    if [ -f "$conf_file" ]; then
 | 
					 | 
				
			||||||
      if [ -f "$CONF_DIR/tokens/system" ]; then
 | 
					 | 
				
			||||||
        auth_token="$(<"$CONF_DIR/tokens/system")"
 | 
					 | 
				
			||||||
      else
 | 
					 | 
				
			||||||
        auth_token="$(sudo -u $user gitea --config "$conf_file" actions generate-runner-auth_token 2>/dev/null | grep -v '\.\.\.')"
 | 
					 | 
				
			||||||
      fi
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					  auth_token="$(echo "$auth_token" | grep -vE '# |^$')"
 | 
				
			||||||
 | 
					  auth_token="${auth_token:-$(gosu $user $gitea_bin --config "$conf_file" actions generate-runner-token 2>/dev/null | grep -vE '\.\.\.|# |^$')}"
 | 
				
			||||||
  if [ -n "$auth_token" ]; then
 | 
					  if [ -n "$auth_token" ]; then
 | 
				
			||||||
    echo "$token"
 | 
					    exitCode=0
 | 
				
			||||||
    echo "$token" >"$CONF_DIR/tokens/system"
 | 
					    echo "$auth_token"
 | 
				
			||||||
  else
 | 
					    echo "$auth_token" >"$CONF_DIR/tokens/system"
 | 
				
			||||||
    return 1
 | 
					 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					  set +x
 | 
				
			||||||
 | 
					  return $exitCode
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
					# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
				
			||||||
# Script to execute
 | 
					# Script to execute
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user