diff options
-rw-r--r-- | etc/README.md | 9 | ||||
-rw-r--r-- | etc/pkgtool.usage | 2 | ||||
-rwxr-xr-x | pkgtool.sh | 24 |
3 files changed, 30 insertions, 5 deletions
diff --git a/etc/README.md b/etc/README.md index 63411a6f..95ad13e5 100644 --- a/etc/README.md +++ b/etc/README.md @@ -909,6 +909,8 @@ usage: ./pkgtool.sh [-a nt32|nt64] [-b debug|release] [-i|-m <dname> -M <dname>| -i List package variables and dependencies of single named package.
-m <dname> Setup package archives mirror in <dname> and/or
-M <dname> Setup Git repositories mirror in <dname>
+ Specify "" or '' as <dname> to default to the defaults in
+ ${HOME}/pkgtool.vars, if present.
-r List reverse dependencies of single named package.
-R List full reverse dependencies of single named package.
-t Produce tarball of package build root directory and build log
@@ -921,7 +923,12 @@ usage: ./pkgtool.sh [-a nt32|nt64] [-b debug|release] [-i|-m <dname> -M <dname>| > N.B. When using ``pkgtool.sh`` on a build w/ build variables (see section [4.2](#42-build-variables))
overriden on the command line or via the environment, ensure that they are included in the
-``pkgtool.sh`` command line, preceding the package name, or exported, respectively.
+``pkgtool.sh`` command line, preceding the package name, or exported, respectively.
+
+> N.B. ``pkgtool.sh`` will source the ``${HOME}/pkgtool.vars`` file, if present, on startup where the
+following option arguments may be set: ``-a nt32|nt64`` by setting ``ARCH=...``, ``-b debug|release``
+by setting ``BUILD_KIND=...``, ``-m <dname>`` by setting ``ARG_MIRROR_DNAME=...``, and ``-M <dname>``
+by setting ``ARG_MIRROR_DNAME_GIT=...``.
[Back to top](#table-of-contents)
diff --git a/etc/pkgtool.usage b/etc/pkgtool.usage index 6c86e86d..446ac3a3 100644 --- a/etc/pkgtool.usage +++ b/etc/pkgtool.usage @@ -6,6 +6,8 @@ [33m-[93mi [96mList package variables and dependencies of single named package.[0m [33m-[93mm [90m<[93mdname[90m> [96mSetup package archives mirror in [90m<[93mdname[90m>[96m and/or[0m [33m-[93mM [90m<[93mdname[90m> [96mSetup Git repositories mirror in [90m<[93mdname[90m>[0m + [96mSpecify "" or '' as <dname> to default to the defaults in[0m + [93m${HOME}/pkgtool.vars[96m, if present.[0m [33m-[93mr [96mList reverse dependencies of single named package.[0m [33m-[93mR [96mList recursive reverse dependencies of single named package.[0m [33m-[93mt [96mProduce tarball of package build root directory and build log[0m @@ -15,6 +15,10 @@ pkgtoolp_init() { _pi_fname="" _pi_rc=0; shift; + if [ -e "${HOME}/pkgtool.vars" ]; then + . "${HOME}/pkgtool.vars" || exit 1; + fi; + if ! . "${0%/*}/subr.ex/ex_init.subr"; then _pi_rc=1; _pi_status='failed to source \`'"${0%/*}/subr/ex_init.subr"\'; @@ -80,8 +84,8 @@ pkgtoolp_init_getopts_fn() { : ${ARCH:="nt64"}; : ${BUILD_KIND:="debug"}; - ARG_INFO=0; ARG_MIRROR=0; ARG_MIRROR_DNAME=""; ARG_MIRROR_DNAME_GIT=""; - ARG_RDEPENDS=0; ARG_RDEPENDS_FULL=0; ARG_TARBALL=0; ARG_VERBOSE=0; + ARG_INFO=0; ARG_MIRROR=0; ARG_RDEPENDS=0; + ARG_RDEPENDS_FULL=0; ARG_TARBALL=0; ARG_VERBOSE=0; ;; longopt) @@ -98,8 +102,20 @@ pkgtoolp_init_getopts_fn() { b) BUILD_KIND="${OPTARG}"; _ppigf_shiftfl=2; ;; h) cat etc/pkgtool.usage; exit 0; ;; i) ARG_INFO=1; _ppigf_shiftfl=1; ;; - m) ARG_MIRROR=1; ARG_MIRROR_DNAME="${OPTARG}"; _ppigf_shiftfl=2; ;; - M) ARG_MIRROR=1; ARG_MIRROR_DNAME_GIT="${OPTARG}"; _ppigf_shiftfl=2; ;; + m) ARG_MIRROR=1; + if [ "${OPTARG:+1}" = 1 ]; then + ARG_MIRROR_DNAME="${OPTARG}"; + elif [ "${ARG_MIRROR_DNAME:+1}" != 1 ]; then + rtl_setrstatus "${_ppigf_rstatus}" 'missing -m argument and no default present.'; + fi; + _ppigf_shiftfl=2; ;; + M) ARG_MIRROR=1; + if [ "${OPTARG:+1}" = 1 ]; then + ARG_MIRROR_DNAME_GIT="${OPTARG}"; + elif [ "${ARG_MIRROR_DNAME_GIT:+1}" != 1 ]; then + rtl_setrstatus "${_ppigf_rstatus}" 'missing -M argument and no default present.'; + fi; + _ppigf_shiftfl=2; ;; r) ARG_RDEPENDS=1; _ppigf_shiftfl=1; ;; R) ARG_RDEPENDS_FULL=1; _ppigf_shiftfl=1; ;; t) ARG_TARBALL=1; _ppigf_shiftfl=1; ;; |