FIX with temp dir
This commit is contained in:
		| @@ -9,7 +9,9 @@ website_uri="https://dl.gitea.io/gitea" | ||||
| file_prefix="gitea" | ||||
| file_suffix="linux-amd64" | ||||
| install_dir="/usr/local/bin" | ||||
| temp_file="gitea.temp08154711" | ||||
| file_gitea="gitea" | ||||
| temp_folder="temp08154711" | ||||
| temp_file=${temp_folder}/${file_gitea} | ||||
|  | ||||
| # 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} ) | ||||
| @@ -39,24 +41,27 @@ else | ||||
| 	if [[ $REPLY =~ ^[YyJj]$ ]] | ||||
| 	then | ||||
| 		uri=${website_uri}/${version}/${file_prefix}-${version}-${file_suffix} | ||||
| 		wget -O ${temp_file} --show-progress ${uri} | ||||
| 		wget -O gitea.sha256 ${uri}.sha256 | ||||
| 		cd ${temp_folder} | ||||
| 		wget -O ${file_gitea} --show-progress ${uri} | ||||
| 		wget -O ${file_gitea}.sha256 ${uri}.sha256 | ||||
|  | ||||
| 		# strip gitea | ||||
|  | ||||
| 		sha256check=$( echo "$(cat gitea.sha256 | awk '{ print $1 }') ${temp_file}" | sha256sum --check ) | ||||
| 		sha256check=$( echo "$(cat gitea.sha256 | awk '{ print $1 }') ${file_gitea}" | sha256sum --check ) | ||||
| 		echo ${sha256check} | ||||
| 		check=$( echo ${sha256check} | awk '{ print $2 }' ) | ||||
| 		if [ "${check}" == "OK" ] | ||||
| 		then | ||||
| 			echo "SHA256 was checked and verified OK" | ||||
| 			sudo install --owner=git --group=git --mode=755 --strip ${temp_file} ${install_dir} | ||||
| 			sudo install --owner=git --group=git --mode=755 --strip ${file_gitea} ${install_dir} | ||||
|  | ||||
| 		else | ||||
| 			echo "There was a failure in the SHA256 file check." | ||||
| 		fi | ||||
| 		# remove local files: | ||||
| 		rm ${temp_file} gitea.sha256 | ||||
| 		cd .. | ||||
| 		rmdir ${temp_folder} | ||||
| 	fi | ||||
| fi | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user