Commits

Alan Wynn  committed 484d007

chmod the files and folders before sync, and preserve the permissions and executability

  • Participants
  • Parent commits b34d8f3

Comments (0)

Files changed (1)

 fi
 
 
+# allow execution of the deployment files
+chmod +x ./deploy/.deploy_before
+chmod +x ./deploy/.deploy_success
+
+
 # If the deploy_before file exists, then run it
 if [ -f "deploy/.deploy_before" ]
 then
 fi
 
 
+CHMODTRIGGERCHECK="true"
+
+# If we are doing a fix persmissions then do that here and inform the user
+# This will chmod folders and files
+# folder    = 755 (rwxr-xr-x)
+# file      = 644 (rw-r--r--)
+if [ "$CHMODTRIGGER" = "true" ]
+then
+    # Fix file permissions
+    echo '. Fixing file permissions'
+    ssh $SSH "find . -type d -exec chmod 755 {} \; && find . -type f -exec chmod 644 {} \;"
+else
+    echo '. Skipping file permissions fix'
+fi
+
 
 echo '. Deploying to' $SSH:$DEPLOYPATH
 
 
 	echo ' - Using deploy_ignore file.'
 
-	rsync -arvz \
+	rsync -arvzp --executability \
 	./ \
 	$SSH:$DEPLOYPATH \
 	--exclude-from $IGNOREFILE \
 
 	echo ' - Not using deploy_ignore file.'
 
-	rsync -arvz \
+	rsync -arvzp --executability \
 	./ \
 	$SSH:$DEPLOYPATH \
 
 fi
 
-CHMODTRIGGERCHECK="true"
-
-# If we are doing a fix persmissions then do that here and inform the user
-# This will chmod folders and files
-# folder    = 755 (rwxr-xr-x)
-# file      = 644 (rw-r--r--)
-if [ "$CHMODTRIGGER" = "true" ]
-then
-	# Fix file permissions
-	echo '. Fixing file permissions'
-	ssh $SSH "find $DEPLOYPATH -type d -exec chmod 755 {} \; && find $DEPLOYPATH -type f -exec chmod 644 {} \;"
-else
-	echo '. Skipping file permissions fix'
-fi
-
-
 # If we have a deploy_success file then:
 #    - SSH into the server
 #    - cd to the deploy folder
-#    - chmod the file to allow execution
 #    - execute the script
 if [ -f "deploy/.deploy_success" ]
 then
 	echo '. Launching deploy_success file on remote server'
-	ssh $SSH "cd $DEPLOYPATH && chmod +x ./deploy/.deploy_success && ./deploy/.deploy_success $BRANCH"
+	ssh $SSH "cd $DEPLOYPATH && ./deploy/.deploy_success $BRANCH"
 fi
 
 echo '. Deployment finished'