splitted vhost, added gitbarerepo creation
This commit is contained in:
@@ -7,7 +7,7 @@ _cwd="$(pwd)"
|
||||
|
||||
while [ "$_bare_name" = "" ]
|
||||
do
|
||||
read -p "enter the bare repos folder name ? " _host_name
|
||||
read -p "enter the bare repos folder name ? " _bare_name
|
||||
if [ "$_bare_name" != "" ]; then
|
||||
read -p "is bare folder name $_bare_name correcte [y|n] " validated
|
||||
if [ "$validated" = "y" ]; then
|
||||
@@ -18,11 +18,11 @@ if [ "$_bare_name" != "" ]; then
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
while [ "$_prod_folder_path" = "" ]
|
||||
do
|
||||
read -p "enter the prod folder path folder name ? " _host_name
|
||||
if [ "$_bare_name" != "" ]; then
|
||||
read -p "enter the prod folder path (must be a public_html parent's) ? " _prod_folder_path
|
||||
if [ "$_prod_folder_path" != "" ]; then
|
||||
# TODO check if path exists
|
||||
read -p "is prod folder path $_prod_folder_path correcte [y|n] " validated
|
||||
if [ "$validated" = "y" ]; then
|
||||
break
|
||||
@@ -32,14 +32,26 @@ if [ "$_bare_name" != "" ]; then
|
||||
fi
|
||||
done
|
||||
|
||||
# ask for simple php conf or drupal conf
|
||||
while [ "$_drupal" != "yes" ] && [ "$_drupal" != "no" ]
|
||||
do
|
||||
echo -n "Is your site is a drupal one? [yes|no] "
|
||||
read _drupal
|
||||
done
|
||||
|
||||
# setup bare repositorie to push to
|
||||
|
||||
mkdir ~/git-repositories
|
||||
mkdir ~/git-repositories/"$_bare_name".git
|
||||
cd ~/git-repositories/"$_bare_name".git
|
||||
git init --bare
|
||||
|
||||
# add deploy script
|
||||
if [ "$_drupal" = "yes" ]; then
|
||||
cp "$_cwd"/assets/deploy-drupal.sh "$_prod_folder_path"/deploy.sh
|
||||
else
|
||||
cp "$_cwd"/assets/deploy-simple.sh "$_prod_folder_path"/deploy.sh
|
||||
fi
|
||||
|
||||
# setup git repo on site folder
|
||||
cd "$_prod_folder_path"
|
||||
git init
|
||||
@@ -51,14 +63,14 @@ cd ~
|
||||
cp "$_cwd"/assets/git-pre-receive /home/"$USER"/git-repositories/"$_bare_name".git/hooks/pre-receive
|
||||
cp "$_cwd"/assets/git-post-receive /home/"$USER"/git-repositories/"$_bare_name".git/hooks/post-receive
|
||||
|
||||
sed -ir "s/PRODDIR=\"www\"/PRODDIR=\/srv\/www\/$_bare_name\/public_html/g" /home/"$USER"/git-repositories/"$_bare_name".git/hooks/pre-receive
|
||||
sed -ir "s/PRODDIR=\"www\"/PRODDIR=\/srv\/www\/$_bare_name\/public_html/g" /home/"$USER"/git-repositories/"$_bare_name".git/hooks/post-receive
|
||||
sed -ir "s/PRODDIR=\"www\"/PRODDIR=$_prod_folder_path/g" /home/"$USER"/git-repositories/"$_bare_name".git/hooks/pre-receive
|
||||
sed -ir "s/PRODDIR=\"www\"/PRODDIR=$_prod_folder_path/g" /home/"$USER"/git-repositories/"$_bare_name".git/hooks/post-receive
|
||||
|
||||
cd /home/"$USER"/git-repositories/"$_bare_name".git/hooks/
|
||||
chmod +x post-receive pre-receive
|
||||
|
||||
# done
|
||||
echo "git repos for $_bare_name install succeed"
|
||||
echo "your site stay now to /home/$USER/www/$_bare_name"
|
||||
echo "your site stay now to $_prod_folder_path"
|
||||
echo "you can push updates on prod branch through $USER@IP.IP.IP.IP:git-repositories/$_bare_name.git"
|
||||
echo "* * *"
|
||||
|
||||
Reference in New Issue
Block a user