diff options
author | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-04-30 05:53:38 -0500 |
---|---|---|
committer | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-04-30 05:53:38 -0500 |
commit | 8fd5887191e11e0ee64272991a8c5fc6c7636524 (patch) | |
tree | 2e0fbee8e4ce82941481fb7220c69d8d9a9efbe8 /libremakepkg | |
parent | f33f1f0ed91fb33e7681291f7f6b260447fcfb86 (diff) |
* libremakepkg optionaly uses a chroot different from $CHCOPY
* libremakepkg cleaning and mkarchroot update is optional
* librerepkg uses -cu flags for libremakepkg
Diffstat (limited to 'libremakepkg')
-rwxr-xr-x | libremakepkg | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/libremakepkg b/libremakepkg index 988b6f2..6b996dc 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 ---------- @@ -25,26 +26,54 @@ if [ $UID -ne 0 ]; then exit 1 fi +usage() { + echo "cd to a dir containing a PKGBUILD and run:" + echo "$0 [options] [makepkg args]" + echo + echo "OPTIONS:" + echo + echo " -h : show this message" + echo " -c : cleans CHCOPY and cachedir" + echo " -u : updates before building" + echo " -n chrootname : use this dir instead of CHCOPY" +} + +CLEAN="" +update_first=0 +chrootname=${CHCOPY} + +while getopts 'hcun' arg; do + case "${arg}" in + h) usage ;; + c) CLEAN="-c" ;; + u) update_first=1 ;; + n) chrootname="$OPTARG" ;; + *) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;; + esac +done + msg "Checking PKGBUILD for non-free issues" pkgbuild-check-nonfree ||{ if [[ $? -eq 15 ]]; then error "PKGBUILD contains non-free issues" exit 15 else - error "Check failed, continuing" + exit $? fi } -[[ -z $1 ]] && { - CLEAN="-c" +mount -o bind ${CACHEDIR} \ + ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg || exit 1 +if [ $update_first -eq 1 ]; then msg "Updating the main chroot" - mkarchroot -c ${CACHEDIR} -u -- ${CHROOTDIR}/${CHROOT} + mkarchroot $CLEAN ${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} -- $MAKEPKG_ARGS + +umount ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg exit 0 |