Source code for /home/gipetto1/top-frog.com/public_html/script_src/files/ssh-action.sh

  1.  #!/bin/bash
  2.  #
  3.  # Script to override the default SVN command and pass all parameters to the "proper"
  4.  # svn command while running a few operations after the svn command has run.
  5.  #
  6.  # To install:
  7.  # as root:
  8.  # 1. move this script to another location on the server so that it can be customized
  9.  # 2. edit the paths for REAL_SVN and BASE_PATH to reflect the server setup
  10.  # 3. make sure this file is editable with chmod +x svn-perms.sh
  11.  # as normal user:
  12.  # 4. edit the ~/.bashrc file and add a new line:
  13.  # alias svn="/path/to/this/file $@"
  14.  #
  15.  # Usage
  16.  #
  17.  # Usage should not vary from any other SVN command. Call svn as normal and all svn commands will
  18.  # be passed through to the normal svn executable. SVN will respond as normal but the commands also
  19.  # listed in this file will be executed on update commands.
  20.  #
  21.  # This will work in the scope of the current user. Someone doing updates as root will have the same
  22.  # effect on the editability of files as with normal SVN operation.
  23.  
  24.  # to avoid this script calling itself, define the full path to the SVN binary
  25.  REAL_SVN='/usr/bin/svn';
  26.  
  27.  # define the base path to where operations are to be constrained
  28.  # helps keep any find commands from trying to search the entire system
  29.  # this doesn't have to be here, it could be hard coded below if you prefer
  30.  BASE_PATH='/path/to/web/root/';
  31.  
  32.  # put any pre-svn actions here, make sure to add the `wait` command after whatever
  33.  # you add so that the operation is sure to finish before svn operates
  34.  
  35.  # call svn
  36.  $REAL_SVN $@;
  37.  wait;
  38.  
  39.  # post-svn actions
  40.  if [ $1 = 'up' ]; then
  41.   find -L $BASE_PATH -type f -name 'editable.file' -exec bash -c 'chmod 0777 $0' '{}' \;
  42.  fi