makepkg-customizepkg: Fix packages sometimes not being modified at all.

master
Icedream 2023-08-14 11:09:37 +02:00
parent a329075c4c
commit fcdb4dc18c
Signed by: icedream
GPG Key ID: 468BBEEBB9EC6AEA
1 changed files with 18 additions and 11 deletions

View File

@ -10,6 +10,8 @@ USER_CONF_DIR_PATH="${HOME}/.customizepkg"
pkgbuild_path="${CURRENT_DIR_PATH}/PKGBUILD" pkgbuild_path="${CURRENT_DIR_PATH}/PKGBUILD"
pkgbuild_copy_path="${pkgbuild_path}.original" pkgbuild_copy_path="${pkgbuild_path}.original"
args=("$@")
function is_readable_file { function is_readable_file {
local file_path="${1:-''}" local file_path="${1:-''}"
local ret=1 local ret=1
@ -20,16 +22,21 @@ function is_readable_file {
} }
if is_readable_file "$pkgbuild_path" && if is_readable_file "$pkgbuild_path" &&
! is_readable_file "$pkgbuild_copy_path";then [ $(git status --porcelain --no-renames PKGBUILD | wc -l) -lt 1 ]; then
eval $(grep -Pazo '[^[:print:]][[:blank:]]*_?(pkg.*|name)=(\((.|\n)*?\)|.*?(?=\x0a))' ./PKGBUILD | sed 's, #.*$,,' | grep -Eva '\$\(|`|pkgdesc') # ! is_readable_file "$pkgbuild_copy_path";then
if [[ -n "${pkgname:-''}" ]];then
global_conf_path="${GLOBAL_CONF_DIR_PATH}/${pkgname}" #eval $(grep -Pazo '[^[:print:]][[:blank:]]*_?(pkg.*|name)=(\((.|\n)*?\)|[^#]*?(?= *#|\x0a))' ./PKGBUILD | grep -Eva '\$\(|`|pkgdesc')
user_conf_path="${USER_CONF_DIR_PATH}/${pkgname}"
if is_readable_file "$global_conf_path" || #if [[ -n "${pkgname:-''}" ]];then
is_readable_file "$user_conf_path";then # global_conf_path="${GLOBAL_CONF_DIR_PATH}/${pkgname}"
customizepkg --modify # user_conf_path="${USER_CONF_DIR_PATH}/${pkgname}"
fi # if is_readable_file "$global_conf_path" ||
fi # is_readable_file "$user_conf_path";then
git checkout HEAD PKGBUILD
customizepkg --modify >&2
#touch "${was_already_patched_path}"
# fi
#fi
fi fi
exec /usr/bin/makepkg ${@} exec makepkg "${args[@]}"