X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fscripts%2Fhandle_plugin_node_modules;fp=skyquake%2Fscripts%2Fhandle_plugin_node_modules;h=75b65c011defd654bca8a71b5f37657aec418940;hp=0000000000000000000000000000000000000000;hb=03156e335275de1dafbc2a816e98006afdf249bf;hpb=f2dc2462571800e62cba969964de621dca09299c diff --git a/skyquake/scripts/handle_plugin_node_modules b/skyquake/scripts/handle_plugin_node_modules new file mode 100755 index 000000000..75b65c011 --- /dev/null +++ b/skyquake/scripts/handle_plugin_node_modules @@ -0,0 +1,58 @@ +#!/bin/bash + +# +# Copyright 2016 RIFT.IO Inc +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Unpack tar archives for plugins. Maintain a timestamp.txt file for each, so +# that tar archives are only unpacked if they have been changed. +# +# This script is needed to unpack the files as cpack cannot handle a lot of files. + +usage() { + echo "usage: $(basename ${BASH_SOURCE[0]})" +} + +function extract_node_modules() { + tar xf node_modules.tar + touch timestamp.txt +} + +# change to the directory of this script +THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) + +cd $THIS_DIR +echo "Handling plugin node modules" + +cd ../plugins +for dir in */; do + echo "Checking plugin "${dir}" for newer node_modules" + cd ${dir} + if [ ! -f timestamp.txt ]; then + echo "timestamp file not found ... node_modules need to be expanded and timestamp needs to be touched" + extract_node_modules + else + echo "Checking if node_modules.tar has a newer timestamp than timestamp.txt" + if [[ node_modules.tar -nt timestamp.txt ]]; then + echo "node_modules.tar is newer than timestamp ... node modules need to be expanded and timestamp needs to be touched" + extract_node_modules + else + echo "node_modules.tar is older than timestamp ... nothing needs to be done" + fi + fi + cd .. + echo "Checking plugin "${dir}" for newer node_modules ...done" +done +