summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-04-23 23:38:48 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-04-23 23:38:48 (EDT)
commit8a23b252a1bd787bc46dba486fbadf6008dab969 (patch)
treebf8ca1a963ee384e15943b4dd8dd0bbfc1185d85
parentf308e3207cf157bc0bccf53a1ee57adfbb06e30f (diff)
Add a '-u' option to leave the work area unclean.unclean-option
-rw-r--r--man/opkbuild.1.in4
-rw-r--r--src/opkbuild.sh19
2 files changed, 19 insertions, 4 deletions
diff --git a/man/opkbuild.1.in b/man/opkbuild.1.in
index 4fcbbdb..26d030d 100644
--- a/man/opkbuild.1.in
+++ b/man/opkbuild.1.in
@@ -17,6 +17,7 @@ opkbuild \- Build opkg packages.
.RB [ -s
.IR status-override ]
.RB [ -d ]
+.RB [ -u ]
.SH DESCRIPTION
.B opkbuild
@@ -51,6 +52,9 @@ for the syntax of this file.
.BI \-d
Start a debugging shell if the package build fails.
.TP
+.BI \-u
+Don't clean up the work area after building all packages.
+.TP
.BI \-V
Output version information and exit.
diff --git a/src/opkbuild.sh b/src/opkbuild.sh
index 16fc95d..52bf1bf 100644
--- a/src/opkbuild.sh
+++ b/src/opkbuild.sh
@@ -26,7 +26,8 @@
print_usage()
{
cat <<EOF
-Usage: ${1} [-r assume-uid0-cmd] [-a host-architecture] [-p host-platform] [-d]
+Usage: ${1} [-r assume-uid0-cmd] [-a host-architecture] [-p host-platform] \
+[-d] [-u]
EOF
}
@@ -55,7 +56,7 @@ error()
exit 1
}
-opts=$(getopt -n "${0}" -o 'r:a:p:ds:V' -- "${@}")
+opts=$(getopt -n "${0}" -o 'r:a:p:dus:V' -- "${@}")
if [ ${?} -ne 0 ]; then
print_usage "${0}" >&2
exit 1;
@@ -79,6 +80,10 @@ while true; do
dbg=true
shift
;;
+ -u)
+ unclean=true
+ shift
+ ;;
-s)
status_override=${2}
shift 2
@@ -109,6 +114,9 @@ fi
if [ -z "${dbg}" ]; then
dbg=false
fi
+if [ -z "${unclean}" ]; then
+ unclean=false
+fi
# Sanity checks.
printf 'opkbuild: Checking for sanity...\n'
@@ -358,6 +366,9 @@ for binpkgdir in ../*.pkg/; do
fi
done
-# Clean up tmp.
cd ..
-rm -Rf tmp
+
+# Clean up tmp.
+if ! ${unclean}; then
+ rm -Rf tmp
+fi