summaryrefslogtreecommitdiffstats
path: root/satellit_installer/includes/90-set_directory_permissions.inc
blob: 72f3f058dcfa9d3dbde1d1f7e2e440e3e2ad94bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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 root:root "$WWWDIR"

	mkdir -p "$WWWDIR/boot/download"
	chown -R taskmanager:www-data "$WWWDIR/boot"
	chmod 755 "$WWWDIR/boot" "$WWWDIR/boot/download"

	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"
}