liamfallon | a41c877 | 2018-09-05 15:46:31 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | #------------------------------------------------------------------------------- |
| 4 | # ============LICENSE_START======================================================= |
| 5 | # Copyright (C) 2016-2018 Ericsson. All rights reserved. |
| 6 | # ================================================================================ |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | # you may not use this file except in compliance with the License. |
| 9 | # You may obtain a copy of the License at |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | # See the License for the specific language governing permissions and |
| 17 | # limitations under the License. |
| 18 | # |
| 19 | # SPDX-License-Identifier: Apache-2.0 |
| 20 | # ============LICENSE_END========================================================= |
| 21 | #------------------------------------------------------------------------------- |
| 22 | |
| 23 | ## |
| 24 | ## Script to clear all created site artifacts, so all target/site for all modules plus target/ad-site on parrent. |
| 25 | ## Call -h for help |
| 26 | ## |
| 27 | ## @author Sven van der Meer <sven.van.der.meer@ericsson.com> |
| 28 | ## @version v2.0.0 |
| 29 | |
| 30 | |
| 31 | ## |
| 32 | ## DO NOT CHANGE CODE BELOW, unless you know what you are doing |
| 33 | ## |
| 34 | |
| 35 | ## script name for output |
| 36 | MOD_SCRIPT_NAME=`basename $0` |
| 37 | |
| 38 | |
| 39 | ## |
| 40 | ## Help screen and exit condition (i.e. too few arguments) |
| 41 | ## |
| 42 | Help() |
| 43 | { |
| 44 | echo "" |
| 45 | echo "$MOD_SCRIPT_NAME - remove all generated site artifacts." |
| 46 | echo "" |
| 47 | echo " Usage: $MOD_SCRIPT_NAME [options]" |
| 48 | echo "" |
| 49 | echo " Options" |
| 50 | echo " -x - execute the delete actions" |
| 51 | echo " -h - this help screen" |
| 52 | echo "" |
| 53 | echo "" |
| 54 | exit 255; |
| 55 | } |
| 56 | if [ $# -eq 0 ]; then |
| 57 | Help |
| 58 | fi |
| 59 | |
| 60 | while [ $# -gt 0 ] |
| 61 | do |
| 62 | case $1 in |
| 63 | # -x do clear |
| 64 | -x) |
| 65 | echo |
| 66 | echo "$MOD_SCRIPT_NAME: removing generated sites in all modules" |
| 67 | for dir in `find -type d -name "site"|grep "/target/"` |
| 68 | do |
| 69 | echo "--> removing $dir" |
| 70 | rm -fr $dir |
| 71 | done |
| 72 | echo "--> removing target/ad-site" |
| 73 | rm -fr target/ad-site |
| 74 | exit |
| 75 | ;; |
| 76 | |
| 77 | #-h prints help and exists |
| 78 | -h) Help;exit 0;; |
| 79 | |
| 80 | *) echo "$MOD_SCRIPT_NAME: undefined CLI option - $1"; exit 255;; |
| 81 | esac |
| 82 | done |
| 83 | |