summaryrefslogtreecommitdiff
path: root/libremakepkg
diff options
context:
space:
mode:
Diffstat (limited to 'libremakepkg')
-rwxr-xr-xlibremakepkg55
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