summaryrefslogtreecommitdiff
path: root/libremakepkg
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-05-16 00:44:39 -0500
committerJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-05-16 00:44:39 -0500
commit7f118f53283d7e228c40a40076815ce94ebb94a7 (patch)
treee7b70c0f9f297edc42a1333b38e6e06357edcdd8 /libremakepkg
parent0fa9894cbc10f0742c3076666524956f7279e8af (diff)
Cleaned up some things, added option parse to some scripts.
Diffstat (limited to 'libremakepkg')
-rwxr-xr-xlibremakepkg40
1 files changed, 22 insertions, 18 deletions
diff --git a/libremakepkg b/libremakepkg
index f2b523d..272e61d 100755
--- a/libremakepkg
+++ b/libremakepkg
@@ -21,47 +21,50 @@
source /etc/libretools.conf
-if [ $UID -ne 0 ]; then
- error "This script must be run as root"
- exit 1
-fi
-
-usage() {
+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 and cachedir"
- echo " -u : updates before building"
- echo " -n chrootname : use this dir instead of CHCOPY"
+ echo " -h : show this message."
+ echo " -c : cleans CHCOPY and cachedir."
+ echo " -u : updates 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=""
CLEAN_CACHE=""
update_first="n"
chrootname=${CHCOPY}
-
-while getopts 'hcun:' arg; do
+_PKGINSTALL=""
+while getopts 'hcun:I:' arg; do
case "${arg}" in
h) usage; exit 0 ;;
- c) CLEAN="-c" ;;
+ c) _CLEAN="-c" ;;
u) update_first="y" ;;
n) chrootname="$OPTARG"; echo $chrootname ;;
- *) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;;
+ 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
+fi
+
msg "Checking PKGBUILD for non-free issues"
pkgbuild-check-nonfree ||{
if [[ $? -eq 15 ]]; then
error "PKGBUILD contains non-free issues"
exit 15
- exit $?
fi
-
}
+
if [ $update_first = y ]; then
msg "Updating the main chroot"
# -c option in mkarchroot indicates cache
@@ -70,6 +73,7 @@ fi
msg "Creating the package"
-makechrootpkg $CLEAN -r ${CHROOTDIR} -l "${chrootname}" -- $MAKEPKG_ARGS
+makechrootpkg $_CLEAN -r ${CHROOTDIR} -l "${chrootname}" $_PKGINSTALL \
+ -- $_MAKEPKG_ARGS
exit 0