Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 116220 | Differences between
and this patch

Collapse All | Expand All

(-)/tmp/openafs-client-old (-22 / +35 lines)
Lines 10-31 Link Here
10
10
11
choose_afsdoptions() {
11
choose_afsdoptions() {
12
	CACHESIZE=$(cut -d ':' -f 3 /etc/openafs/cacheinfo)
12
	CACHESIZE=$(cut -d ':' -f 3 /etc/openafs/cacheinfo)
13
	if [ -z "$OPTIONS" -o "$OPTIONS" = "AUTOMATIC" ]; then
13
	if [[ -z "$OPTIONS" || "$OPTIONS" = "AUTOMATIC" ]]; then
14
		if [ $CACHESIZE -lt 131072 ]; then
14
		if [[ $CACHESIZE -lt 131072 ]]; then
15
			OPTIONS=$SMALL
15
			OPTIONS=$SMALL
16
		elif [ $CACHESIZE -lt 524288 ]; then
16
		elif [[ $CACHESIZE -lt 524288 ]]; then
17
			OPTIONS=$MEDIUM
17
			OPTIONS=$MEDIUM
18
		elif [ $CACHESIZE -lt 1048576 ]; then
18
		elif [[ $CACHESIZE -lt 1048576 ]]; then
19
			OPTIONS=$LARGE
19
			OPTIONS=$LARGE
20
		elif [ $CACHESIZE -lt 2097152 ]; then
20
		elif [[ $CACHESIZE -lt 2097152 ]]; then
21
			OPTIONS=$XLARGE
21
			OPTIONS=$XLARGE
22
		else
22
		else
23
			OPTIONS=$XXLARGE
23
			OPTIONS=$XXLARGE
24
		fi
24
		fi
25
	fi
25
	fi
26
	AFSD_OPTIONS="$OPTIONS $VERBOSE"
26
	AFSD_OPTIONS="$OPTIONS $VERBOSE"
27
	[ "$ENABLE_AFSDB" = "yes" ] && AFSD_OPTIONS="$AFSD_OPTIONS -afsdb"
27
	[[ "$ENABLE_AFSDB" = "yes" ]] && AFSD_OPTIONS="$AFSD_OPTIONS -afsdb"
28
	[ "$ENABLE_DYNROOT" = "yes" ] && AFSD_OPTIONS="$AFSD_OPTIONS -dynroot"
28
	[[ "$ENABLE_DYNROOT" = "yes" ]] && AFSD_OPTIONS="$AFSD_OPTIONS -dynroot"
29
}
29
}
30
30
31
start() {
31
start() {
Lines 38-71 Link Here
38
	if pgrep -u 0 afsd &> /dev/null; then
38
	if pgrep -u 0 afsd &> /dev/null; then
39
		eerror "afsd already running, not attempting to restart"
39
		eerror "afsd already running, not attempting to restart"
40
		eend 1
40
		eend 1
41
	elif [ ! -f /lib/modules/$(uname -r)/kernel/fs/openafs/openafs.ko ]; then
41
	elif [[ -d /proc/fs/openafs ]]; then
42
		eerror "OpenAFS kernel module not found, please re-emerge openafs-kernel"
42
		ewarn "OpenAFS already active, trying to unload module"
43
		eend 1
44
	else
45
		ebegin "Loading OpenAFS kernel module"
46
		if ! modprobe -r openafs; then
43
		if ! modprobe -r openafs; then
47
			eerror "OpenAFS kernel module was loaded, unloading failed"
44
			eerror "OpenAFS kernel module was loaded, unloading failed"
48
			eend 1
45
			eend 1
49
		elif ! modprobe openafs; then
50
			eerror "Failed cleanly (re)loading the afs kernel module"
51
			eend 1
52
		else
46
		else
53
			eend 0
47
			cleanstart
54
			ebegin "Starting OpenAFS daemon"
55
			choose_afsdoptions
56
			/usr/sbin/afsd ${AFSD_OPTIONS} &> /dev/null
57
			failed=$?
48
			failed=$?
58
			eend $failed
49
			eend $failed
59
		fi
50
		fi
51
	else
52
		cleanstart
53
		failed=$?
54
		eend $failed
60
	fi
55
	fi
61
		
56
		
62
	eoutdent
57
	eoutdent
63
58
64
	if [ $failed != 0 ]; then
59
	if [[ $failed != 0 ]]; then
65
		return 1
60
		return 1
66
	fi
61
	fi
67
}
62
}
68
63
64
cleanstart()
65
{
66
	ebegin "Loading OpenAFS kernel module"
67
	if ! modprobe openafs; then
68
		eerror "Failed loading the afs kernel module"
69
		eend 1
70
		return 1
71
	else
72
		eend 0
73
		ebegin "Starting OpenAFS daemon"
74
		choose_afsdoptions
75
		/usr/sbin/afsd ${AFSD_OPTIONS} &> /dev/null
76
		failed=$?
77
		eend $failed
78
		return $failed
79
	fi
80
}
81
69
stop() {
82
stop() {
70
	ebegin "Stopping OpenAFS client"
83
	ebegin "Stopping OpenAFS client"
71
	failed=1
84
	failed=1
Lines 83-89 Link Here
83
		failed=$?
96
		failed=$?
84
		eend $failed
97
		eend $failed
85
		
98
		
86
		if [ $failed = 0 ]; then
99
		if [[ $failed = 0 ]]; then
87
			ebegin "Unloading OpenAFS module"
100
			ebegin "Unloading OpenAFS module"
88
			modprobe -r openafs
101
			modprobe -r openafs
89
			failed=$?
102
			failed=$?
Lines 93-99 Link Here
93
106
94
	eoutdent
107
	eoutdent
95
108
96
	if [ $failed != 0 ]; then
109
	if [[ $failed != 0 ]]; then
97
		return 1
110
		return 1
98
	fi
111
	fi
99
}
112
}

Return to bug 116220