Add missing makepkg-customizepkg script.

master
Icedream 2021-10-28 06:54:18 +02:00
parent 2a6aa07fc5
commit e9073bc102
Signed by: icedream
GPG Key ID: 468BBEEBB9EC6AEA
1 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# makepkg wrapper that calls customizepkg first
set -euf -o pipefail +o history
CURRENT_DIR_PATH="$(readlink -f "$(realpath -e "$(pwd)")")"
GLOBAL_CONF_DIR_PATH='/etc/customizepkg.d'
USER_CONF_DIR_PATH="${HOME}/.customizepkg"
pkgbuild_path="${CURRENT_DIR_PATH}/PKGBUILD"
pkgbuild_copy_path="${pkgbuild_path}.original"
function is_readable_file {
local file_path="${1:-''}"
local ret=1
if [[ (-n "$file_path") && (-f "$file_path") && (-r "$file_path") ]];then
ret=0
fi
return $ret
}
if is_readable_file "$pkgbuild_path" &&
! is_readable_file "$pkgbuild_copy_path";then
source "$pkgbuild_path"
if [[ -n "${pkgname:-''}" ]];then
global_conf_path="${GLOBAL_CONF_DIR_PATH}/${pkgname}"
user_conf_path="${USER_CONF_DIR_PATH}/${pkgname}"
if is_readable_file "$global_conf_path" ||
is_readable_file "$user_conf_path";then
customizepkg --modify
fi
fi
fi
exec /usr/bin/makepkg ${@}