diff options
author | Nicolas Reynolds <fauno@kiwwwi.com.ar> | 2011-05-22 11:13:52 -0300 |
---|---|---|
committer | Nicolas Reynolds <fauno@kiwwwi.com.ar> | 2011-05-22 11:13:52 -0300 |
commit | 4f1392d774c081a03d9abab0c731704880d54d4c (patch) | |
tree | abfa5f7c1dc185ddfbf2957b8094feb925a432b2 /libremakepkg | |
parent | 50435a2614fe7f28e47164082e846b0a57c7f48c (diff) | |
parent | 3c53f6e6e8a9dc767680c5a53969e3d9aa3c5d81 (diff) |
Merge branch 'master' of ssh://vparabola/srv/git/projects/libretools
Conflicts:
libremessages
Diffstat (limited to 'libremakepkg')
-rwxr-xr-x | libremakepkg | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/libremakepkg b/libremakepkg index 8cce89d..8af1581 100755 --- a/libremakepkg +++ b/libremakepkg @@ -1,5 +1,6 @@ #!/bin/bash -# Copyright 2010 Nicolás Reynolds +# Copyright 2010 - 2011 Nicolás Reynolds +# Copyright 2011 Joshua Ismael Haase Hernández # ---------- GNU General Public License 3 ---------- @@ -20,6 +21,42 @@ source /etc/libretools.conf +function usage { + echo "cd to a dir containing a PKGBUILD and run:" + echo "$0 [options] [makepkg args]" + echo "This script will build your package on a chroot." + echo + echo "OPTIONS:" + echo + echo " -h : show this message." + echo " -c : cleans CHCOPY before building." + echo " -u : updates CHROOT before building." + echo " -n : use this dir instead of CHCOPY." + echo " -I pkgname : install this package, use it as many times needed." + echo +} + +_CLEAN="" +CLEAN_CACHE="" +update_first="n" +chrootname=${CHCOPY} +_PKGINSTALL="" +#libremakepkg own args +libremakepkgargs='hcun:I:' +#now makepkg args +libremakepkgargs+='ACdefiLmop:rRs' + +while getopts ${libremakepkgargs} arg ; do + case "${arg}" in + h) usage; exit 0 ;; + c) _CLEAN="-c" ;; + u) update_first="y" ;; + n) chrootname="$OPTARG"; echo $chrootname ;; + I) _PKGINSTALL+="-I $OPTARG " ;; + *) _MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;; + esac +done + if [ $UID -ne 0 ]; then error "This script must be run as root" exit 1 @@ -27,24 +64,20 @@ fi msg "Checking PKGBUILD for non-free issues" pkgbuild-check-nonfree ||{ - if [[$?=15]]; then + if [[ $? -eq 15 ]]; then error "PKGBUILD contains non-free issues" exit 15 - else - error "Check failed, continuing" fi } -[[ -z $1 ]] && { - CLEAN="-c" - +if [ $update_first = y ]; then msg "Updating the main chroot" - mkarchroot -c ${CACHEDIR} -u -- ${CHROOTDIR}/${CHROOT} + # -c option in mkarchroot indicates cache + mkarchroot -c ${CACHEDIR} -u "${CHROOTDIR}/${CHROOT}" +fi - mount -o bind ${CACHEDIR} ${CHROOTDIR}/${CHCOPY}/var/cache/pacman/pkg || exit 1 -} msg "Creating the package" -makechrootpkg $CLEAN -r ${CHROOTDIR} -l ${CHCOPY} -- $@ +makechrootpkg $_CLEAN -r ${CHROOTDIR} -l "${chrootname}" $_PKGINSTALL -- $_MAKEPKG_ARGS exit 0 |