Add if to avoid errors + fix few other errors + fix erros with PP

This commit is contained in:
meaz 2021-02-14 11:30:15 +01:00
parent 027fec6c0f
commit e1cd829666
2 changed files with 18 additions and 12 deletions

2
vagrant/Vagrantfile vendored
View File

@ -21,7 +21,7 @@ Vagrant.configure("2") do |config|
disroot_lan.vm.synced_folder "../../grav-theme-disroot/", "/var/www/grav-theme-disroot", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../../grav-theme-disrootblog/", "/var/www/grav-theme-disrootblog", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../../grav-plugin-language-selector/", "/var/www/grav-plugin-language-selector", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../../Disroot-Privacy-Policy/", "/var/www/pages/privacy_policy/_pp", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../../Disroot-Privacy-Policy/", "/var/www/privacy_policy/", owner: "www-data", group: "www-data"
end
end

View File

@ -17,10 +17,10 @@ sudo debconf-set-selections <<< "postfix postfix/mailname string ${WEB_NAME}"
# Add sury repository to sources.list for PHP7.4
echo "set grub-pc/install_devices /dev/sda" | debconf-communicate # Fix grub error
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y install ca-certificates apt-transport-https
if ! grep -q "^deb .*sury" /etc/apt/sources.list /etc/apt/sources.list.d/*; then
echo "deb https://packages.sury.org/php/ buster main" | sudo tee -a /etc/apt/sources.list.d/php.list
sudo sh -c 'echo "deb https://packages.sury.org/php/ buster main" > /etc/apt/sources.list.d/php.list'
fi
# Sury Key for PHP7.4
@ -39,8 +39,12 @@ sudo apt-get install -y php7.4-zip php7.4-cli php7.4-curl php7.4-gd php7.4-mbstr
# Create the Nginx config files and restart webserver
echo "Installing Nginx config files..."
sudo rsync -cr /vagrant/provision/etc/nginx/sites-available /etc/nginx/
sudo ln -s /etc/nginx/sites-available/"${WEB_NAME}".conf /etc/nginx/sites-enabled/"${WEB_NAME}".conf
sudo rm /etc/nginx/sites-enabled/default
if [ ! -f /etc/nginx/sites-enabled/"${WEB_NAME}".conf ]; then
sudo ln -s /etc/nginx/sites-available/"${WEB_NAME}".conf /etc/nginx/sites-enabled/"${WEB_NAME}".conf
fi
if [ -f /etc/nginx/sites-enabled/default ]; then
sudo rm /etc/nginx/sites-enabled/default
fi
sudo service nginx restart
# Install GRAV in webroot
@ -134,17 +138,19 @@ sudo sed -i "s/127.0.0.1\tlocalhost/127.0.0.1\tlocalhost $WEB_NAME/" /etc/hosts
sudo mount -o bind /var/www/pages "${WEB_ROOT}""${WEB_NAME}"/user/pages
chown "${WWW_USER}":"${WWW_USER}" -R "${WEB_ROOT}""${WEB_NAME}"/user/pages
# Add Privacy Statement pages in GRAV
sudo mount -o bind /var/www/pages/privacy_policy/_pp "${WEB_ROOT}""${WEB_NAME}"/user/pages/privacy_policy/_pp
chown "${WWW_USER}":"${WWW_USER}" -R "${WEB_ROOT}""${WEB_NAME}"/user/pages/privacy_policy/_pp
# Add Disroot theme in GRAV
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"/grav-theme-disroot "${WEB_ROOT}""${WEB_NAME}"/user/themes/disroot
if [ ! -d "${WEB_ROOT}""${WEB_NAME}"/user/themes/disroot/grav-theme-disroot ]; then
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"grav-theme-disroot "${WEB_ROOT}""${WEB_NAME}"/user/themes/disroot
fi
# Add Disroot Blog theme in GRAV
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"/grav-theme-disrootblog "${WEB_ROOT}""${WEB_NAME}"/user/themes/disrootblog
if [ ! -d "${WEB_ROOT}""${WEB_NAME}"/user/themes/disrootblog/grav-theme-disrootblog ]; then
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"grav-theme-disrootblog "${WEB_ROOT}""${WEB_NAME}"/user/themes/disrootblog
fi
# Add language-selector in GRAV
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"/grav-plugin-language-selector "${WEB_ROOT}""${WEB_NAME}"/user/plugins/language-selector
if [ ! -d "${WEB_ROOT}""${WEB_NAME}"/user/plugins/language-selector/grav-plugin-language-selector ]; then
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"grav-plugin-language-selector "${WEB_ROOT}""${WEB_NAME}"/user/plugins/language-selector
fi
exit 0