add vbin, vman, vdoc, vsconf and vlicense helpers

This commit is contained in:
Dominik Honnef 2014-07-04 07:42:16 +02:00
parent 3871a393c3
commit d7b66721b6
2 changed files with 87 additions and 1 deletions

View File

@ -166,6 +166,36 @@ The optional 4th argument can be used to change the `file name`.
Creates a directory in the pkg `$DESTDIR`. The 2nd optional argument sets the mode of the directory.
- *vbin()* `vbin <file> [<name>]`
Installs `file` into usr/bin in the pkg `$DESTDIR` with the
permissions 0755. The optional 2nd argument can be used to change
the `file name`.
- *vman()* `vman <file> <section> [<name>]`
Installs `file` into usr/share/man/<section> in the pkg
`$DESTDIR`. The optional 3rd argument can be used to change the
`file name`.
- *vdoc()* `vdoc <file> [<name>]`
Installs `file` into usr/share/doc/<pkgname> in the pkg
`$DESTDIR`. The optional 2nd argument can be used to change the
`file name`.
- *vsconf()* `vsconf <file> [<name>]`
Installs `file` into usr/share/examples/<pkgname> in the pkg
`$DESTDIR`. The optional 2nd argument can be used to change the
`file name`.
- *vlicense()* `vlicense <file> [<name>]`
Installs `file` into usr/share/licenses/<pkgname> in the pkg
`$DESTDIR`. The optional 2nd argument can be used to change the
`file name`.
> Shell wildcards must be properly quoted, i.e `vmove "usr/lib/*.a"`.
### Global variables

View File

@ -13,10 +13,66 @@ _noglob_helper() {
}
# Apply _noglob to v* commands
for cmd in vinstall vcopy vmove vmkdir; do
for cmd in vinstall vcopy vmove vmkdir vbin vman vdoc vsconf vlicense; do
alias ${cmd}="set -f; _noglob_helper _${cmd}"
done
_vbin() {
local file="$1" targetfile="$2"
if [ $# -lt 1 ]; then
msg_red "$pkgver: vbin: 1 argument expected: <file>\n"
return 1
fi
vinstall "$file" 755 usr/bin "$targetfile"
}
_vman() {
local file="$1" section="$2" targetfile="$3"
if [ $# -lt 2 ]; then
msg_red "$pkgver: vman: 2 arguments expected: <file> <section>\n"
return 1
fi
vmkdir "usr/share/man/${section}"
vinstall "$file" 644 "usr/share/man/${section}" "$3"
}
_vdoc() {
local file="$1" targetfile="$2"
if [ $# -lt 1 ]; then
msg_red "$pkgver: vdoc: 1 argument expected: <file>\n"
return 1
fi
vinstall "$file" 644 "usr/share/doc/${pkgname}" "$targetfile"
}
_vsconf() {
local file="$1" targetfile="$2"
if [ $# -lt 1 ]; then
msg_red "$pkgver: vsconf: 1 argument expected: <file>\n"
return 1
fi
vinstall "$file" 644 "usr/share/examples/${pkgname}" "$targetfile"
}
_vlicense() {
local file="$1" targetfile="$2"
if [ $# -lt 1 ]; then
msg_red "$pkgver: vlicense: 1 argument expected: <file>\n"
return 1
fi
vinstall "$file" 644 "usr/share/licenses/${pkgname}" "$targetfile"
}
_vinstall() {
local file="$1" mode="$2" targetdir="$3" targetfile="$4"
local _destdir=