Tiny Tiny RSS integration on SME Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.3 KiB

{
my $db = ${'tt-rss'}{'DbName'} || 'rssdb';
my $user = ${'tt-rss'}{'DbUser'} || 'rssuser';
my $pass = ${'tt-rss'}{'DbPassword'} || 'secret';
my $schema = `rpm -ql tt-rss | grep ttrss_schema_mysql.sql`;
$OUT .= <<"END";
#! /bin/sh
if [ \! -d /var/lib/mysql/$db ]; then
/usr/bin/mysqladmin create $db
/usr/bin/mysql $db < $schema
else
su -s /bin/bash - www -c "cd /usr/share/tt-rss && echo 'yes' | /usr/bin/php__PHP_VERSION__ ./update.php --update-schema"
fi
/usr/bin/mysql <<EOF
USE mysql;
REPLACE INTO user (
host,
user,
password)
VALUES (
'localhost',
'$user',
PASSWORD ('$pass'));
REPLACE INTO db (
host,
db,
user,
select_priv, insert_priv, update_priv, delete_priv,
create_priv, alter_priv, index_priv, drop_priv, create_tmp_table_priv,
grant_priv, lock_tables_priv, references_priv)
VALUES (
'localhost',
'$db',
'$user',
'Y', 'Y', 'Y', 'Y',
'Y', 'Y', 'Y', 'Y', 'Y',
'N', 'Y', 'Y');
FLUSH PRIVILEGES;
EOF
END
}