feat: add src_check and src_install, exit if src_check fails
This commit is contained in:
parent
cd8d4135c0
commit
d0a3aea8fa
17
leaf
17
leaf
@ -41,7 +41,7 @@ main() {
|
||||
else
|
||||
local _item
|
||||
case $1 in
|
||||
prepare|build|install|remove|pack)
|
||||
prepare|build|install|force-install|remove|pack)
|
||||
leaf_check_permission
|
||||
for _item in "${@:2}"; do
|
||||
leaf_find_pkgbuild "${_item}"
|
||||
@ -335,6 +335,16 @@ leaf_prepare_package() {
|
||||
leaf_build_package() {
|
||||
leaf_prepare_package
|
||||
src_build
|
||||
|
||||
if ! src_check; then
|
||||
if [ "${FORCE_INSTALL}" == "1" ]; then
|
||||
echo -e "${RED_COLOR}* Tests failed, but is in force-install mode.${CLEAR_COLOR}"
|
||||
else
|
||||
leaf_error "Tests failed, please check. Aborting installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
src_install
|
||||
local _option
|
||||
for _option in $(echo ${!BUILD_OPTIONS[*]}); do
|
||||
if [[ x"${_option}" == x"strip" ]] && [[ x"${BUILD_OPTIONS[$_option]}" == x"1" ]]; then
|
||||
@ -363,6 +373,11 @@ leaf_install_package() {
|
||||
echo -e "${GREEN_COLOR}* Package ${PKG_PREFIX}/${PKG_NAME} has been installed${CLEAR_COLOR}\n"
|
||||
}
|
||||
|
||||
leaf_force-install_package(){
|
||||
FORCE_INSTALL=1
|
||||
leaf_install_package
|
||||
}
|
||||
|
||||
leaf_remove_package() {
|
||||
[ -n "$(grep "${PKG_PREFIX}/${PKG_NAME}" ${INSTALLED_PACKAGES})" ] || {
|
||||
leaf_error "Package ${PKG_PREFIX}/${PKG_NAME} is NOT installed"
|
||||
|
Loading…
Reference in New Issue
Block a user