From 5ea062862f20d1d5d8e040a7daccd5db9a20cb9f Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 30 Nov 2022 14:39:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E4=BA=86=E5=90=8C=E6=AD=A5=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E6=94=B9=E4=B8=BAwww?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/gitea/index.py | 8 ++++++-- plugins/gitea/init.d/gitea.service.tpl | 6 +++--- plugins/gitea/install.sh | 18 +++++++++--------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/plugins/gitea/index.py b/plugins/gitea/index.py index b716a4a4b..e6db81c5e 100755 --- a/plugins/gitea/index.py +++ b/plugins/gitea/index.py @@ -101,7 +101,7 @@ def getHomeDir(): "who | sed -n '2, 1p' |awk '{print $1}'")[0].strip() return '/Users/' + user else: - return 'git' + return 'www' def getRunUser(): @@ -110,7 +110,7 @@ def getRunUser(): "who | sed -n '2, 1p' |awk '{print $1}'")[0].strip() return user else: - return 'git' + return 'www' __SR = '''#!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin @@ -135,6 +135,10 @@ def initDreplace(): file_tpl = getInitdConfTpl() service_path = mw.getServerDir() + git_dir = mw.getServerDir() + '/git' + if not os.path.exists(git_dir): + mw.execShell('mkdir -p ' + git_dir) + initD_path = getServerDir() + '/init.d' if not os.path.exists(initD_path): os.mkdir(initD_path) diff --git a/plugins/gitea/init.d/gitea.service.tpl b/plugins/gitea/init.d/gitea.service.tpl index 7b1fba8fc..1bc231bc6 100644 --- a/plugins/gitea/init.d/gitea.service.tpl +++ b/plugins/gitea/init.d/gitea.service.tpl @@ -6,12 +6,12 @@ After=network.target [Service] RestartSec=2s Type=simple -User=git -Group=git +User=www +Group=www WorkingDirectory={$SERVER_PATH}/gitea ExecStart={$SERVER_PATH}/gitea/gitea web Restart=always -Environment=USER=git HOME=/home/git GITEA_WORK_DIR={$SERVER_PATH}/gitea +Environment=USER=www HOME=/home/www GITEA_WORK_DIR={$SERVER_PATH}/gitea RemainAfterExit=yes #AmbientCapabilities=CAP_NET_BIND_SERVICE #CapabilityBoundingSet=CAP_NET_BIND_SERVICE diff --git a/plugins/gitea/install.sh b/plugins/gitea/install.sh index 24e8f1241..b653a7c2d 100755 --- a/plugins/gitea/install.sh +++ b/plugins/gitea/install.sh @@ -32,18 +32,18 @@ Install_App() mkdir -p $serverPath/source/gitea - if id git &> /dev/null ;then - echo "git uid is `id -u git`" - echo "git shell is `grep "^git:" /etc/passwd |cut -d':' -f7 `" + if id www &> /dev/null ;then + echo "www uid is `id -u www`" + echo "www shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `" else - groupadd git - useradd -g git git + groupadd www + useradd -g www www fi if [ "macos" != "$OSNAME" ];then - if [ ! -d /home/git ];then - mkdir -p /home/git - chown -R git:git /home/git + if [ ! -d /home/www ];then + mkdir -p /home/www + chown -R www:www /home/www fi fi @@ -71,7 +71,7 @@ Install_App() mv $serverPath/source/gitea/$file $serverPath/gitea/gitea chmod +x $serverPath/gitea/gitea - chown -R git:git $serverPath/gitea + chown -R www:www $serverPath/gitea fi