#!/bin/bash

# enable kp conf
echo "Include conf.d/" > /etc/apache2/apache2.conf
>/etc/php5/apache2/php.ini
>/etc/php5/cli/php.ini
>/etc/php5/cgi/php.ini
# restart apache2
/etc/init.d/apache2 restart
# disable host check
cat /etc/ssh/ssh_config | sed 's/#   StrictHostKeyChecking ask/StrictHostKeyChecking no/g' > /etc/ssh/ssh_config.new
mv /etc/ssh/ssh_config.new /etc/ssh/ssh_config
# chown www-data
chown -R www-data:www-data /var/www/
chmod 600 /var/www/.ssh/id_rsa
# symlink to php scripts
ln -s /home /spool
# change system ffmpeg
rm -f /usr/bin/ffmpeg
ln -s /usr/local/bin/ffmpeg /usr/bin/ffmpeg
# create dir
mkdir -p /home/www/static.kinopoisk.ru/trailers/podcast
mkdir -p /home/www/static.kinopoisk.ru/tmp
chmod 777 /home/www/static.kinopoisk.ru/tmp
chmod 777 /home/www/static.kinopoisk.ru/trailers/podcast
chmod 777 /home/www/static.kinopoisk.ru/trailers
# locale
cat /usr/share/i18n/SUPPORTED | grep UTF-8 > /tmp/local
cat /usr/share/i18n/SUPPORTED | grep CP1251 >> /tmp/local
mv /tmp/local /var/lib/locales/supported.d/local
dpkg-reconfigure locales
echo "LANG=ru_RU.cp1251
LANGUAGE="en_US:en"
LC_ALL=ru_RU.cp1251" > /etc/default/locale
