Skip to content

Instantly share code, notes, and snippets.

@citizenrich
Created August 30, 2017 18:27
Show Gist options
  • Select an option

  • Save citizenrich/3be3f7e7bdba00e434b3debeb01f3166 to your computer and use it in GitHub Desktop.

Select an option

Save citizenrich/3be3f7e7bdba00e434b3debeb01f3166 to your computer and use it in GitHub Desktop.
Shell script for OpenInfoMan manual installation
#!/bin/bash
cd $HOME
basexhttp stop || true
pkill java || true
rm -rf .base* || true
rm -rf BaseX853* || true
rm -rf basex/ || true
rm -rf openinfoman || true
rm -rf openinfomangh || true
rm -rf openinfoman-csv || true
rm -rf openinfoman-rapidpro || true
rm -rf openinfoman-ilr || true
rm -rf openinfoman-hwr || true
rm -rf openinfoman-dhis || true
wget http://files.basex.org/releases/8.5.3/BaseX853.zip
unzip BaseX853.zip
mkdir ~/openinfoman
cp -R basex/* openinfoman/
cp basex/.basexhome openinfoman/
if type basex &> /dev/null ; then echo "basex exists in $PATH"
else echo "adding basex bin to $PATH"
sudo ln -s ~/openinfoman/bin/basex /usr/local/bin
fi
mkdir openinfoman/repo-src
git clone https://github.com/openhie/openinfoman openinfomangh
cp openinfomangh/repo/* openinfoman/repo-src/
cp -R openinfomangh/resources openinfoman/
cp ~/openinfomangh/webapp/*xqm ~/openinfoman/webapp
mkdir -p ~/openinfoman/webapp/static
cp -R ~/openinfomangh/webapp/static/* ~/openinfoman/webapp/static
basex -Vc "CREATE DATABASE provider_directory"
echo "module namespace csd_webconf = 'https://github.com/openhie/openinfoman/csd_webconf';
declare variable \$csd_webconf:db := 'provider_directory';
declare variable \$csd_webconf:baseurl := '';
declare variable \$csd_webconf:remote_services := ();
" > $HOME/openinfoman/repo-src/generated_openinfoman_webconfig.xqm
basex -Vc "REPO INSTALL http://files.basex.org/modules/expath/functx-1.0.xar"
cd $HOME/openinfoman/repo-src
basex -Vc "repo install "generated_openinfoman_webconfig.xqm""
basex -Vc "repo install "csd_webapp_ui.xqm""
basex -Vc "repo install "csd_base_library.xqm""
basex -Vc "repo install "csd_base_library_updating.xqm""
basex -Vc "repo install "csd_base_stored_queries.xqm""
basex -Vc "repo install "csd_document_manager.xqm""
basex -Vc "repo install "csd_load_sample_directories.xqm""
basex -Vc "repo install "csd_query_updated_services.xqm""
basex -Vc "repo install "csd_poll_service_directories.xqm""
basex -Vc "repo install "csd_local_services_cache.xqm""
basex -Vc "repo install "csd_merge_cached_services.xqm""
basex -Vc "repo install "csr_processor.xqm""
basex -Vc "repo install "svs_load_shared_value_sets.xqm""
basex -Vc "repo install "async_fake.xqm""
basex -Vc "RUN $HOME/openinfoman/resources/scripts/init_db.xq"
cd $HOME/openinfoman
resources/scripts/install_stored_function.php resources/stored_query_definitions/facility_search.xml
resources/scripts/install_stored_function.php resources/stored_query_definitions/adhoc_search.xml
resources/scripts/install_stored_function.php resources/stored_query_definitions/service_search.xml
resources/scripts/install_stored_function.php resources/stored_query_definitions/organization_search.xml
resources/scripts/install_stored_function.php resources/stored_query_definitions/provider_search.xml
resources/scripts/install_stored_function.php resources/stored_query_definitions/modtimes.xml
resources/scripts/install_stored_function.php resources/stored_updating_query_definitions/service_create.xml
resources/scripts/install_stored_function.php resources/stored_updating_query_definitions/mark_duplicate.xml
resources/scripts/install_stored_function.php resources/stored_updating_query_definitions/simple_merge.xml
resources/scripts/install_stored_function.php resources/stored_updating_query_definitions/mark_potential_duplicate.xml
resources/scripts/install_stored_function.php resources/stored_updating_query_definitions/delete_potential_duplicate.xml
resources/scripts/install_stored_function.php resources/stored_updating_query_definitions/organization_create.xml
resources/scripts/install_stored_function.php resources/stored_updating_query_definitions/provider_create.xml
resources/scripts/install_stored_function.php resources/stored_updating_query_definitions/facility_create.xml
resources/scripts/install_stored_function.php resources/stored_updating_query_definitions/delete_duplicate.xml
resources/scripts/install_stored_function.php resources/stored_updating_query_definitions/merge_by_identifier.xml
resources/scripts/install_stored_function.php resources/stored_updating_query_definitions/extract_hierarchy.xml
# cd $HOME/openinfoman/repo/com/github/openhie/openinfoman
# sed -i.bak "s|concat(file:current-dir() ,'../resources/shared_value_sets/')|file:resolve-path('resources/shared_value_sets/', file:current-dir())|" svs_lsvs.xqm
# sed -i.bak 's|concat(file:current-dir() ,"../resources/service_directories/")|file:resolve-path("resources/service_directories/", file:current-dir())|' csd_lsd.xqm
cd $HOME
git clone https://github.com/openhie/openinfoman-csv
cd ~/openinfoman-csv/repo
basex -Vc "REPO INSTALL openinfoman_csv_adapter.xqm"
# this may not be needed
cp ~/openinfoman-csv/webapp/*xqm ~/openinfoman/webapp
cd $HOME
git clone https://github.com/openhie/openinfoman-rapidpro
cp ~/openinfoman-rapidpro/resources/stored_query_definitions/* ~/openinfoman/resources/stored_query_definitions
cd $HOME/openinfoman
declare -a arr=("stored_query_definitions/get_csv_for_import.xml" "stored_query_definitions/phone_stats.xml" "stored_query_definitions/select_facility.xml" "stored_query_definitions/get_json_for_import.xml");\
for i in "${arr[@]}"; do resources/scripts/install_stored_function.php resources/$i; done
cp ~/openinfoman-rapidpro/webapp/openinfoman_rapidpro_bindings.xqm ~/openinfoman/webapp
cd $HOME
git clone https://github.com/openhie/openinfoman-ilr
cp ~/openinfoman-ilr/resources/stored_query_definitions/* ~/openinfoman/resources/stored_query_definitions
cd $HOME/openinfoman
resources/scripts/install_stored_function.php resources/stored_query_definitions/validate_provider_facility_service.xml
cd $HOME
git clone https://github.com/openhie/openinfoman-hwr
cp ~/openinfoman-hwr/resources/stored_query_definitions/* ~/openinfoman/resources/stored_query_definitions/
cp ~/openinfoman-hwr/resources/stored_updating_query_definitions/* ~/openinfoman/resources/stored_updating_query_definitions/
cd $HOME/openinfoman
declare -a arr=("stored_query_definitions/health_worker_urn_search_by_id.xml" "stored_query_definitions/health_worker_indices_address.xml" "stored_query_definitions/health_worker_indices_provider_facility.xml" "stored_query_definitions/health_worker_read_name.xml" "stored_query_definitions/health_worker_indices_service.xml" "stored_query_definitions/health_worker_read_otherids.xml" "stored_query_definitions/facility_indices_otherid.xml" "stored_query_definitions/health_worker_read_credential.xml" "stored_query_definitions/health_worker_read_org_address.xml" "stored_query_definitions/facility_name_search.xml" "stored_query_definitions/health_worker_read_provider.xml" "stored_query_definitions/facility_read_organization.xml" "stored_query_definitions/facility_read_otherid.xml" "stored_query_definitions/facility_indices_address.xml" "stored_query_definitions/organization_get_urns.xml" "stored_query_definitions/facility_read_contact_point.xml" "stored_query_definitions/organization_read_address.xml" "stored_query_definitions/facility_indices_contact_point.xml" "stored_query_definitions/health_worker_read_service.xml" "stored_query_definitions/health_worker_indices_provider_organization.xml" "stored_query_definitions/facility_read_service.xml" "stored_query_definitions/health_worker_indices_org_contact_point.xml" "stored_query_definitions/bulk_health_worker_read_otherids_json.xml" "stored_query_definitions/organization_indices_otherid.xml" "stored_query_definitions/health_worker_get_urns.xml" "stored_query_definitions/health_worker_read_provider_organization.xml" "stored_query_definitions/health_worker_read_provider_facility.xml" "stored_query_definitions/health_worker_indices_otherid.xml" "stored_query_definitions/health_worker_indices_credential.xml" "stored_query_definitions/health_worker_read_org_contact_point.xml" "stored_query_definitions/organization_indices_address.xml" "stored_query_definitions/facility_indices_organization.xml" "stored_query_definitions/health_worker_indices_contact_point.xml" "stored_query_definitions/health_worker_read_address.xml" "stored_query_definitions/organization_name_search.xml" "stored_query_definitions/health_worker_read_otherids_json.xml" "stored_query_definitions/health_worker_indices_org_address.xml" "stored_query_definitions/health_worker_indices_name.xml" "stored_query_definitions/organization_indices_contact_point.xml" "stored_query_definitions/organization_read_credential.xml" "stored_query_definitions/health_worker_read_otherid.xml" "stored_query_definitions/health_worker_indices_operating_hours.xml" "stored_query_definitions/health_worker_read_operating_hours.xml" "stored_query_definitions/facility_indices_service.xml" "stored_query_definitions/organization_read_otherid.xml" "stored_query_definitions/service_get_urns.xml" "stored_query_definitions/facility_get_urns.xml" "stored_query_definitions/provider_name_search.xml" "stored_query_definitions/organization_indices_credential.xml" "stored_query_definitions/organization_read_contact_point.xml" "stored_query_definitions/facility_read_address.xml" "stored_query_definitions/health_worker_read_contact_point.xml" "stored_updating_query_definitions/health_worker_delete_org_contact_point.xml" "stored_updating_query_definitions/health_worker_update_contact_point.xml" "stored_updating_query_definitions/health_worker_delete_otherid.xml" "stored_updating_query_definitions/health_worker_create_org_address.xml" "stored_updating_query_definitions/health_worker_delete_provider_facility.xml" "stored_updating_query_definitions/health_worker_update_service.xml" "stored_updating_query_definitions/health_worker_update_provider_facility.xml" "stored_updating_query_definitions/health_worker_update_provider_organization.xml" "stored_updating_query_definitions/health_worker_create_service.xml" "stored_updating_query_definitions/health_worker_create_provider_organization.xml" "stored_updating_query_definitions/health_worker_delete_address.xml" "stored_updating_query_definitions/health_worker_update_provider.xml" "stored_updating_query_definitions/health_worker_create_org_contact_point.xml" "stored_updating_query_definitions/health_worker_delete_operating_hours.xml" "stored_updating_query_definitions/health_worker_create_provider.xml" "stored_updating_query_definitions/health_worker_delete_credential.xml" "stored_updating_query_definitions/health_worker_update_operating_hours.xml" "stored_updating_query_definitions/health_worker_update_name.xml" "stored_updating_query_definitions/health_worker_delete_name.xml" "stored_updating_query_definitions/health_worker_create_credential.xml" "stored_updating_query_definitions/health_worker_delete_org_address.xml" "stored_updating_query_definitions/health_worker_create_contact_point.xml" "stored_updating_query_definitions/health_worker_update_otherid.xml" "stored_updating_query_definitions/health_worker_create_provider_facility.xml" "stored_updating_query_definitions/health_worker_create_address.xml" "stored_updating_query_definitions/health_worker_delete_service.xml" "stored_updating_query_definitions/health_worker_update_address.xml" "stored_updating_query_definitions/health_worker_delete_provider_organization.xml" "stored_updating_query_definitions/health_worker_update_org_contact_point.xml" "stored_updating_query_definitions/health_worker_update_credential.xml" "stored_updating_query_definitions/health_worker_create_operating_hours.xml" "stored_updating_query_definitions/health_worker_delete_contact_point.xml" "stored_updating_query_definitions/health_worker_delete_provider.xml" "stored_updating_query_definitions/health_worker_update_org_address.xml" "stored_updating_query_definitions/health_worker_create_name.xml" "stored_updating_query_definitions/health_worker_create_otherid.xml" );\
for i in "${arr[@]}"; do resources/scripts/install_stored_function.php resources/$i; done
cd $HOME
git clone https://github.com/openhie/openinfoman-dhis
cp openinfoman-dhis/repo/* openinfoman/repo-src/
cp ~/openinfoman-dhis/resources/stored_query_definitions/* ~/openinfoman/resources/stored_query_definitions/
cp ~/openinfoman-dhis/resources/stored_updating_query_definitions/* ~/openinfoman/resources/stored_updating_query_definitions/
cd $HOME/openinfoman/repo-src
declare -a arr=("dxf2csd.xqm" "dxf_1_0.xqm" "util.xqm");\
for i in "${arr[@]}"; do basex -Vc "repo install $i"; done
cd $HOME/openinfoman
declare -a arr=("stored_query_definitions/aggregate_hw_export.xml" "stored_query_definitions/csd2dxf.xml" "stored_query_definitions/transform_to_dxf.xml" "stored_updating_query_definitions/dxf_to_svs.xml" "stored_updating_query_definitions/dxf_to_csd.xml" "stored_updating_query_definitions/extract_from_dxf.xml");\
for i in "${arr[@]}"; do resources/scripts/install_stored_function.php resources/$i; done
cp ~/openinfoman-dhis/webapp/openinfoman_dhis2_bindings.xqm ~/openinfoman/webapp
cp -R ~/openinfoman-dhis/resources/service_directories/* ~/openinfoman/resources/service_directories/
cd ~/openinfoman/bin && ./basexhttp &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment