mirror of
https://github.com/YunoHost-Apps/gitea_ynh.git
synced 2024-09-03 20:36:22 +02:00
enhancing patching mechanism
This commit is contained in:
parent
c342c77e78
commit
21dc0e8b4e
1 changed files with 36 additions and 13 deletions
49
.github/workflows/updater.sh
vendored
49
.github/workflows/updater.sh
vendored
|
@ -10,10 +10,27 @@
|
|||
# automatic actions when a new upstream release is detected.
|
||||
|
||||
update_source_file() {
|
||||
# Rewrite source file
|
||||
sed -i "s@SOURCE_URL=.*@SOURCE_URL=$asset_url@" "$path"
|
||||
sed -i "s@SOURCE_SUM=.*@SOURCE_SUM=$checksum@" "$path"
|
||||
echo "... $path"
|
||||
# Rewrite source file
|
||||
sed -i "s@SOURCE_URL=.*@SOURCE_URL=$asset_url@" "$path"
|
||||
sed -i "s@SOURCE_SUM=.*@SOURCE_SUM=$checksum@" "$path"
|
||||
echo "... $path"
|
||||
}
|
||||
|
||||
|
||||
# if the armv7 source file has not been updated, fill it with the armv6 info
|
||||
# it's to patch the lack of armv7 build due to a bug
|
||||
|
||||
patch_source_file() {
|
||||
local patch_from_path=$1
|
||||
local patch_to_path=$2
|
||||
|
||||
# if it's different from the new version available, patch the file
|
||||
echo "Patching '$patch_to_path' with '$patch_from_path'."
|
||||
path="$patch_to_path"
|
||||
asset_url="$(grep -Eo 'SOURCE_URL=.*' "$patch_from_path" | cut -d'=' -f2)"
|
||||
checksum="$(grep -Eo 'SOURCE_SUM=.*' "$patch_from_path" | cut -d'=' -f2)"
|
||||
update_source_file
|
||||
echo "Patching done."
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
@ -130,14 +147,7 @@ checksum=$(< "$tempdir/$filename.sha256" awk '{print $1;}')
|
|||
|
||||
path="conf/source/$src.src"
|
||||
|
||||
# patching the armv7 file with the armv6 bin version
|
||||
if [ "$src" = "arm" ]; then
|
||||
update_source_file
|
||||
path="conf/source/armv7.src"
|
||||
update_source_file
|
||||
else
|
||||
update_source_file
|
||||
fi
|
||||
update_source_file
|
||||
|
||||
else
|
||||
echo "... asset ignored"
|
||||
|
@ -148,6 +158,13 @@ done
|
|||
echo "Upgrade done."
|
||||
|
||||
|
||||
# retrieving the actual version in the config file
|
||||
patch_version="$(grep -Eo 'SOURCE_URL=.*' conf/source/armv7.src | cut -d'v' -f2 | cut -d'/' -f1)"
|
||||
if [ "$current_version" != "$patch_version" ]; then
|
||||
patch_source_file "conf/source/arm.src" "conf/source/armv7.src"
|
||||
fi
|
||||
|
||||
|
||||
last_main_version="${current_version%.*}"
|
||||
main_version="${version%.*}"
|
||||
|
||||
|
@ -168,7 +185,7 @@ if [ "$last_main_version" != "$main_version" ]; then
|
|||
if [ "$i" = "arm" ]; then
|
||||
asset_url="https://github.com/$repo/releases/download/v$last_main_version_full/gitea-$last_main_version_full-linux-arm-6"
|
||||
elif [ "$i" = "armv7" ]; then
|
||||
asset_url="https://github.com/$repo/releases/download/v$last_main_version_full/gitea-$last_main_version_full-linux-arm-6"
|
||||
asset_url="https://github.com/$repo/releases/download/v$last_main_version_full/gitea-$last_main_version_full-linux-arm-7"
|
||||
elif [ "$i" = "arm64" ]; then
|
||||
asset_url="https://github.com/$repo/releases/download/v$last_main_version_full/gitea-$last_main_version_full-linux-arm64"
|
||||
elif [ "$i" = "i386" ]; then
|
||||
|
@ -185,6 +202,12 @@ if [ "$last_main_version" != "$main_version" ]; then
|
|||
|
||||
done
|
||||
|
||||
# retrieving the actual version in the config file
|
||||
patch_version="$(grep -Eo 'SOURCE_URL=.*' "conf/source/armv7_${last_main_version}.src" | cut -d'v' -f2 | cut -d'/' -f1)"
|
||||
if [ "$current_version" != "$patch_version" ]; then
|
||||
patch_source_file "conf/source/arm_${last_main_version}.src" "conf/source/armv7_${last_main_version}.src"
|
||||
fi
|
||||
|
||||
echo "Creation of source files for migration completed"
|
||||
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue