summaryrefslogblamecommitdiffstats
path: root/satellit_installer/includes/90-set_directory_permissions.inc
blob: f40322b12fe83094a1de70ee7c45ff4ed7c4db75 (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"

	# ldadp dirs
	mkdir -p "$LDADPDIR" "$LDADPDIR/configs" "$LDADPDIR/pid" "/var/log/ldadp"
	chmod 755 "$LDADPDIR"
	chown root:root "$LDADPDIR"				# Prob. unnecessary, but to be sure.
	chmod 750 "$LDADPDIR/configs"
	chown -R taskmanager:ldadp "$LDADPDIR/configs"
	chmod 755 "$LDADPDIR/pid" 2>/dev/null			# if already there
	chown -R ldadp:root "$LDADPDIR/pid"
	chmod 750 "/var/log/ldadp"
	chown -R ldadp:adm "/var/log/ldadp"
	# Make sure we spare the binary
	chown root:root "$LDADPDIR/ldadp"			# ... not the binary.

	mkdir -p -m 755 "$OPENSLXDIR"/proxy 2>/dev/null
	chmod 755 "$OPENSLXDIR"/proxy 2>/dev/null		# if already there
	chown www-data "$OPENSLXDIR"/proxy 2>/dev/null

	mkdir -p -m 0755 "$SLXADMINCACHE"
	chmod 0755 "$SLXADMINCACHE"				# if already there
	chown -R www-data:www-data "$SLXADMINCACHE"
}