FIX gitea update, problem when there is a directory named gitea exists.
This commit is contained in:
parent
88072138d4
commit
8f9c0a3ed4
@ -9,6 +9,7 @@ website_uri="https://dl.gitea.io/gitea"
|
|||||||
file_prefix="gitea"
|
file_prefix="gitea"
|
||||||
file_suffix="linux-amd64"
|
file_suffix="linux-amd64"
|
||||||
install_dir="/usr/local/bin"
|
install_dir="/usr/local/bin"
|
||||||
|
temp_file="gitea.temp08154711"
|
||||||
|
|
||||||
# get the latest version with the website_latest uri to github:
|
# get the latest version with the website_latest uri to github:
|
||||||
website_version_raw=$( curl -Ls -I -o /dev/null -w %{url_effective} ${website_latest} )
|
website_version_raw=$( curl -Ls -I -o /dev/null -w %{url_effective} ${website_latest} )
|
||||||
@ -31,31 +32,31 @@ if [ "${version}" == "${version_active}" ]
|
|||||||
then
|
then
|
||||||
echo "Both version strings are the same."
|
echo "Both version strings are the same."
|
||||||
else
|
else
|
||||||
echo "There are differnces between the two version strings."
|
echo "There are differences between the two version strings."
|
||||||
echo "Start updating..."
|
echo "Start updating..."
|
||||||
read -p "Are you sure? (y/N)" -n 1 -r
|
read -p "Are you sure? (y/N)" -n 1 -r
|
||||||
echo # (optional) move to a new line
|
echo # (optional) move to a new line
|
||||||
if [[ $REPLY =~ ^[YyJj]$ ]]
|
if [[ $REPLY =~ ^[YyJj]$ ]]
|
||||||
then
|
then
|
||||||
uri=${website_uri}/${version}/${file_prefix}-${version}-${file_suffix}
|
uri=${website_uri}/${version}/${file_prefix}-${version}-${file_suffix}
|
||||||
wget -O gitea --show-progress ${uri}
|
wget -O ${temp_file} --show-progress ${uri}
|
||||||
wget -O gitea.sha256 ${uri}.sha256
|
wget -O gitea.sha256 ${uri}.sha256
|
||||||
|
|
||||||
# strip gitea
|
# strip gitea
|
||||||
|
|
||||||
sha256check=$( echo "$(cat gitea.sha256 | awk '{ print $1 }') gitea" | sha256sum --check )
|
sha256check=$( echo "$(cat gitea.sha256 | awk '{ print $1 }') ${temp_file}" | sha256sum --check )
|
||||||
echo ${sha256check}
|
echo ${sha256check}
|
||||||
check=$( echo ${sha256check} | awk '{ print $2 }' )
|
check=$( echo ${sha256check} | awk '{ print $2 }' )
|
||||||
if [ "${check}" == "OK" ]
|
if [ "${check}" == "OK" ]
|
||||||
then
|
then
|
||||||
echo "SHA256 was checked and verified OK"
|
echo "SHA256 was checked and verified OK"
|
||||||
sudo install --owner=git --group=git --mode=755 --strip gitea ${install_dir}
|
sudo install --owner=git --group=git --mode=755 --strip ${temp_file} ${install_dir}
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "There was a failure in the SHA256 file check."
|
echo "There was a failure in the SHA256 file check."
|
||||||
fi
|
fi
|
||||||
# remove local files:
|
# remove local files:
|
||||||
rm gitea gitea.sha256
|
rm ${temp_file} gitea.sha256
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user