Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Import theme from given workspace into CoreMedia CMS-9
- #
- # $1 - importer user - default theme-importer
- # $2 - importer user's password - default importingthemes
- # $3 - workspace directory - default ~/coremedia9
- # $4 - themes subdirectory - default modules/frontend
- # $5 - theme - default corporate
- #
- # Copyright (c) 2017, Martin Goellnitz
- # All rights reserved.
- #
- # Redistribution and use in source and binary forms, with or without modification,
- # are permitted provided that the following conditions are met:
- #
- # 1. Redistributions of source code must retain the above copyright notice,
- # this list of conditions and the following disclaimer.
- #
- # 2. Redistributions in binary form must reproduce the above copyright notice,
- # this list of conditions and the following disclaimer in the documentation
- # and/or other materials provided with the distribution.
- #
- # 3. Neither the name of the copyright holder nor the names of its contributors
- # may be used to endorse or promote products derived from this software
- # without specific prior written permission.
- #
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- #
- USERNAME=${1:theme-importer}
- PASSWORD=${2:-importingthemes}
- WORKSPACE=${3:-~/coremedia9}
- DIR=${4:-modules/frontend}
- THEME=${5:-corporate}
- LOG=/tmp/cms-themes.log
- source /etc/profile
- cd $WORKSPACE
- echo -n "Syncing with GIT upstream " >> $LOG
- date >> $LOG
- git stash >> $LOG
- git fetch >> $LOG
- git rebase >> $LOG
- git stash apply >> $LOG 2>&1
- git stash clear >> $LOG 2>&1
- NOW=`date +%s`
- LASTREBASE=`cat /tmp/lastthemecommit-$THEME`
- LASTCOMMIT=`git log -n1 --format="%h"`
- if [ "$LASTCOMMIT" != "$LASTREBASE" ] ; then
- echo -n "Building theme $THEME. " > $LOG
- date >> $LOG
- echo $LASTCOMMIT > /tmp/lastthemecommit-$THEME
- cd $DIR
- export MAVEN_OPTS="-Xms1024m -Xmx4096m -Dorg.slf4j.simpleLogger.defaultLogLevel=warn"
- mvn clean >>$LOG
- mvn install >> $LOG
- # export PATH=$WORKSPACE/$DIR/node:$WORKSPACE/$DIR/bin:$PATH
- # npm install
- # npm install -g grunt grunt-svg-sprite
- # npm install grunt grunt-svg-sprite
- echo -n "Uploading theme $THEME " >> $LOG
- ls $WORKSPACE/$DIR/target/themes/$THEME-theme.zip >> $LOG
- /opt/coremedia/theme-importer-tools/bin/cm import-themes -u $USERNAME -p $PASSWORD $WORKSPACE/$DIR/target/themes/$THEME-theme.zip >> $LOG
- echo -n "Updating theme done. " >> $LOG
- date >> $LOG
- else
- echo "Last unchanged commit was $LASTCOMMIT" >> $LOG
- fi
Add Comment
Please, Sign In to add comment