|
|
@ -0,0 +1,71 @@ |
|
|
|
#!/bin/bash |
|
|
|
|
|
|
|
### DO NOT EDIT THIS FILE |
|
|
|
|
|
|
|
source "$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." &> /dev/null && pwd)/etc/config" |
|
|
|
source "$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." &> /dev/null && pwd)/etc/projects" |
|
|
|
|
|
|
|
function usage { |
|
|
|
echo |
|
|
|
echoMainTitle "Installs a plugin" |
|
|
|
echo |
|
|
|
echoSubTitle "Usage:" |
|
|
|
echo |
|
|
|
echo "install-plugin [shortname] [plugin]" |
|
|
|
echo |
|
|
|
echo "--help Prints this message" |
|
|
|
echo " " |
|
|
|
} |
|
|
|
|
|
|
|
help="$(getParameter "--help" false "$*")" |
|
|
|
if [ "$help" == true ] || [ "$1" == "" ] |
|
|
|
then |
|
|
|
usage |
|
|
|
exit |
|
|
|
fi |
|
|
|
|
|
|
|
shortname=$(getArgument "$1" "$(usage)" true) |
|
|
|
plugin=$(getArgument "$2" "$(usage)" true) |
|
|
|
customer=$(getCustomerFromShortname "$shortname") |
|
|
|
project=$(getProjectFromShortname "$shortname") |
|
|
|
project_dir="$project_manager_dir/data/$customer/$project" |
|
|
|
plugin_dir="$project_manager_dir/plugins/$plugin" |
|
|
|
|
|
|
|
if [ ! -d "$project_dir" ] |
|
|
|
then |
|
|
|
echo |
|
|
|
echoError "Could not find project dir" |
|
|
|
echo |
|
|
|
exit |
|
|
|
fi |
|
|
|
|
|
|
|
if [ ! -d "$plugin_dir" ] |
|
|
|
then |
|
|
|
echo |
|
|
|
echoError "Could not find plugin dir" |
|
|
|
echo |
|
|
|
exit |
|
|
|
fi |
|
|
|
|
|
|
|
echo |
|
|
|
echoMainTitle "Install plugin" |
|
|
|
|
|
|
|
if [ ! -d "$project_dir/etc/plugins/$plugin" ] |
|
|
|
then |
|
|
|
mkdir "$project_dir/etc/plugins/$plugin" |
|
|
|
fi |
|
|
|
|
|
|
|
etc_files=$(list "$plugin/etc") |
|
|
|
for etc_file in "${etc_files[@]}" |
|
|
|
do |
|
|
|
cp "$etc_file" "$project_dir/etc/plugins/$plugin/config" |
|
|
|
done |
|
|
|
|
|
|
|
echo |
|
|
|
echoSubTitle "Running postscripts ..." |
|
|
|
postScript "$project_manager_dir/bin/postscripts/commands/install-plugin" |
|
|
|
postScript "$project_dir/bin/postscripts/commands/install-plugin" |
|
|
|
|
|
|
|
echo |
|
|
|
echoSuccess "Plugin has been installed, please configure: $project_dir/etc/plugins/$plugin" |
|
|
|
echo |