73 lines
1.7 KiB
Bash
Executable File
73 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
mkdir -p /run/php/sessions
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
chown -R www-data.www-data /run/php /app/data
|
|
|
|
echo "Trying to update feeds every 60 secs"
|
|
while true; do
|
|
sleep 60
|
|
sudo -u www-data php /app/code/app/actualize_script.php >/dev/stdout 2>/dev/stderr
|
|
done &
|
|
|
|
echo "Starting apache"
|
|
APACHE_CONFDIR="" source /etc/apache2/envvars
|
|
rm -f "${APACHE_PID_FILE}"
|
|
exec /usr/sbin/apache2 -DFOREGROUND
|