summaryrefslogblamecommitdiffstats
path: root/satellit_installer/includes/90-set_directory_permissions.inc
blob: 1fb2db4b0d8e2aa730b5733495f2a6c67d2d4c1b (plain) (tree)
1
2
3
4
5
6
7
8
9
10


                                                                           

                                                                            

                             
                                                 

                                                         
                                                                                  


                                                                 
                                                                                          


                                                                      
                                                                                  
                                                        
        
                                                                                 
                                                    
                                                                                  
                                                  
                                                 
 


                                                                          
 


                                                                
 
                                        
 

                                                                                   
        
                                               
                                                                                  





                                                                                                     

                                                       
                                                                                  
                                                      
 
                                                   
                                                                                  
                                       
 
                                                    
                                                                                  
                                            
 


                                                                                  
 
# Here is the place to (recursively) set directory and/or file permissions.
# This is some kind of a stop gap to be sure permissions are set rightly,
# as sometimes eg. archives wield not the desired permissions.
# Also, place for some last ditch copying of files, es this is executed near
# the end of script execution.

set_directory_permissions() {
	mkdir -p -m 755 "$OPENSLXDIR" 2>/dev/null

	mkdir -p -m 755 "$OPENSLXDIR"/configs 2>/dev/null
	chmod 755 "$OPENSLXDIR"/configs 2>/dev/null		# if already there
	chown -R taskmanager:taskmanager "$OPENSLXDIR"/configs

	mkdir -p -m 755 "$OPENSLXDIR"/configs/modules 2>/dev/null
	chmod 755 "$OPENSLXDIR"/configs/modules 2>/dev/null		# if already there
	chown -R taskmanager:taskmanager "$OPENSLXDIR"/configs/modules

	mkdir -p -m 755 "$OPENSLXDIR"/ipxe 2>/dev/null
	chmod 755 "$OPENSLXDIR"/ipxe 2>/dev/null		# if already there
	chown -R taskmanager:www-data "$OPENSLXDIR"/ipxe
	
	# Keep care with $OPENSLXDIR, as $OPENSLXDIR/nfs needs other permissions.
	mkdir -p -m 755 "$OPENSLXSRVDIR" 2>/dev/null
	chmod 775 "$OPENSLXSRVDIR" 2>/dev/null			# if already there
	chown -R taskmanager:root "$OPENSLXSRVDIR"
	chown -R dmsd:images "$OPENSLXSRVDIR"/nfs

	mkdir -p -m 755 "$WWWDIR" 2>/dev/null
	chmod 755 "$WWWDIR" 2>/dev/null			# if already there
	chown -R www-data:taskmanager "$WWWDIR"

	mkdir -p "$WWWDIR/boot"
	chown -R taskmanager:www-data "$WWWDIR"/boot 2>/dev/null
	chmod 755 "$WWWDIR"/boot 2>/dev/null

	chown -R taskmanager: "$TFTPDIR"

	cp -p "$WWWDIR"/slx-admin/config.php.example "$WWWDIR"/slx-admin/config.php
	chmod 600 "$WWWDIR"/slx-admin/config.php
	
	mkdir -p -m 755 "$LDADPDIR" 2>/dev/null
	chmod 755 "$LDADPDIR" 2>/dev/null			# if already there
	chown root:root "$LDADPDIR"				# Prob. unnecessary, but to be sure. 
	chown -R taskmanager:ldadp "$LDADPDIR"/*		# Stuff beyond, but ...
	chown root:root "$LDADPDIR"/ldadp			# ... not the binary.

	mkdir -m 755 /var/log/ldadp 2>/dev/null			# For th' loggin'
	chown ldadp:root /var/log/ldadp

	mkdir -p -m 750 "$LDADPDIR"/configs 2>/dev/null
	chmod 750 "$LDADPDIR"/configs 2>/dev/null		# if already there
	chown -R taskmanager:ldadp "$LDADPDIR"/configs

	mkdir -p -m 755 "$LDADPDIR"/pid 2>/dev/null
	chmod 755 "$LDADPDIR"/pid 2>/dev/null			# if already there
	chown -R ldadp: "$LDADPDIR"/pid

	mkdir -p -m 750 "$LDADPDIR"/logs 2>/dev/null
	chmod 750 "$LDADPDIR"/logs 2>/dev/null			# if already there
	chown -R ldadp:root "$LDADPDIR"/logs

	mkdir -p -m 755 /opt/openslx/proxy 2>/dev/null
	chmod 755 /opt/openslx/proxy 2>/dev/null		# if already there
	chown www-data /opt/openslx/proxy 2>/dev/null
}