[Swift-commit] r8029 - www

wozniak at ci.uchicago.edu wozniak at ci.uchicago.edu
Wed Jul 16 15:34:03 CDT 2014


Author: wozniak
Date: 2014-07-16 15:34:03 -0500 (Wed, 16 Jul 2014)
New Revision: 8029

Modified:
   www/push_to.sh
Log:
Add update and help features


Modified: www/push_to.sh
===================================================================
--- www/push_to.sh	2014-07-16 20:33:42 UTC (rev 8028)
+++ www/push_to.sh	2014-07-16 20:34:03 UTC (rev 8029)
@@ -1,15 +1,42 @@
 #!/bin/bash -eu
 
+# PUSH_TO.SH
+# Use './push_to.sh -h' for usage
+
+usage()
+{
+   echo   "usage: push_to.sh [-u] <DESTINATION>"
+   printf "\t -u: Use cp -u to update file based on timestamp\n"
+}
+
 # File permissions
 CHMOD_DIRECTORY_MODE="775"
 CHMOD_FILE_MODE="664"
 GROUP="vdl2-svn"
 
+UPDATE=0
+while getopts "hu" OPTION
+do
+   case $OPTION in 
+      h) usage ; exit 0 ;;
+      u) UPDATE=1       ;;
+      *) exit 1         ;; # Bash prints an error message
+   esac
+done
+shift $(( OPTIND -1 ))
+
+U=""
+if (( UPDATE )) 
+then 
+   U=u
+fi
+
 # Verify command line arguments
-if [ -n "$1" ]; then
+if [ -n "${1:-}" ]; then
    DESTINATION=$1
 else
-   echo Error: Specify directory to copy to
+   echo "You must provide DESTINATION!"
+   usage
    exit 1
 fi
 
@@ -123,6 +150,7 @@
 dhtml.js
 updatenodocs.sh
 template_info/template.php
+papers/index.php
 papers/pdfs/*.pdf 
 usage/charts.swf
 usage/usage.php
@@ -232,9 +260,13 @@
    mkdir -p $DESTINATION/$destination_dir
    chgrp $GROUP $DESTINATION/$destination_dir > /dev/null 2>&1
    chmod $CHMOD_DIRECTORY_MODE $DESTINATION/$destination_dir > /dev/null 2>&1
-   cp -uv $FILE $DESTINATION/$destination_dir
+   cp -${U}v $FILE $DESTINATION/$destination_dir
    chgrp $GROUP $DESTINATION/$FILE > /dev/null 2>&1
    chmod $CHMOD_FILE_MODE $DESTINATION/$FILE > /dev/null 2>&1
 done
 
 popd > /dev/null 2>&1
+
+# Local Variables: 
+# sh-basic-offset: 3
+# End:




More information about the Swift-commit mailing list