diff options
author | P. J. McDermott <pjm@nac.net> | 2013-07-16 18:44:44 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2013-07-16 18:51:22 (EDT) |
commit | a1779d0bf034a4df75315082796686eb5d1ad5be (patch) | |
tree | 526fbf0f5a137257190e97436a942e636779b985 | |
parent | e24dac56687cea8cf54f48a652dfa658e76cf184 (diff) |
include: Really only cat DB file if it exists.
-rw-r--r-- | lib/cmd/include.sh | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/cmd/include.sh b/lib/cmd/include.sh index 6302893..e3b039b 100644 --- a/lib/cmd/include.sh +++ b/lib/cmd/include.sh @@ -57,6 +57,7 @@ cmd_include() local pool_dir= local pool_dist_db= local archplats= + local old_version= local size= local file= local pkg= @@ -75,12 +76,13 @@ cmd_include() pool_dist_db="${archive}/${pool_dir}/.db" pool_dist_db="${pool_dist_db}/${cmd_include_distribution}" archplats='' - if [ -f "${pool_dist_db}/version" \ - -a "x$(cat "${pool_dist_db}/version")" \ - != "x${cmd_include_version}" ]; then - # TODO: Remove ":" when cmd_remove is implemented. - : cmd_remove "${cmd_include_distribution}" \ - "${cmd_include_source}" + if [ -f "${pool_dist_db}/version" ]; then + old_version="$(cat "${pool_dist_db}/version")" + if [ "x${old_version}" != "x${cmd_include_version}" ]; then + # TODO: Remove ":" when cmd_remove is implemented. + : cmd_remove "${cmd_include_distribution}" \ + "${cmd_include_source}" + fi fi mkdir -p "${pool_dist_db}" printf '%s\n' "${cmd_include_version}" \ |