kalkun for Debian
----------------------

Kalkun can be reached at <http://localhost/kalkun/>.

On the 1st run, it will display the installation wizard. This is the
recommended method to install and update kalkun. When the Debian package is
updated, the installation wizard will be displayed again. This will permit you
to update the database in a smooth way for the new version.

If the URL doesn't display the installation wizard, you can force it to appear
by creating a file at `/usr/share/kalkun/www/install`. This file can be empty.

Before continuing with the wizard, you have to decide which Database Engine
you want to use. It can be either MySQL, PostgreSQL or SQLite3. Depending on
your choice, the checks of the wizard will slightly differ. You should also
check that you have installed the php module for that database (the wizard will
check its presence anyway).


* Database connection setup
----------------------------

Edit /etc/kalkun/config/database.php and set the $active_group variable with
a value that corresponds to the database engine you want to use.

For MySQL it would be:

    $active_group = 'kalkun_mysql';

For postgreSQL it would be:

    $active_group = 'kalkun_postgresql';

and so on.

Then configure the database parameters for the selected $active_group

For example for postgreSQL:

    $db['kalkun_postgresql'] = array(
        'dsn'	=> '',
        'hostname' => 'localhost',
        'username' => 'username',
        'password' => 'password',
        'database' => 'database',
    ...

Some help to create a database can also be found on the wiki at:

    https://github.com/kalkun-sms/Kalkun/wiki/Setup-Gammu-SMSD-DB

And to configure the connection to the database:

    https://github.com/kalkun-sms/Kalkun/wiki/Installation#configure-the-connection-to-the-database


* Extra
-------

If you use PostgreSQL (this is not done yet for MySQL, but you may adapt the
trigger easily) you can add a trigger to the database for a good integration
between kalkun & gammu-smsd-inject.

More information on the rationale is at the head of file
01-kalkun-smsd-inject-trigger.pgsql.sql in /usr/share/doc/kalkun

    psql -U username -h localhost database < /usr/share/doc/kalkun/01-kalkun-smsd-inject-trigger.pgsql.sql

You may add a user named 'smsd-inject' to kalkun if you prefer that only this
user can read the SMS inserted this way (instead of "kalkun" user)
Note the 'smsd-inject' name is set in the trigger, so it has to be the same in kalkun.


* If you upgrade from 0.7.1 to 0.8
----------------------------------

- You will have to update the passwords for the kalkun users in the database.

- Default kalkun password has to be updated too
If column password of table "users" is
f0af18413d1c9e0366d8d1273160f55d5efeddfe
you have to set it to
$2y$10$Sg0IxngRIIp1qNITM8kWa.aJ26w58F97ByTzDKoRF/dyzKcLfx226

You can find SQL commands to update/reset default kalkun password in
/usr/share/doc/kalkun/:
For example with postgresql (and a database named 'smsd') you may run

    su postgres -c "psql smsd -f /usr/share/doc/kalkun/10-reset_kalkun_password_to_default.pgsql.sql"

- To compute a hash for a given password run:
    $ php -r 'echo password_hash("new_password", PASSWORD_BCRYPT) . "\n";'

