creation_repo fini vec submodule
This commit is contained in:
parent
6b51421fe1
commit
7b9c5b97e8
@ -1,37 +1,43 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
. driglibash-base
|
. driglibash-base
|
||||||
|
|
||||||
Help()
|
Help()
|
||||||
{
|
{
|
||||||
echo "
|
echo "
|
||||||
NAME
|
NAME
|
||||||
creation_repo.sh
|
creation_repo.sh
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
creation_repo.sh [SSH LINK to en empty remote git repository]
|
creation_repo.sh [-h] [-s]
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
This script is in writing.
|
This script creates a "remote" directory in the current directory, then creates a remote/performance_testing git repository.
|
||||||
It creates a git repository in the current directory, linked to a remote passed as argument. Everything is up-to-date between the remote and the local versions. The data stored is generated randomly in binary.
|
This git repository is filled with randomly generated binary files described in the readme.md.
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-h prints the help. "
|
-h prints the help.
|
||||||
|
-s creates a submodule remote/submodule_for_performance_testing and includes it in remote/performance_testing. "
|
||||||
}
|
}
|
||||||
if [[ "${BASH_SOURCE[0]}" = "${0}" ]]; then
|
|
||||||
while getopts ":h" option; do
|
|
||||||
case $option in
|
|
||||||
h) # display Help
|
|
||||||
Help
|
|
||||||
exit;;
|
|
||||||
\?) # Invalid option
|
|
||||||
echo "Error: Invalid option"
|
|
||||||
exit;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
create_random_file(){
|
create_random_file(){
|
||||||
run dd if=/dev/urandom of=$1 bs=$2 count=1 &> /dev/null
|
run dd if=/dev/urandom of=$1 bs=$2 count=1 &> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
REPO_NAME=performance_testing
|
REPO_NAME=performance_testing
|
||||||
REPO_PATH=./remote
|
REPO_PATH=./remote
|
||||||
WITH_SUBMODULE="true"
|
WITH_SUBMODULE="false" #"true"
|
||||||
|
SUB_NAME="submodule_for_performance_testing"
|
||||||
|
while getopts ":h:s" option; do
|
||||||
|
|
||||||
|
case $option in
|
||||||
|
h)
|
||||||
|
Help
|
||||||
|
exit;;
|
||||||
|
s)
|
||||||
|
WITH_SUBMODULE="true";;
|
||||||
|
\?)
|
||||||
|
echo "Error: Invalid option"
|
||||||
|
exit;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
if [ ! -d $REPO_PATH ]; then
|
if [ ! -d $REPO_PATH ]; then
|
||||||
mkdir $REPO_PATH
|
mkdir $REPO_PATH
|
||||||
@ -65,8 +71,8 @@ if [ ! -d $REPO_NAME ]; then
|
|||||||
rm sample4
|
rm sample4
|
||||||
git add sample4
|
git add sample4
|
||||||
git commit -m"sample4 deleted"
|
git commit -m"sample4 deleted"
|
||||||
if [ "$WITH_SUBMODULE" = "true" ]; then
|
cd ..
|
||||||
SUB_NAME="submodule_for_performance_testing"
|
if [ "$WITH_SUBMODULE" = "true" ]; then
|
||||||
if [ ! -d $SUB_NAME ]; then
|
if [ ! -d $SUB_NAME ]; then
|
||||||
mkdir $SUB_NAME
|
mkdir $SUB_NAME
|
||||||
cd $SUB_NAME
|
cd $SUB_NAME
|
||||||
@ -75,12 +81,19 @@ if [ ! -d $REPO_NAME ]; then
|
|||||||
create_random_file 'sub_sample0' '1M'
|
create_random_file 'sub_sample0' '1M'
|
||||||
git add .
|
git add .
|
||||||
git commit -m"first 1M sample created"
|
git commit -m"first 1M sample created"
|
||||||
cd ../$REPO_NAME
|
cd ..
|
||||||
fi
|
fi
|
||||||
|
cd $REPO_NAME
|
||||||
git submodule add ../submodule_for_performance_testing
|
git submodule add ../submodule_for_performance_testing
|
||||||
git commit -am "adding $SUB_NAME module"
|
git commit -am "adding $SUB_NAME module"
|
||||||
|
else
|
||||||
|
if [ -d $SUB_NAME ]; then
|
||||||
|
cd $SUB_NAME
|
||||||
|
git rm submodule_for_performance_testing
|
||||||
|
cd ..
|
||||||
|
rm -rf $SUB_NAME
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
cd ../..
|
cd ..
|
||||||
pwd
|
|
Loading…
Reference in New Issue
Block a user