Created
January 12, 2023 00:23
-
-
Save efann/cce55ec91970e5c7921ca69a6f517ed4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# License: Eclipse Public License - v 2.0 (https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html) | |
# Updated on January 11, 2023 | |
# Doesn' work yet. . . . | |
# From https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-later/upgrading-a-composer-based-site | |
if [[ $EUID -eq 0 ]]; then | |
echo -e "\nThis script may not be run as root. Exiting. . . .\n\n" | |
exit 1 | |
fi | |
if [ -z "$1" ]; then | |
echo -e "\nOne must pass the base folder name of the website under /var/www. Exiting. . . .\n\n" | |
exit 1 | |
fi | |
lcCurrent="$1" | |
# Remove trailing backslash, if exists, from lcCurrent. | |
lcWebFolder=/var/www/"${lcCurrent%/}"/public_html | |
if [ ! -d "$lcWebFolder" ]; then | |
echo -e "\nDrupal main folder, $lcWebFolder, does not exist. Exiting. . . .\n\n" | |
exit 1 | |
fi | |
pushd "$lcWebFolder" | |
echo -e "\n\nNow in $(pwd)" | |
echo -e "\n\nChanging the permissions in sites/default to write. . . ." | |
# From https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-later/upgrading-a-composer-based-site | |
chmod -v 777 ./sites/default | |
chmod -v 666 ./sites/default/*settings.php | |
chmod -v 666 ./sites/default/*services.yml | |
echo -e "\n\nRunning composer require. . . ." | |
composer require 'drupal/core-recommended:10.0.1' 'drupal/core-composer-scaffold:10.0.1' 'drupal/core-project-message:10.0.1' --update-with-dependencies --no-update | |
echo -e "\n\nRunning composer update. . . ." | |
composer update | |
echo -e "\n\nRunning drush updatedb. . . ." | |
drush updatedb | |
echo - "\n\nChanging the permissions in sites/default to back to protected. . . ." | |
chmod -v 755 ./sites/default | |
chmod -v 644 ./sites/default/*settings.php | |
chmod -v 644 ./sites/default/*services.yml | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment