better update_config

This commit is contained in:
j-hc 2023-10-21 20:09:52 +03:00
parent 411f5837ee
commit a25b2380ce
No known key found for this signature in database
GPG Key ID: B69B8F690911EFCC
2 changed files with 19 additions and 6 deletions

View File

@ -31,7 +31,6 @@ if [ "${2:-}" = "--config-update" ]; then
config_update
exit 0
fi
PREV_BUILDMD=$(cat build.md) || PREV_BUILDMD=""
: >build.md
ENABLE_MAGISK_UPDATE=$(toml_get "$main_config_t" enable-magisk-update) || ENABLE_MAGISK_UPDATE=true
@ -191,7 +190,7 @@ log "\n[revanced-magisk-module](https://github.com/j-hc/revanced-magisk-module)"
log "\nChangelog:"
log "$(cat $TEMP_DIR/*-rv/changelog.md)"
SKIPPED=$(sed '/Skipped:/,$d' <<<"$PREV_BUILDMD" | grep -F "Patches: " | grep -vE "$(grep -F "Patches: " build.md | cut -d/ -f1 | sed 's/ //g' | paste -sd '~' | sed 's;~;|;g')" || :)
SKIPPED=$(cat $TEMP_DIR/skipped || :)
if [ -n "$SKIPPED" ]; then
log "\nSkipped:"
log "$SKIPPED"

View File

@ -78,7 +78,8 @@ get_rv_prebuilts() {
local nm
nm=$(cut -d/ -f9 <<<"$rv_patches_url")
echo "Patches: $(cut -d/ -f4 <<<"$rv_patches_url")/$nm " >>"$patches_dir/changelog.md"
echo -e "[Changelog](https://github.com/${patches_src}/releases/tag/v$(sed 's/.*-\(.*\)\..*/\1/' <<<$nm))\n" >>"$patches_dir/changelog.md"
# shellcheck disable=SC2001
echo -e "[Changelog](https://github.com/${patches_src}/releases/tag/v$(sed 's/.*-\(.*\)\..*/\1/' <<<"$nm"))\n" >>"$patches_dir/changelog.md"
# echo -e "\n${rv_patches_changelog//# [/### [}\n---" >>"$patches_dir/changelog.md"
dl_if_dne "$rv_cli_jar" "$rv_cli_url" >&2 || return 1
@ -121,6 +122,12 @@ get_prebuilts() {
config_update() {
declare -A sources
: >$TEMP_DIR/skipped
local conf=""
# shellcheck disable=SC2154
conf+=$(sed '1d' <<<"$main_config_t")
conf+=$'\n'
local prcfg=false
for table_name in $(toml_get_table_names); do
if [ -z "$table_name" ]; then continue; fi
t=$(toml_get_table "$table_name")
@ -136,12 +143,19 @@ config_update() {
fi
last_patches=${last_patches_url##*/}
cur_patches=$(sed -n "s/.*Patches: ${PATCHES_SRC%%/*}\/\(.*\)/\1/p" build.md | xargs)
if [ "$cur_patches" ] && [ "$last_patches" ] && [ "${cur_patches}" != "$last_patches" ]; then
sources[$PATCHES_SRC]=1
echo "$t"
if [ "$cur_patches" ] && [ "$last_patches" ]; then
if [ "${cur_patches}" != "$last_patches" ]; then
sources[$PATCHES_SRC]=1
prcfg=true
conf+="$t"
conf+=$'\n'
else
echo "Patches: ${PATCHES_SRC%%/*}/${cur_patches} " >>$TEMP_DIR/skipped
fi
fi
fi
done
if [ "$prcfg" = true ]; then echo "$conf"; fi
}
_req() {