升級gitea

升級gitea 1.21.0 至 1.21.3



1. 備份

請參考官方

2.下載並解壓xz

URL=https://github.com/go-gitea/gitea/releases/latest/download/
urlprefix=$(curl -I "${URL}" | grep -i '^location:' | cut -b 10- - | tr -d '[:space:]')
version=$(basename "${urlprefix}")
xzfilename="gitea-${version#v}-linux-amd64.xz"
xzurl="${urlprefix}/${xzfilename}"
echo "latest url: ${urlprefix}"
echo "latest version: ${version#v}"e
echo "download from: ${xzurl}"
echo "${xzfilename%.*}"
wget "${xzurl}" && \
xz -d "${xzfilename}" && \
chmod +x "${xzfilename%.*}" && \
sudo mv "${xzfilename%.*}" /usr/local/bin/ && \
ls -l /usr/local/bin/


curl -I "${URL}" 抓取header部份

grep -i 忽略大小寫location

cut -b 10- - 從第10個byte開始取到結尾, 從stdin輸入資料

tr -d '[:space:]' 移除頭尾空白

basename "${urlprefix}" 取檔名部份

${version#v}移除起頭的v

"${xzfilename%.*}" 去除最後的.與之後的內容(即副檔名)


3. 連結到新的執行檔

cd /usr/local/bin/
sudo rm gitea
sudo ln -s "${xzfilename%.*}" gitea
sudo chown root:root "${xzfilename%.*}"
ls -l gitea

4. 重啟服務

sudo systemctl restart gitea.service
sudo systemctl status gitea.service


5. 確認服務正常

登入/執行actions/登出


留言