Fix for building instance image from submodule

An instance image build from submodule fails to start with the following error:

Starting the container with user haf_admin with UID 4000
Setting user hived's UID to value '1000'
+ '[' -n '' ']'
changed ownership of '/home/hived/datadir/docker_entrypoint.log' from root:root to hived:users
PostgreSQL 17 appears to be installed
changed ownership of '/home/hived/datadir/haf_postgresql_conf.d' from root:root to postgres:postgres
changed ownership of '/home/hived/datadir/haf_db_store/pgdata' from hived:users to postgres:postgres
changed ownership of '/home/hived/datadir/haf_db_store/tablespace' from hived:users to postgres:postgres
changed ownership of '/home/hived/datadir/haf_db_store' from hived:users to postgres:postgres
Attempting to setup postgres instance: running initdb...
changed ownership of '/tmp/1/pgdata' from haf_admin:haf_admin to postgres:postgres
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /tmp/1/pgdata ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default "max_connections" ... 100
selecting default "shared_buffers" ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
    /usr/lib/postgresql/17/bin/pg_ctl -D /tmp/1/pgdata -l logfile start
Attempting to setup postgres instance: running setup_postgres.sh...
/home/haf_admin/source/haf/scripts/setup_postgres.sh parameters: --haf-admin-account=haf_admin --haf-binaries-dir=/home/haf_admin/build --haf-database-store=/home/hived/datadir/haf_db_store/tablespace --install-extension=yes 
Script path is: /home/haf_admin/source/haf/scripts
Attempting to install hive_fork_manager extenstion into PostgreSQL directories...
/home/haf_admin/build /home/haf_admin
[0/1] Re-running CMake...
-- CMAKE_C_FLAGS_ASAN value is based on: CMAKE_C_FLAGS_RELWITHDEBINFO and points to value: -O2 -g -DNDEBUG 
-- CMAKE_CXX_FLAGS_ASAN value is based on: CMAKE_CXX_FLAGS_RELWITHDEBINFO and points to value: -O2 -g -DNDEBUG 
-- CMAKE_EXE_LINKER_FLAGS_ASAN value is based on: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO and points to value:  
-- CMAKE_SHARED_LINKER_FLAGS_ASAN value is based on: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO and points to value:  
-- CMAKE_C_FLAGS_ASAN value is based on: CMAKE_C_FLAGS_RELWITHDEBINFO and points to value: -O2 -g -DNDEBUG 
-- CMAKE_CXX_FLAGS_ASAN value is based on: CMAKE_CXX_FLAGS_RELWITHDEBINFO and points to value: -O2 -g -DNDEBUG 
-- CMAKE_EXE_LINKER_FLAGS_ASAN value is based on: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO and points to value:  
-- CMAKE_SHARED_LINKER_FLAGS_ASAN value is based on: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO and points to value:  
-- BUILD_HIVE_TESTNET: OFF
-- ENABLE_SMT_SUPPORT: OFF
-- STORE_ACCOUNT_METADATA: ON
--      
--                  CONFIGURING TO INDEX ACCOUNT METADATA      
--      
-- CHAINBASE_CHECK_LOCKING: ON
-- HIVE_CONVERTER_BUILD: OFF
-- HIVE_FAIL_ON_WARNINGS: OFF
-- Configuring Hive on Linux
-- Configuring project fc located in: /home/haf_admin/source/haf/hive/libraries/fc
CMake Error at hive/libraries/fc/GitVersionGen/GetGitRevisionDescription.cmake:179 (message):
  Git HEAD file not found
Call Stack (most recent call first):
  hive/libraries/fc/CMakeLists.txt:20 (get_git_unix_timestamp)
-- Configuring incomplete, errors occurred!
See also "/home/haf_admin/build/CMakeFiles/CMakeOutput.log".
See also "/home/haf_admin/build/CMakeFiles/CMakeError.log".
FAILED: build.ninja 
/usr/bin/cmake --regenerate-during-build -S/home/haf_admin/source/haf -B/home/haf_admin/build
ninja: error: rebuilding 'build.ninja': subcommand failed

For some reason, it fails to detect that the PostgreSQL extension has already been built and attempts to build it again, then fails due to missing the git repository.

This merge request is a proposed fix to the issue.

Merge request reports

Loading