You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.4 KiB
58 lines
1.4 KiB
#!/bin/bash
|
|
|
|
### DO NOT EDIT THIS FILE
|
|
|
|
source "$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." &> /dev/null && pwd)/includes/bash_header"
|
|
|
|
function usage {
|
|
echo
|
|
echoMainTitle "Removes a project"
|
|
echo
|
|
echoSubTitle "Usage:"
|
|
echo
|
|
echo "remove-project [shortname]"
|
|
echo
|
|
echo "This will remove the project and move the project files to ./.trash"
|
|
echo
|
|
echo "--help Prints this message"
|
|
echo
|
|
}
|
|
|
|
shortname="$(getArgument "$1" "$(usage)" true)"
|
|
customer="$(getCustomerFromShortname "$shortname")"
|
|
project="$(getProjectFromShortname "$shortname")"
|
|
pos="$(getProjectConfigPosition "$shortname")"
|
|
workspace_dir="$project_manager_workspaces_dir/$customer/$project"
|
|
project_dir="$project_manager_dir/data/$customer/$project"
|
|
|
|
echo
|
|
echoMainTitle "Remove project"
|
|
|
|
echo
|
|
echoSubTitle "Please verify data"
|
|
echo
|
|
echo "Project Path: $workspace_dir"
|
|
echo "Project Data Path: $project_dir"
|
|
echo
|
|
confirm
|
|
|
|
echo
|
|
echo "Moving files to trash"
|
|
|
|
rand=$(cat /proc/sys/kernel/random/uuid)
|
|
trash_path="$project_manager_dir/.trash/$rand"
|
|
mkdir "$trash_path"
|
|
mkdir "$trash_path/data"
|
|
mkdir "$trash_path/workspace"
|
|
mkdir "$trash_path/data/$customer"
|
|
mkdir "$trash_path/workspace/$customer"
|
|
mv "$project_dir" "$trash_path/data/$customer/$project"
|
|
mv "$workspace_dir" "$trash_path/workspace/$customer/$project"
|
|
|
|
removeProjectConfig "$shortname"
|
|
|
|
postScript "$project_manager_dir/bin/postscripts/commands/remove-project"
|
|
|
|
echo
|
|
echoSuccess "Project has been removed"
|
|
echo
|