blob: d606186079937ff4705ff8ffa577ee0d0384aba2 [file] [log] [blame]
aravind.estc42cc922023-09-27 13:24:58 +01001#!/bin/bash
2
3# ============LICENSE_START===============================================
4# Copyright (C) 2023 Nordix Foundation. All rights reserved.
aravind.estf801ec52024-01-08 15:33:50 +00005# Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
aravind.estc42cc922023-09-27 13:24:58 +01006# ========================================================================
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# ============LICENSE_END=================================================
19#
20
aravind.estf801ec52024-01-08 15:33:50 +000021if [[ $# -ne 1 ]]; then
22 echo "USAGE: $0 <rApp-resource-folder-name>"
23 exit 1
24fi
25
aravind.est4cebf292024-01-11 12:49:50 +000026if ! command -v zip &> /dev/null; then
27 echo "Zip command not found. Please install zip to proceed."
28 exit 1
29fi
30
aravind.estf801ec52024-01-08 15:33:50 +000031DIRECTORY=${1%/}
32PACKAGENAME="$DIRECTORY.csar"
33
34if [ -d "$DIRECTORY" ]; then
35 rm $PACKAGENAME 2> /dev/null
36 pushd $DIRECTORY
37 zip -r ../$PACKAGENAME *
38 popd
39 echo -e "rApp package $PACKAGENAME generated."
40else
41 echo "Directory $DIRECTORY doesn't exists."
42fi