#!/usr/local/bin/bash webroot="/usr/local/www/html" spoolpath="/var/spool/rslight" configpath="/usr/local/etc/rslight" username="www" echo echo "This is an UPGRADE script for Rocksolid Light" echo "and must be run as root from the root directory of the extracted files" echo echo "Are you sure you wish to UPGRADE your installation?" echo "This action will overwrite your currently installed scripts" echo read -p "Type 'YES' to write the directories and overwrite current scripts: " default; echo if [ "$default" != "YES" ] then echo exiting... exit fi echo echo "Select current installation directories" echo echo "Choose a path for your web root for rslight" read -p "Use default web root $webroot (y/n)? " default; echo if [ "${default^^}" != "Y" ] then read -p "Enter web root for rslight: " webroot; echo fi echo "Choose a path for your spool files for rslight" read -p "Use default spool path $spoolpath (y/n)? " default; echo if [ "${default^^}" != "Y" ] then read -p "Enter spool path for rslight: " spoolpath; echo fi echo "Choose a path for rslight configuration files" read -p "Use default config path $configpath (y/n)? " default; echo if [ "${default^^}" != "Y" ] then read -p "Enter config path for rslight: " configpath; echo fi echo "Choose username used by your web server" read -p "Use default username $username (y/n)? " default; echo if [ "${default^^}" != "Y" ] then read -p "Enter username used by your web server: " username; echo fi echo echo "You have selected the following options:" echo echo "Web root: $webroot" echo "Spool dir: $spoolpath" echo "Config dir: $configpath" echo "Web user: $username" echo echo "Are you sure you wish to UPGRADE to these directories now," echo "overwrite files and change permissions as necessary to $username? " echo read -p "Type 'YES' to write the directories and overwrite current scripts: " default; echo if [ "$default" != "YES" ] then echo exiting... exit fi echo "Creating directories" echo -n "$webroot..." mkdir -p $webroot echo "done" echo -n "$spoolpath..." mkdir -p $spoolpath echo "done" echo -n "$configpath..." mkdir -p $configpath echo "done" echo echo -n "Moving files into place..." cp index.php $webroot cp -a common $webroot cp -a rocksolid $webroot cp -a spoolnews $webroot cp rslight/scripts/* $configpath/scripts mkdir $configpath/upgrade cp rslight/*.php $configpath/upgrade cp rslight/*.conf $configpath/upgrade cp rslight/*.dist $configpath/upgrade cp rslight/fortunes.conf.bsd $configpath/upgrade/fortunes.conf cp rslight/phpmailer.inc.php.bsd $configpath/upgrades/phpmailer.inc.php cp rslight/scripts/create_gpg_keys.sh.bsd $configpath/scripts/create_gpg_keys.sh echo "done" echo echo -n "Setting permissions..." chown $username $spoolpath chgrp $username $spoolpath chown $username "$configpath/users" chgrp $username "$configpath/users" chmod 700 "$configpath/users" chown $username "$configpath/userconfig" chgrp $username "$configpath/userconfig" chmod 700 "$configpath/userconfig" chown $username "$configpath/rslight.inc.php" chgrp $username "$configpath/rslight.inc.php" echo "done" echo echo -n "Setting semaphore to restart nntp server(s)..." touch "$configpath/nntp.reload" chown $username "$configpath/nntp.reload" chgrp $username "$configpath/nntp.reload" echo "done" echo echo -n "Applying configuration..." sed -i -e "s||$spoolpath/|" $webroot/common/config.inc.php sed -i -e "s||$configpath/|" $webroot/common/config.inc.php sed -i -e "s||$username|" $configpath/upgrade/rslight.inc.php echo "done" echo echo "All new configuration files have been placed in $configpath/upgrade." echo "If you choose to use these files, you may need to copy passwords and keys" echo "from your original files in $configpath." echo echo "Please review these files and make changes to existing files as may be necessary" echo echo "Upgrade complete"