Pierre-Luc Posted January 16, 2015 Posted January 16, 2015 (edited) Just wanted to share a simple bash script I've been using lately to make installing ProcessWire a little faster. Feel free to modify it to your taste! Just copy everything into a simple text file, I call mine "preparepw". Optionally, set this file to executable (chmod -x preparepw) and put it somewhere into your path to be able to load it as a regular command without the need to call it from sh ~/preparepw for example. To run, first cd to where you want to install PW's root, e.g. /sites/mysite/ then call the script. It will create a /sites/mysite/wwwroot/ directory containing all of PW's files from current master, set the required permissions and rename htaccess. It has an option to set the directory that, when unset, will default back to ./wwwroot. (e.g. preparepw public would install PW in ./public/). #!/bin/bash # Version 2.0 INPUT=$1 if [[ -z $INPUT ]]; then INPUT="wwwroot" printf "Directory option not set, installing into ./$INPUT/...\n" else printf "Installing in to ./$INPUT/...\n" fi # Select a version printf "\nWhich ProcessWire branch do you want to install?\n" options=("master" "dev" "devns") select BRANCH in "${options[@]}"; do test -n "$BRANCH" && break; echo ">>> Invalid selection, please try again"; done printf "\nDownloading ProcessWire $BRANCH branch, please hold on...\n" # Get ProcessWire master and prepare files if [ "$BRANCH" == "master" ]; then curl -o processwire.zip https://github.com/ryancramerdesign/ProcessWire/archive/master.zip -# -L fi if [ "$BRANCH" == "dev" ]; then curl -o processwire.zip https://github.com/ryancramerdesign/ProcessWire/archive/dev.zip -# -L fi if [ "$BRANCH" == "devns" ]; then curl -o processwire.zip https://github.com/ryancramerdesign/ProcessWire/archive/devns.zip -# -L fi unzip -q processwire.zip rm processwire.zip if [ "$BRANCH" == "master" ]; then mv ProcessWire-master $INPUT fi if [ "$BRANCH" == "dev" ]; then mv ProcessWire-dev $INPUT fi if [ "$BRANCH" == "devns" ]; then mv ProcessWire-devns $INPUT fi chmod -R u+rwX,go+rX,go-w $INPUT mv $INPUT/htaccess.txt $INPUT/.htaccess cd $INPUT # Prompt for site profile printf "\nWhich site profile will you be using?\n" select d in site-*/; do test -n "$d" && break; echo ">>> Invalid selection, please try again"; done mv $d site/ rm -rf site-*/ # Set permissions chmod 777 site/assets chmod 777 site/modules chmod 666 site/config.php printf "\n" read -p "Press [Enter] once you've finished the installation process to remove the install files..." rm install.php rm -rf site/install printf "\nInstallation files removed.\n" printf "\nDirectory \"$INPUT\" all set for ProcessWire. Have fun! \n" Edited January 19, 2016 by Pierre-Luc 15
kongondo Posted January 16, 2015 Posted January 16, 2015 What's grab.pw? http://processwire.com/download/ Grab.pw Accessing the URL grab.pw will always download the latest stable version (ZIP), and www.grab.pw will load our GitHub page. Soma’s Online Installer[/size] Yet another way to install ProcessWire is to use Soma's online installer. To use it, place this grabpw.php file to your web server, and then load it in your browser. It will download ProcessWire automatically and begin the installation process. Note that this technique may not work in all server environments. 3
Pierre-Luc Posted January 17, 2015 Author Posted January 17, 2015 I just edited the initial post. Directories permissions need to be set to 777, for some reason I copied an old version that wasn't working correctly.. 1
WinnieB Posted February 25, 2015 Posted February 25, 2015 Just wanted to share a simple bash script I've been using lately to make installing ProcessWire a little faster. Feel free to modify it to your taste! Thanks, this is awesome! I've seen people mention scripting PW installations, it's very helpful to see an actual example. 1
arjen Posted February 26, 2015 Posted February 26, 2015 No matching generator found *yet*. Try something else.
Pierre-Luc Posted April 1, 2015 Author Posted April 1, 2015 You can now download it from GitHub ! Click here! 1
OrganizedFellow Posted April 8, 2015 Posted April 8, 2015 VERY cool. Runs perfect on my desktop (Debian Wheezy).
Pierre-Luc Posted April 8, 2015 Author Posted April 8, 2015 Thanks for letting me know @OrganizedFellow! 1
bernhard Posted April 9, 2015 Posted April 9, 2015 i did something similar here: https://github.com/BernhardBaumrock/vagrant-pw-lamp/blob/master/bin/grabpw maybe it helps anyone who is as new to bash scripts as i am the part of creating the database is not needed in the new dev versions as this is already built in to core it is part of my vagrant lamp that i use for quickly setting up dev-environments on my windows machine. i really like it! but there are other threads in the forum about this topic... there's a lot more to find: https://processwire.com/talk/topic/9541-pw-cookie-cutter/
Pierre-Luc Posted April 9, 2015 Author Posted April 9, 2015 @BernhardB, yup, the PR I submit on database creation that Ryan accepted is directly linked to making the setup much, much faster. I'm still looking into Vagrant and/or Docker automatic setups, but time being limited, it's still far from being there. 2
Pierre-Luc Posted August 1, 2015 Author Posted August 1, 2015 I updated the install script. It is now interactive and prompts for which branch and which site profile you want to use. See it in action here: https://vid.me/gDwZ You can download the unified install script on GitHub. https://github.com/plauclair/pwscripts 1
Pierre-Luc Posted January 19, 2016 Author Posted January 19, 2016 Updated to support the devns branch. 2
OrganizedFellow Posted January 19, 2016 Posted January 19, 2016 Updated to support the devns branch. VERY useful, thank you! 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now