Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
HardenedBSD
HardenedBSD
Commits
829afcb5
Commit
829afcb5
authored
Jan 24, 2022
by
Wolfram Schneider
Browse files
refactor script
- simpler usage of mktemp(1) - remove unnecessary checks - documentation
parent
0a88bd81
Changes
1
Hide whitespace changes
Inline
Side-by-side
usr.bin/locate/locate/concatdb.sh
View file @
829afcb5
...
...
@@ -30,7 +30,7 @@
#
# usage: concatdb database1 ... databaseN > newdb
#
#
S
equence of databases is important.
#
Please note: the s
equence of databases is important.
#
# $FreeBSD$
...
...
@@ -42,11 +42,7 @@ set -o pipefail
:
${
LIBEXECDIR
:
=/usr/libexec
}
;
export
LIBEXECDIR
PATH
=
$LIBEXECDIR
:/bin:/usr/bin:
$PATH
;
export
PATH
umask
077
# protect temp files
:
${
TMPDIR
:
=/var/tmp
}
;
export
TMPDIR
;
test
-d
"
$TMPDIR
"
||
TMPDIR
=
/var/tmp
# utilities to built locate database
:
${
bigram
:
=locate.bigram
}
...
...
@@ -54,15 +50,12 @@ test -d "$TMPDIR" || TMPDIR=/var/tmp
:
${
sort
:
=sort
}
:
${
locate
:
=locate
}
if
[
$#
-lt
2
]
;
then
echo
'usage: concatdb databases1 ... databaseN > newdb'
exit
1
fi
case
$#
in
[
01]
)
echo
'usage: concatdb databases1 ... databaseN > newdb'
exit
1
;;
esac
bigrams
=
`
mktemp
${
TMPDIR
=/tmp
}
/_bigrams.XXXXXXXXXX
`
||
exit
1
bigrams
=
$(
mktemp
-t
bigrams
)
trap
'rm -f $bigrams'
0 1 2 3 5 10 15
for
db
...
...
@@ -75,3 +68,5 @@ for db
do
$locate
-d
$db
/
done
|
$code
$bigrams
#EOF
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment