Fix rename

This commit is contained in:
root
2024-03-11 19:29:21 +03:00
parent d34a8c5b76
commit 227e4af199

75
gitea-loader.sh Executable file
View File

@@ -0,0 +1,75 @@
#!/bin/bash
GITEALATESTVERSION="$(curl https://dl.gitea.com/gitea/version.json 2>/dev/null | jq -r .latest.version)"
#GITEALATESTVERSION="1.20"
GITEALATESTFILE="gitea-${GITEALATESTVERSION}-linux-amd64"
GITEALATESTURLXZ="https://dl.gitea.com/gitea/${GITEALATESTVERSION}/${GITEALATESTFILE}.xz"
GITEALATESTURLXZASC="https://dl.gitea.com/gitea/${GITEALATESTVERSION}/${GITEALATESTFILE}.xz.asc"
GITEALOCALAPPBIN="/opt/gitea/app/bin"
#echo $GITEALATESTURLXZASC
#exit
if [ ! -d "${GITEALOCALAPPBIN}" ]; then
echo "Directory ${GITEALOCALAPPBIN} not found"
exit 1
fi
if [ x"$1" == x"--self-install" ]; then
ln -s "../../../gitea-loader.git/gitea-loader.sh" "${GITEALOCALAPPBIN}/gitea-loader.sh" && {
echo "Success installed ${GITEALOCALAPPBIN}/gitea-loader.sh"
exit 0
} || {
exit 1
}
fi
jq --version > /dev/null 2>&1 || {
echo "Command jq not found"
exit 1
}
while true; do
if [ -f "${GITEALOCALAPPBIN}/${GITEALATESTFILE}.xz" ]; then
echo "Gitea version ${GITEALATESTVERSION} exists"
exit 0
fi
# gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
# gpg --verify gitea-1.20-linux-amd64.xz.asc gitea-1.20-linux-amd64.xz && {
# echo ok
# } || {
# echo no
# }
break
done
echo "Download gitea version ${GITEALATESTVERSION}"
curl "${GITEALATESTURLXZ}" 2>/dev/null > "${GITEALOCALAPPBIN}/${GITEALATESTFILE}.xz.part" && {
echo "Success"
mv "${GITEALOCALAPPBIN}/${GITEALATESTFILE}.xz.part" "${GITEALOCALAPPBIN}/${GITEALATESTFILE}.xz"
} || {
echo "Failed"
rm "${GITEALOCALAPPBIN}/${GITEALATESTFILE}.xz.part"
exit 1
}
echo "Extract gitea version ${GITEALATESTVERSION}"
xz -cd "${GITEALOCALAPPBIN}/${GITEALATESTFILE}.xz" > "${GITEALOCALAPPBIN}/${GITEALATESTFILE}.part" && {
echo "Success"
mv "${GITEALOCALAPPBIN}/${GITEALATESTFILE}.part" "${GITEALOCALAPPBIN}/${GITEALATESTFILE}"
} || {
echo "Failed"
rm "${GITEALOCALAPPBIN}/${GITEALATESTFILE}"
exit 1
}
chmod +x "${GITEALOCALAPPBIN}/${GITEALATESTFILE}"