#!/bin/sh ## ## phabricator-setup ## # determine MySQL root password db_suser=`grep "^user" @l_prefix@/etc/mysql/my.pwd |\ sed -e 's;^user[^=]*= *;;' -e 's; *$;;'` db_spass=`grep "^password" @l_prefix@/etc/mysql/my.pwd |\ sed -e 's;^password[^=]*= *;;' -e 's; *$;;'` # dispatch operation cmd="${1:-"install"}" case "$cmd" in install ) # create the database @l_prefix@/sbin/phabricator-storage upgrade --force --user "$db_suser" --password "$db_spass" ;; upgrade ) # upgrade the database @l_prefix@/sbin/phabricator-storage upgrade --force --user "$db_suser" --password "$db_spass" ;; uninstall ) # remove the database ( for db in \ phabricator_almanac phabricator_audit phabricator_auth phabricator_cache phabricator_calendar \ phabricator_chatlog phabricator_conduit phabricator_config phabricator_conpherence phabricator_countdown \ phabricator_daemon phabricator_dashboard phabricator_differential phabricator_diviner phabricator_doorkeeper \ phabricator_draft phabricator_drydock phabricator_fact phabricator_feed phabricator_file phabricator_flag \ phabricator_fund phabricator_harbormaster phabricator_herald phabricator_legalpad phabricator_maniphest \ phabricator_meta_data phabricator_metamta phabricator_nuance phabricator_oauth_server phabricator_owners \ phabricator_passphrase phabricator_pastebin phabricator_phame phabricator_phlux phabricator_pholio \ phabricator_phortune phabricator_phragment phabricator_phrequent phabricator_phriction phabricator_policy \ phabricator_ponder phabricator_project phabricator_releeph phabricator_repository phabricator_search \ phabricator_slowvote phabricator_system phabricator_token phabricator_user phabricator_worker \ phabricator_xhpastview phabricator_xhprof; do \ echo "DROP DATABASE $db;" done ) | @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" mysql ;; esac