summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz (arab, vxp) <l.illanes@gmx.de>2016-11-15 21:04:53 +0100
committerLucio Andrés Illanes Albornoz (arab, vxp) <l.illanes@gmx.de>2016-11-15 21:04:53 +0100
commit35633f3dc606541bb17788d492460feae4b2f946 (patch)
tree4918e7f141b915a1918e680f3ed4e671497b8fba
parent59765f508225998d8a73b1da8380ff06b4a6b79c (diff)
downloadmidipix_build-35633f3dc606541bb17788d492460feae4b2f946.tar.bz2
midipix_build-35633f3dc606541bb17788d492460feae4b2f946.tar.xz
build.sh: adds -N (offline mode) flag.
-rwxr-xr-xbuild.sh1
-rw-r--r--etc/build.usage3
-rw-r--r--subr/pkg.subr23
3 files changed, 16 insertions, 11 deletions
diff --git a/build.sh b/build.sh
index 2d616f54..f0a00483 100755
--- a/build.sh
+++ b/build.sh
@@ -15,6 +15,7 @@ while [ ${#} -gt 0 ]; do
case ${1} in
-c) export ARG_CLEAN=1; ;;
-n) export ARG_DRYRUN=1 ARG_VERBOSE=1; ;;
+-N) export ARG_OFFLINE=1; ;;
-t*) export ARG_TARBALL=1; [ "${1#-t.}" != "${1}" ] && TARBALL_SUFFIX=${1#-t.}; ;;
-v) export ARG_VERBOSE=1; ;;
-x) export ARG_XTRACE=1; set -o xtrace; ;;
diff --git a/etc/build.usage b/etc/build.usage
index c513c82c..ecfd16ba 100644
--- a/etc/build.usage
+++ b/etc/build.usage
@@ -1,5 +1,5 @@
usage: ./build.sh [-x] [-a nt32|nt64] [-b debug|release] [-c] [-h] [-n]
- [-r package[,...][:step]] [-t[.gz|.bz2|.xz] [-v]
+ [-N] [-r package[,...][:step]] [-t[.gz|.bz2|.xz] [-v]
[<target>[ ...]]
-x Set the xtrace sh(1)ell option for debugging purposes.
-a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64.
@@ -8,6 +8,7 @@ usage: ./build.sh [-x] [-a nt32|nt64] [-b debug|release] [-c] [-h] [-n]
-c Clean ${PREFIX} before processing build scripts.
-h Show this screen.
-n Perform dry run.
+ -N Offline mode: no {wget,git-{clone,pull}}(1) calls.
-r package[,...][:step] Restart the specified comma-separated build(s) completely or at
the optionally specified step. Currently defined steps are:
fetch extract build_dir autoconf patch configure clean build install
diff --git a/subr/pkg.subr b/subr/pkg.subr
index 2e0e36ae..accdd333 100644
--- a/subr/pkg.subr
+++ b/subr/pkg.subr
@@ -7,7 +7,8 @@
fetch() {
_f_url="${1}"; _f_sha256sum_src="${2}";
_f_url_dst="${DLCACHEDIR}/$(basename "${_f_url}")";
- if [ -e ${_f_url_dst}.fetched ]; then
+ if [ ${ARG_OFFLINE:-0} -eq 1 ]\
+ || [ -e ${_f_url_dst}.fetched ]; then
unset _f_url _f_sha256sum_src _f_url_dst;
return 0;
else
@@ -25,16 +26,18 @@ fetch() {
fetch_git() {
_fg_subdir="${1}"; _fg_url="${2}"; _fg_branch="${3}";
- if [ -e "${DLCACHEDIR}/${_fg_subdir}" ]; then
- cd ${DLCACHEDIR}/${_fg_subdir} &&\
- git pull origin ${_fg_branch:-main} && cd ${OLDPWD};
- else
- git clone ${_fg_url} ${DLCACHEDIR}/${_fg_subdir};
- if [ -n "${_fg_branch}" -a \
- \( -z "${_fg_branch#main}" \) -a \
- \( -z "${_fg_branch#master}" \) ]; then
+ if [ ${ARG_OFFLINE:-0} -eq 0 ]; then
+ if [ -e "${DLCACHEDIR}/${_fg_subdir}" ]; then
cd ${DLCACHEDIR}/${_fg_subdir} &&\
- git checkout -b ${_fg_branch} && cd ${OLDPWD};
+ git pull origin ${_fg_branch:-main} && cd ${OLDPWD};
+ else
+ git clone ${_fg_url} ${DLCACHEDIR}/${_fg_subdir};
+ if [ -n "${_fg_branch}" -a \
+ \( -z "${_fg_branch#main}" \) -a \
+ \( -z "${_fg_branch#master}" \) ]; then
+ cd ${DLCACHEDIR}/${_fg_subdir} &&\
+ git checkout -b ${_fg_branch} && cd ${OLDPWD};
+ fi;
fi;
fi;
secure_rm ${_fg_subdir};