Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit d0cd01f1 authored by Christophe Chaudier's avatar Christophe Chaudier :rocket:
Browse files

feat: export in specific dir

parent 55ddad2b
No related branches found
No related tags found
1 merge request!8Resolve "export in specific directory"
......@@ -71,20 +71,27 @@ _load_config() {
echo "Use : mygb.sh init"
_fail "File ${config_file} doesn't exist"
fi
backup_dir=${backup_dir:-/tmp/mygb}
mkdir -p "${backup_dir}"
}
_create_config() {
if [[ ! -e ${config_file} ]]; then
echo "There is no file!"
echo "What is the GitLab URL :"
echo "What is the GitLab URL ? "
read -r gitlab_url
echo "What is the GitLab API token :"
echo "What is the GitLab API token ? "
read -rs gitlab_api_token
echo "What is the backup directory ? "
read -r backup_dir
echo "gitlab_url=\"${gitlab_url}\"" >${config_file}
echo "gitlab_api_token=\"${gitlab_api_token}\"" >>${config_file}
echo "backup_dir=\"${backup_dir}\"" >>${config_file}
echo "The file ${config_file} was created with this content."
echo "Please add the line below on your .gitignore"
......@@ -133,7 +140,7 @@ _wait_export_finished() {
}
_download_project_export() {
export_filename="$(date +"%Y%m%d_%H%M")_project_${project/\//-}_export.tar.gz"
export_filename="${backup_dir}/$(date +"%Y%m%d_%H%M")_project_${project/\//-}_export.tar.gz"
_api GET "projects/${project_url_encoded}/export/download" "-o ${export_filename}"
echo "The project was exported :"
ls -l "${export_filename}"
......@@ -141,7 +148,7 @@ _download_project_export() {
_export_project() {
if [[ -n ${project} ]]; then
echo -e "\nExporting project : [${project}]..."
echo -e "\nExporting project : [${project}] in ${backup_dir} ..."
_schedule_project_export
_wait_export_finished
_download_project_export
......@@ -168,7 +175,7 @@ _wait_group_finished() {
}
_download_group_export() {
export_filename="$(date +"%Y%m%d_%H%M")_group_${group/\//-}_export.tar.gz"
export_filename="${backup_dir}/$(date +"%Y%m%d_%H%M")_group_${group/\//-}_export.tar.gz"
_api GET "group/${group_url_encoded}/export/download" "-o ${export_filename}"
echo "The group was exported :"
ls -l "${export_filename}"
......@@ -176,7 +183,7 @@ _download_group_export() {
_export_group() {
if [[ -n ${group} ]]; then
echo -e "\nExporting group : [${group}]..."
echo -e "\nExporting group : [${group}] in ${backup_dir} ..."
_schedule_group_export
_wait_group_finished
_download_group_export
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment