freshrss-app/start.sh

67 lines
1.6 KiB
Bash
Raw Normal View History

2017-02-17 08:45:48 +00:00
#!/bin/bash
set -eu
2017-02-17 10:28:42 +00:00
mkdir -p /run/php/sessions
2017-02-17 08:45:48 +00:00
if ! [ -f /app/data/.installed ]; then
echo "Fresh installation, setting up..."
rsync -a /app/code/data-orig/ /app/data/
dd if=/dev/urandom bs=1 count=1024 2>/dev/null | sha1sum | awk '{ print $1 }' > /app/data/.salt
mkdir -p /app/data/users/admin
cat > /app/data/users/admin/config.php <<EOF
<?php
return array (
'language' => 'en',
'passwordHash' => '\$2a\$09\$lO5xTAsfRCG1rSssJgHtTeiweXj2VwGN/JfuexIMpsQWzKoFVoklm',
'apiPasswordHash' => '',
);
?>
EOF
touch /app/data/users/admin/log.txt
rm /app/data/do-install.txt
php /app/code/setup_db.php
touch /app/data/.installed
echo "Done."
fi
2017-02-18 10:51:44 +00:00
mkdir -p /app/data/extensions
for f in $(ls /app/code/extensions-orig); do
if ! [ -e "/app/data/extensions/$f" ]; then
ln -s "/app/code/extensions-orig/$f" "/app/data/extensions/$f"
fi
done
2017-02-17 08:45:48 +00:00
echo "Creating config file"
SALT=$(cat /app/data/.salt)
cat > /app/data/config.php <<EOF
<?php
return array (
'salt' => '${SALT}',
'base_url' => 'https://${APP_DOMAIN}/p',
'title' => 'FreshRSS',
'default_user' => 'admin',
'auth_type' => 'form',
'db' =>
array (
'type' => 'mysql',
'host' => '${MYSQL_HOST}',
'user' => '${MYSQL_USERNAME}',
'password' => '${MYSQL_PASSWORD}',
'base' => '${MYSQL_DATABASE}',
'prefix' => '',
'pdo_options' =>
array (
),
),
'pubsubhubbub_enabled' => true,
);
EOF
2017-02-17 10:28:42 +00:00
chown -R www-data.www-data /run/php /app/data
2017-02-17 08:45:48 +00:00
echo "Starting apache"
APACHE_CONFDIR="" source /etc/apache2/envvars
rm -f "${APACHE_PID_FILE}"
exec /usr/sbin/apache2 -DFOREGROUND