#!/bin/sh set -e wget -m -nd http://laconi.ca/laconica-${LACONICAVERSION}.tar.gz mkdir -p ${YOURDOMAINFOLDER} tar xfz laconica-${LACONICAVERSION}.tar.gz --directory=${YOURDOMAINFOLDER} mv ~/${YOURDOMAINFOLDER}/laconica-${LACONICAVERSION}/* ~/${YOURDOMAINFOLDER} echo "Downloaded, extracted and copied Laconica to domain directory." echo "Downloading extra libraries now!" mkdir ~/${YOURDOMAINFOLDER}/extlib mkdir ~/${YOURDOMAINFOLDER}/xfers cd ~/${YOURDOMAINFOLDER}/xfers wget -m -nd -q http://openidenabled.com/files/php-openid/packages/php-openid-2.1.1.zip wget -m -nd -q http://michelf.com/docs/projets/php-markdown-1.0.1m.zip wget -m -nd -q http://oauth.googlecode.com/svn/code/php/OAuth.php ###wget http://xmpphp.googlecode.com/files/xmpphp-0.1beta-r21.tar.gz svn -q checkout svn://netflint.net/xmpphp echo "Finished grabbing files." echo "Starting extraction of archives." unzip -q php-markdown-1.0.1m.zip unzip -q php-openid-2.1.1.zip echo "Copying needed files." cp 'PHP Markdown 1.0.1m/markdown.php' ../extlib/ cp -r php-openid-2.1.1/Auth ../extlib/ cp OAuth.php ../extlib/ cp xmpphp/*.php ../extlib/ cp xmpphp/XMPPHP ../extlib -R echo "Done copying!" cd ~/${YOURDOMAINFOLDER}/ rm -rf xfers echo "Cleaning up!" rm -rf ~/${YOURDOMAINFOLDER}/laconica-${LACONICAVERSION}/ rm -f ~/laconica-${LACONICAVERSION}.tar.gz echo "All Done! Now we need to auto-configure Laconica and install the DB!" echo "" echo "Copying config.php.sample over to config.php!" cp -a ~/${YOURDOMAINFOLDER}/config.php.sample ~/${YOURDOMAINFOLDER}/config.php ### BEGIN findAndReplace Function function findAndReplace () { sed -i "$1" "$2" } ### End findAndReplace Function echo "Checking your lib/common.php" if grep '${PHPINCLUDEPATHCODE}' ~/${YOURDOMAINFOLDER}/lib/common.php; then echo "Skipping modification of include path in common.php file, as it already exists!" else findAndReplace "s/require_once('PEAR.php')/${PHPINCLUDEPATHCODE}\nrequire_once('PEAR.php')/g" ~/${YOURDOMAINFOLDER}/lib/common.php echo "common.php file has been modified to include PEAR and extra files properly!" fi echo "Now I need to modify your config.php file!" findAndReplace "s/\['server'\] = 'localhost';/['server'] = '${LACONICA_CONFIG_SERVER}';/g" ~/${YOURDOMAINFOLDER}/config.php findAndReplace "s/\['path'\] = 'laconica';/['path'] = '${LACONICA_CONFIG_PATH}';/g" ~/${YOURDOMAINFOLDER}/config.php findAndReplace "s/\#\$config\['site'\]\['fancy'\] = false;/\$config['site']['fancy'] = ${LACONICA_CONFIG_FANCY};/g" ~/${YOURDOMAINFOLDER}/config.php findAndReplace "s/mysql:\/\/laconica:microblog@localhost\/laconica/${MYSQLSTRING}/g" ~/${YOURDOMAINFOLDER}/config.php echo "Config modifcations have been written! Almost Done!" cp -a ~/${YOURDOMAINFOLDER}/classes/stoica.ini ~/${YOURDOMAINFOLDER}/classes/${MYSQLDB}.ini echo "Created copy of stoica.ini with correct filename!" echo "Creating .htaccess file!" mv ~/${YOURDOMAINFOLDER}/htaccess.sample ~/${YOURDOMAINFOLDER}/.htaccess echo "Modifying dataobject.ini file!" findAndReplace "s/mysql:\/\/root:\@localhost\/stoica/${MYSQLSTRING}/g" ~/${YOURDOMAINFOLDER}/dataobject.ini findAndReplace "s/\/home\/evan\/code\/stoica\/classes/${PATHTOCLASSES}/g" ~/${YOURDOMAINFOLDER}/dataobject.ini findAndReplace "s/require_prefix \= classes\//require_prefix = ${PATHTOCLASSES}/g" ~/${YOURDOMAINFOLDER}/dataobject.ini echo "dataobject.ini has been modified." echo "Now installing your DB!" rm ~/${YOURDOMAINFOLDER}/db/laconica.sql cd ~/${YOURDOMAINFOLDER}/db/ echo "Grabbing slightly modified laconica.sql for 4.4 db fix" wget http://files.gimmesoda.com/laconica/laconica.sql mysql -h ${MYSQLHOST} -u ${MYSQLUSER} -p${MYSQLPASS} ${MYSQLDB} < ~/${YOURDOMAINFOLDER}/db/laconica.sql echo "Database has been installed." echo "Wow...." echo "JJ @ GimmeSoda.com thinks this install is complete!"