This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  5fa109f040107760fa779eba5c9147cba4487c12 (commit)
      from  22f23340e5895949a8f08139387cd8569bb5ac4e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=5fa109f040107760fa779eba5c9147cba4487c12

commit 5fa109f040107760fa779eba5c9147cba4487c12
Author: Franck Villaume <[email protected]>
Date:   Thu Jul 13 14:00:44 2017 +0000

    more idempotent script & enable ftp only if project is using it

diff --git a/src/cronjobs/ftp/ftp_create_group_access.php 
b/src/cronjobs/ftp/ftp_create_group_access.php
index 51a4c92..8d32f72 100755
--- a/src/cronjobs/ftp/ftp_create_group_access.php
+++ b/src/cronjobs/ftp/ftp_create_group_access.php
@@ -31,10 +31,10 @@ $err = '';
 $ftp_dir = forge_get_config('ftp_upload_dir');
 $home_dir = forge_get_config('homedir_prefix');
 
-$res_db = db_query_params('SELECT user_id FROM users WHERE unix_status=$1', 
array ('A'));
+$res_db = db_query_params('SELECT user_id FROM users WHERE unix_status = $1', 
array('A'));
 if ($res_db) {
-       while($e = db_fetch_array($res_db)) {
-               $users[] = user_get_object ($e['user_id']) ;
+       while ($e = db_fetch_array($res_db)) {
+               $users[] = user_get_object($e['user_id']);
        }
 }
 
@@ -54,11 +54,13 @@ foreach ($users as $u) {
                                        $cmd = '/bin/mkdir '.$dir;
                                        $res = execute($cmd);
                                }
-                               $cmd = '/bin/mkdir '.$dir.'/'.$g;
-                               $res = execute($cmd);
-                               $cmd = '/bin/mount --bind '.$ftp_dir.'/'.$g.' 
'.$dir.'/'.$g;
-                               $res = execute($cmd);
-                               //echo 'allow '.$u->getUnixName().' to access 
at '.$dir.'/'.$g."\n";
+                               if ($project->usesFTP()) {
+                                       $cmd = '/bin/mkdir '.$dir.'/'.$g;
+                                       $res = execute($cmd);
+                                       $cmd = '/bin/mount --bind 
'.$ftp_dir.'/'.$g.' '.$dir.'/'.$g;
+                                       $res = execute($cmd);
+                                       //echo 'allow '.$u->getUnixName().' to 
access at '.$dir.'/'.$g."\n";
+                               }
                        }
                }
        }
diff --git a/src/post-install.d/ftp/ftp.sh b/src/post-install.d/ftp/ftp.sh
index 9abd625..1d6a133 100755
--- a/src/post-install.d/ftp/ftp.sh
+++ b/src/post-install.d/ftp/ftp.sh
@@ -25,23 +25,26 @@ set -e
 configure_ftpd() {
     sed -i -e 's/^anonymous_enable=.*$/anonymous_enable=NO/' 
/etc/vsftpd/vsftpd.conf
     sed -i -e 's/^#ftpd_banner=.*$/ftpd_banner=Welcome to FusionForge FTP 
server/' /etc/vsftpd/vsftpd.conf
-    sed -i -e 's/^chroot_local_user=.*$/chroot_local_user=YES/' 
/etc/vsftpd/vsftpd.conf
+    sed -i -e 's/^#chroot_local_user=.*$/chroot_local_user=YES/' 
/etc/vsftpd/vsftpd.conf
     if [[ $is_docker ]]; then
-        echo 'background=NO' >> /etc/vsftpd/vsftpd.conf
+        if [[ -z `grep 'background=NO' /etc/vsftpd/vsftpd.conf` ]];then
+            echo 'background=NO' >> /etc/vsftpd/vsftpd.conf
+        fi
     fi
 }
 
 remove_ftpd() {
     sed -i -e 's/^anonymous_enable=NO.*$/anonymous_enable=YES/' 
/etc/vsftpd/vsftpd.conf
     sed -i -e 's/^ftpd_banner=Welcome.*$/#ftpd_banner=Welcome to blah FTP 
service./' /etc/vsftpd/vsftpd.conf
-    sed -i -e 's/^chroot_local_user=YES.*$/chroot_local_user=NO/' 
/etc/vsftpd/vsftpd.conf
+    sed -i -e 's/^chroot_local_user=YES.*$/#chroot_local_user=NO/' 
/etc/vsftpd/vsftpd.conf
     if [[ $is_docker ]]; then
-        sed -i '$d' /etc/vsftpd/vsftpd.conf
+        if [[ ! -z `grep 'background=NO' /etc/vsftpd/vsftpd.conf` ]];then
+            sed -i '$d' /etc/vsftpd/vsftpd.conf
+        fi
     fi
 }
 
-restart_ftp_service()
-{
+restart_ftp_service() {
     if [[ $is_docker ]]; then
         killall vsftpd >/dev/null 2>&1
     else

-----------------------------------------------------------------------

Summary of changes:
 src/cronjobs/ftp/ftp_create_group_access.php | 18 ++++++++++--------
 src/post-install.d/ftp/ftp.sh                | 15 +++++++++------
 2 files changed, 19 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to