packaging: setup: database: move storage validations to validation

Change-Id: I4a7e02d517927f1034b8e6eb717884f3e6c28a4e
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>
db: cleanup: remove unused fn_db_set_dbobjects_ownership

Change-Id: I0a87b65a237527a84ff2a9382781e5f48923008e
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>
db: cleanup: remove -f VERSION feature

apparently not used any more.

Change-Id: I24efcb7546ee496279fda7d111ae0d956f01e6ce
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>
db: cleanup: trivial issues and bashism removal

1. remove bash specific usage, will enable us to drop bash dependency
   from product.

2. cleanup non consistent indents.

3. add {} all over.

4. add "" all over.

5. add local whenever possible.

6. proper cleanup of temporary files.

7. remove unused DEBUG.

8. misc trivial fixups.

9. argument reorg.

no change in functionality.

tested with dash and bash.

Change-Id: I6e937b290ad966e9d574596f4ca4a7c6c4292a43
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>
db: cleanup: add die and usage

Change-Id: I5d708d1855c93f88fcba97c04660b2e4f5f47a6e
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>
db: cleanup: psql usage

1. all command to use single psql wrapper

2. parser friendly psql wrapper without need to perform text
   manipulation including escaping.

3. extract base psql functionality into own dbfunc-base.sh to be used by
   dbutils as well.

4. prefix dbfunc variables to avoid duplications and have clearer code.

5. reformat complex sqls to multi line notation.

6. remove the no md5 parameter in favor for md5dir exist/absent.

7. boolean as -z -n

8. minor additional cleanups.

Change-Id: Ib93ad2ca4d35fe3f44e3f8915182778a9fe6ed66
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>
db: cleanup: rename commons to consistent prefix

dbfunctions.sh -> dbfunc-common.sh
dbcustomfunctions.sh -> dbfunc-custom.sh

Change-Id: I76ee5311eaabf5d7b1b69e780725979730fbca41
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>
db: cleanup: rename function names

dbfunc_common_      - public interface
dbfunc_common_hook_ - hooks
_dbfunc_common_     - private

custom functions are provided as hooks, the default implementation a
void hook, custom can override it.

reorder public interface to have <prefix>_<group>_<verb>

Change-Id: Icce88f1d8f19da83c757f94ad661cb676bd70274
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>
db: cleanup: move public interface to top

Change-Id: I9174019cce81acf7e2085a9dcf8070f5df78c929
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>
db: cleanup: convert indent to tab based

sync with other scripts within tree.

Change-Id: I4f1ca63db5867945f0170500fd12369535aecbd9
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>
db: cleanup: move task clean into custom

this is engine specific.

Change-Id: If4c099e23dd1903171cdce71f5c410ce3f05320a
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>
db: cleanup: cleanup file handling

1. use proper finds to locate files.

2. drop chdir during script execution

Change-Id: I54337aa6760ff488a1a72fe18bf2563c132e3fb6
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>
db: cleanup: use single script for schema handling

schema.sh -c apply|refresh|drop

schema-dev.sh was added as a wrapper to default enable md5 and log.

the md5dir was modified to accept md5file.

Change-Id: Ie13ee3d4ddf899f680b592ff58fb9d09573dae59
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>
db: cleanup: move entity lock to unlock_entity script

Change-Id: I5c62a8ada1ff93687cc2041d5df7bb6c1921a4af
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>