修复无法更新 V2ray 导致的进程出错
This commit is contained in:
parent
f483d38a3c
commit
ccab3263d6
|
@ -161,18 +161,22 @@ Update_Makefile() {
|
|||
api_URL="https://api.github.com/repos/${_process2}/releases"
|
||||
PKG_DL_URL="https://codeload.github.com/${_process2}/tar.gz/v"
|
||||
Offical_Version="$(curl -s ${api_URL} 2>/dev/null | grep 'tag_name' | egrep -o '[0-9].+[0-9.]+' | awk 'NR==1')"
|
||||
if [[ -z "${Offical_Version}" ]] && [[ ! "$?" -eq 0 ]];then
|
||||
echo "Failed to obtain the Offical version,skip update ..."
|
||||
return
|
||||
fi
|
||||
Source_Version="$(grep "PKG_VERSION:=" ${Makefile} | cut -c14-20)"
|
||||
Source_HASH="$(grep "PKG_HASH:=" ${Makefile} | cut -c11-100)"
|
||||
echo -e "Current ${PKG_NAME} version: ${Source_Version}\nOffical ${PKG_NAME} version: ${Offical_Version}"
|
||||
if [[ ! "${Source_Version}" == "${Offical_Version}" ]];then
|
||||
if [[ ! "${Source_Version}" == "${Offical_Version}" ]] && [[ ! "$?" -eq 0 ]];then
|
||||
echo -e "Updating package ${PKG_NAME} [${Source_Version}] to [${Offical_Version}] ..."
|
||||
sed -i "s?PKG_VERSION:=${Source_Version}?PKG_VERSION:=${Offical_Version}?g" ${Makefile}
|
||||
wget -q "${PKG_DL_URL}${Offical_Version}?" -O /tmp/tmp_file
|
||||
if [[ $? == 0 ]];then
|
||||
if [[ "$?" -eq 0 ]];then
|
||||
Offical_HASH=$(sha256sum /tmp/tmp_file | cut -d ' ' -f1)
|
||||
sed -i "s?PKG_HASH:=${Source_HASH}?PKG_HASH:=${Offical_HASH}?g" ${Makefile}
|
||||
else
|
||||
echo "Update package [${PKG_NAME}] error,skip update ..."
|
||||
echo "Failed to update the package [${PKG_NAME}],skip update ..."
|
||||
fi
|
||||
fi
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue