Skip to content

Commit 2dc7f08

Browse files
author
Kristan Kenney
committed
Merge branch 'feature-package-copy' into develop
2 parents edb05e7 + 7a2609d commit 2dc7f08

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

bin/v-copy-package

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
# info: duplicate existing package
3+
#
4+
# The function allows the user to duplicate an existing
5+
# package file to facilitate easier configuration.
6+
7+
#----------------------------------------------------------#
8+
# Variable&Function #
9+
#----------------------------------------------------------#
10+
11+
# Argument definition
12+
package=$1
13+
new_package=$2
14+
15+
# Includes
16+
source $HESTIA/func/main.sh
17+
source $HESTIA/conf/hestia.conf
18+
19+
#----------------------------------------------------------#
20+
# Action #
21+
#----------------------------------------------------------#
22+
23+
if [ ! -z $1 ]; then
24+
if [ ! -f $HESTIA/data/packages/$package.pkg ]; then
25+
echo "Error: package does not exist."
26+
exit
27+
fi
28+
if [ ! -z $2 ]; then
29+
# Copy package
30+
cp -f $HESTIA/data/packages/$package.pkg $HESTIA/data/packages/$new_package.pkg
31+
else
32+
echo "Error: new package name not specified."
33+
fi
34+
else
35+
echo "Error: package name not specified."
36+
fi
37+
38+
#----------------------------------------------------------#
39+
# Hestia #
40+
#----------------------------------------------------------#
41+
log_event "$OK" "$ARGUMENTS"
42+
43+
exit

0 commit comments

Comments
 (0)