diff --git a/CT-Build/Alpine.yaml b/CT-Build/Alpine.yaml index 9402d72..8586ca2 100644 --- a/CT-Build/Alpine.yaml +++ b/CT-Build/Alpine.yaml @@ -433,7 +433,8 @@ packages: #PKGS for Gitea - packages: - - py3-pip + - curl + - jq - xz - git - bash diff --git a/CT-Files/gitea/Configs/auto-update.ini b/CT-Files/gitea/Configs/auto-update.ini deleted file mode 100644 index ddf5e1c..0000000 --- a/CT-Files/gitea/Configs/auto-update.ini +++ /dev/null @@ -1,10 +0,0 @@ -[Gitea] -site=http://localhost:3000/api/v1/version -apiUrl=https://api.github.com/repos/go-gitea/gitea/releases/latest -system=linux-amd64 -file=/usr/local/bin/gitea -tmpDir=/tmp/ -buildFromSource= -sourceDir= -logFile=/var/log/gitupdate.log - diff --git a/CT-Files/gitea/Scripts/Init.sh b/CT-Files/gitea/Scripts/Init.sh index ce913b6..e5f4756 100644 --- a/CT-Files/gitea/Scripts/Init.sh +++ b/CT-Files/gitea/Scripts/Init.sh @@ -1,12 +1,6 @@ #!/bin/ash -#Vars -apiUrl=https://api.github.com/repos/go-gitea/gitea/releases/latest - -#install Update tool -pip install --break-system-packages gitea-auto-update - #Get latest gitea version info -giteaver=$(python3 -c "import requests; print (requests.get('$apiUrl').json()['tag_name'])") +giteaver=$(curl --retry 7 --retry-delay 5 -Ls https://api.github.com/repos/go-gitea/gitea/releases/latest |jq -r .tag_name) giteaver=${giteaver//v} @@ -23,12 +17,12 @@ mkdir -p /etc/gitea #Download Gitea binary echo "Downloading gitea binary..." -python3 -c "import requests; url = 'https://dl.gitea.io/gitea/"$giteaver"/gitea-"$giteaver"-linux-amd64'; r = requests.get(url, allow_redirects=True); open('/usr/local/bin/gitea', 'wb').write(r.content)" +curl --retry 7 --retry-delay 5 -L https://dl.gitea.io/gitea/"$giteaver"/gitea-"$giteaver"-linux-amd64 -O /usr/local/bin/gitea #Moving configs in place mv /opt/Setup/Configs/app.ini /etc/gitea/app.ini -mv /opt/Setup/Configs/auto-update.ini /etc/gitea/auto-update.ini mv /opt/Setup/Configs/gitea.service /etc/init.d/gitea +mv /opt/Setup/Scripts/Update-Gitea.sh /opt/Update-Gitea.sh #Set folder permissions chown -R git:git /gitea-data @@ -39,10 +33,4 @@ chmod -R 750 /var/lib/gitea/ chmod +x /usr/local/bin/gitea chmod +x /etc/init.d/gitea chmod 750 /etc/gitea -chmod 640 /etc/gitea/app.ini - -#Fix Gitea-auto-updater to support OpenRC -sed -i -e 's/systemctl start gitea.service/service gitea start/' -e 's/systemctl stop gitea.service/service gitea stop/' /usr/lib/python3.*/site-packages/gitea_auto_update/update.py - -#Gitea update Sript -echo "gitea-auto-update --settings=/etc/gitea/auto-update.ini" > /opt/UpdateGitea.sh \ No newline at end of file +chmod 640 /etc/gitea/app.ini \ No newline at end of file diff --git a/CT-Files/gitea/Scripts/PTKAppUpdate.sh b/CT-Files/gitea/Scripts/PTKAppUpdate.sh index e7d1a20..46b746e 100644 --- a/CT-Files/gitea/Scripts/PTKAppUpdate.sh +++ b/CT-Files/gitea/Scripts/PTKAppUpdate.sh @@ -1,3 +1,3 @@ #!/bin/sh # Update script for updating apps with ProxmoxHelper/ProxMoxToolKit -ash /opt/UpdateGitea.sh \ No newline at end of file +ash /opt/Update-Gitea.sh \ No newline at end of file diff --git a/CT-Files/gitea/Scripts/Update-Gitea.sh b/CT-Files/gitea/Scripts/Update-Gitea.sh new file mode 100644 index 0000000..b59a96c --- /dev/null +++ b/CT-Files/gitea/Scripts/Update-Gitea.sh @@ -0,0 +1,27 @@ +#!/bin/ash +#Check if Gitea is running +case $(service gitea status) in + *started*);; + *) + echo "Gitea is not running, exiting" + exit ;; +esac + +#Check internet connection +if ! ping -c 2 api.github.com &> /dev/null; then echo "No internet connection detected, exiting";exit ;fi + +#Get latest vesion +NewGiteaVer=$(curl --retry 7 --retry-delay 5 -Ls https://api.github.com/repos/go-gitea/gitea/releases/latest |jq -r .tag_name) +CurGiteaVer=$(curl --retry 7 --retry-delay 5 -Ls http://localhost:3000/api/v1/version |jq -r .version) +#Compare versions to check for update +if [ "$NewGiteaVer" = "$CurGiteaVer" ] ; then + echo 'Gitea up-to-date' + exit +else +echo 'Updating Gitea' + service gitea stop + mv /usr/local/bin/gitea /usr/local/bin/gitea.old + curl --retry 7 --retry-delay 5 -L https://dl.gitea.io/gitea/"${NewGiteaVer//v}"/gitea-"${NewGiteaVer//v}"-linux-amd64 -o /usr/local/bin/gitea + chmod +x /usr/local/bin/gitea + service gitea start +fi \ No newline at end of file diff --git a/CT-Files/nodered/Scripts/Init.sh b/CT-Files/nodered/Scripts/Init.sh index 904f9d7..90a1f89 100644 --- a/CT-Files/nodered/Scripts/Init.sh +++ b/CT-Files/nodered/Scripts/Init.sh @@ -11,6 +11,7 @@ npm install --prefix /opt/node/node-red/app node-red @node-red-contrib-themes/th pm2 install pm2-logrotate pm2 start --name nodered --cwd /opt/node/node-red/app ./node_modules/node-red/red.js -- -u /opt/node/node-red/data pm2 save +sleep 5 pm2 kill #Enable node-red dark theme sed -i -e 's#//theme: "",#theme: "midnight-red",#g' /opt/node/node-red/data/settings.js