Install docopts too
This commit is contained in:
@@ -7,33 +7,61 @@ function ensureRightAccess() {
|
|||||||
chmod ugo=rx "${filesystemItem}"
|
chmod ugo=rx "${filesystemItem}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copyUtilityBinaries() {
|
||||||
|
lop -y h1 -- -i 'Installing utility binaries'
|
||||||
|
for file in ${_DIR}/../bin/*; do
|
||||||
|
indicateActivity cp,${file},${dstDir} "Copying ${file##*/}"
|
||||||
|
ensureRightAccess ${file}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function installDocopts() {
|
||||||
|
local destPath='/usr/local/bin/docopts'
|
||||||
|
[[ -x ${destPath} ]] && return
|
||||||
|
indicateActivity curl,--output,${destPath},-fsSL,"${docopts_url}" 'Downloading docpts' || return
|
||||||
|
chown root:admin ${destPath}
|
||||||
|
chmod 755 ${destPath}
|
||||||
|
}
|
||||||
|
|
||||||
function configure_system() {
|
function configure_system() {
|
||||||
local dstDir='/usr/local/bin'
|
local dstDir='/usr/local/bin'
|
||||||
ensurePathOrLogError ${dstDir} 'Could not install binaries.' || return 10
|
ensurePathOrLogError ${dstDir} 'Could not install binaries.' || return 10
|
||||||
pushd -q ${_DIR}/../bin
|
installDocopts
|
||||||
for file in *; do
|
copyUtilityBinaries
|
||||||
indicateActivity cp,${file},${dstDir} "Copying ${file}"
|
|
||||||
ensureRightAccess "${dstDir}/${file}"
|
|
||||||
done
|
|
||||||
popd -q
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExecPrerequisites() {
|
function getExecPrerequisites() {
|
||||||
cmds=(
|
cmds=(
|
||||||
[cp]=''
|
[cp]=''
|
||||||
|
[chown]=''
|
||||||
|
[chmod]=''
|
||||||
|
[curl]=''
|
||||||
[install]=''
|
[install]=''
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDefaultDocoptsURL() {
|
||||||
|
local fileURL="${DOCOPTS_URL:-https://github.com/astzweig/docopts/releases/download/v.0.7.0/docopts_darwin_amd64}"
|
||||||
|
print -- ${fileURL}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getQuestions() {
|
||||||
|
questions=(
|
||||||
|
'i: docopts-url=From which URL shall the docopts binary be downloaded? # default:'"$(getDefaultDocoptsURL)"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function getUsage() {
|
function getUsage() {
|
||||||
read -r -d '' text <<- USAGE
|
read -r -d '' text <<- USAGE
|
||||||
Usage:
|
Usage:
|
||||||
$cmdName show-questions [<modkey> <modans>]...
|
$cmdName show-questions [<modkey> <modans>]...
|
||||||
$cmdName [-v] [-d FILE]
|
$cmdName [-v] [-d FILE] --docopts-url URL
|
||||||
|
|
||||||
Install convenient binaries for all users.
|
Install convenient binaries for all users.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
--docopts-url URL The URL from which to download the docopts binary
|
||||||
|
[default: $(getDefaultDocoptsURL)].
|
||||||
-d FILE, --logfile FILE Print log message to logfile instead of stdout.
|
-d FILE, --logfile FILE Print log message to logfile instead of stdout.
|
||||||
-v, --verbose Be more verbose.
|
-v, --verbose Be more verbose.
|
||||||
----
|
----
|
||||||
|
|||||||
Reference in New Issue
Block a user