Guest User

Untitled

a guest
Nov 6th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.09 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Import theme from given workspace into CoreMedia CMS-9
  4. #
  5. # $1 - importer user - default theme-importer
  6. # $2 - importer user's password - default importingthemes
  7. # $3 - workspace directory - default ~/coremedia9
  8. # $4 - themes subdirectory - default modules/frontend
  9. # $5 - theme - default corporate
  10. #
  11. # Copyright (c) 2017, Martin Goellnitz
  12. # All rights reserved.
  13. #
  14. # Redistribution and use in source and binary forms, with or without modification,
  15. # are permitted provided that the following conditions are met:
  16. #
  17. # 1. Redistributions of source code must retain the above copyright notice,
  18. # this list of conditions and the following disclaimer.
  19. #
  20. # 2. Redistributions in binary form must reproduce the above copyright notice,
  21. # this list of conditions and the following disclaimer in the documentation
  22. # and/or other materials provided with the distribution.
  23. #
  24. # 3. Neither the name of the copyright holder nor the names of its contributors
  25. # may be used to endorse or promote products derived from this software
  26. # without specific prior written permission.
  27. #
  28. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  29. # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  30. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  31. # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  32. # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33. # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  34. # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  35. # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  36. # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  37. # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. #
  39. USERNAME=${1:theme-importer}
  40. PASSWORD=${2:-importingthemes}
  41. WORKSPACE=${3:-~/coremedia9}
  42. DIR=${4:-modules/frontend}
  43. THEME=${5:-corporate}
  44. LOG=/tmp/cms-themes.log
  45.  
  46. source /etc/profile
  47.  
  48. cd $WORKSPACE
  49. echo -n "Syncing with GIT upstream " >> $LOG
  50. date >> $LOG
  51. git stash >> $LOG
  52. git fetch >> $LOG
  53. git rebase >> $LOG
  54. git stash apply >> $LOG 2>&1
  55. git stash clear >> $LOG 2>&1
  56.  
  57. NOW=`date +%s`
  58. LASTREBASE=`cat /tmp/lastthemecommit-$THEME`
  59. LASTCOMMIT=`git log -n1 --format="%h"`
  60.  
  61. if [ "$LASTCOMMIT" != "$LASTREBASE" ] ; then
  62. echo -n "Building theme $THEME. " > $LOG
  63. date >> $LOG
  64. echo $LASTCOMMIT > /tmp/lastthemecommit-$THEME
  65.  
  66. cd $DIR
  67.  
  68. export MAVEN_OPTS="-Xms1024m -Xmx4096m -Dorg.slf4j.simpleLogger.defaultLogLevel=warn"
  69. mvn clean >>$LOG
  70. mvn install >> $LOG
  71.  
  72. # export PATH=$WORKSPACE/$DIR/node:$WORKSPACE/$DIR/bin:$PATH
  73. # npm install
  74. # npm install -g grunt grunt-svg-sprite
  75. # npm install grunt grunt-svg-sprite
  76.  
  77. echo -n "Uploading theme $THEME " >> $LOG
  78. ls $WORKSPACE/$DIR/target/themes/$THEME-theme.zip >> $LOG
  79. /opt/coremedia/theme-importer-tools/bin/cm import-themes -u $USERNAME -p $PASSWORD $WORKSPACE/$DIR/target/themes/$THEME-theme.zip >> $LOG
  80. echo -n "Updating theme done. " >> $LOG
  81. date >> $LOG
  82. else
  83. echo "Last unchanged commit was $LASTCOMMIT" >> $LOG
  84. fi
Add Comment
Please, Sign In to add comment