diff options
Diffstat (limited to 'libremakepkg')
-rwxr-xr-x | libremakepkg | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/libremakepkg b/libremakepkg index b2f8aa8..0baaed2 100755 --- a/libremakepkg +++ b/libremakepkg @@ -32,7 +32,6 @@ function usage { echo ' -h show this message.' echo ' -c cleans the chroot before building.' echo ' -u updates the chroot before building.' - echo ' -U copy pacman, makepkg, and mtag config files to the chroot' echo ' -n use this dir instead of "${CHCOPY}".' echo ' -M <--arg> passes long args to makepkg, use it as many times as needed.' echo @@ -40,18 +39,11 @@ function usage { function buildenv { msg "Building env" - for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST} ${WORKDIR}; do + for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST}; do msg2 "binding ${mp} to ${CHROOTDIR}/${CHCOPY}${mp}" mkdir -p "${CHROOTDIR}/${CHCOPY}${mp}" mount -o bind ${mp} "${CHROOTDIR}/${CHCOPY}${mp}" || exit 1 done - - if [ "$update_config" = 'y' ] ; then - for config in etc/makepkg.conf etc/pacman.conf etc/mtab; do - msg2 "copying config /$config to ${CHROOTDIR}/${CHCOPY}/${config}" - cp --remove-destination /${config} ${CHROOTDIR}/${CHCOPY}/${config} || exit 1 - done - fi } # Clean packages with pacman @@ -81,6 +73,13 @@ EOF mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" } +copy_log() { + if [ "${USE_LOG}" == 'y' ]; then + find ${CHROOTDIR}/${CHROOTNAME}/build/ -name "*\.log" -exec cp {} ./ \; + fi +} + + # End inmediately but print a useful message trap_exit() { @@ -88,6 +87,8 @@ trap_exit() { umount "${CHROOTDIR}/${CHCOPY}${mp}" done + copy_log + error "$@" exit 1 @@ -106,7 +107,6 @@ UPDATE_FIRST="n" USE_LOG='n' CHROOTNAME=${CHCOPY} MAKEPKG_ARGS="" -update_config='n' #libremakepkg own args libremakepkgargs='hcuUn:I:M:' @@ -118,7 +118,6 @@ while getopts ${libremakepkgargs} arg ; do h) usage; exit 0 ;; c) CLEAN_FIRST="y" ;; u) UPDATE_FIRST="y" ;; - U) update_config='y' ;; n) CHROOTNAME="$OPTARG" ;; M) MAKEPKG_ARGS+=" $OPTARG" ;; L) MAKEPKG_ARGS+=" -$arg $OPTARG" @@ -159,8 +158,6 @@ msg "Creating the package" makechrootpkg -r "${CHROOTDIR}" -l "${CHROOTNAME}" -- "${MAKEPKG_ARGS}" ev=$? # exit value -if [ "${USE_LOG}" == 'y' ]; then - find ${CHROOTDIR}/${CHROOTNAME}/build/ -name "*\.log" -exec cp {} ./ \; -} +copy_log exit $ev |