summaryrefslogtreecommitdiff
blob: dfee0e8c0c3ec7309227385923bb4409108e1ae0 (plain)
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
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
	need net
}

checkconfig() {
	if [ ! -e "${GIMPS_DIR}" ]; then
		einfo "Creating ${GIMPS_DIR}"
		/bin/mkdir "${GIMPS_DIR}"
	fi

	/bin/chown -R ${USER}:${GROUP} ${GIMPS_DIR}

	if [ ! -e "${GIMPS_DIR}/local.txt" ]; then
		eerror "GIMPS has not been configured.  Please configure it manually before"
		eerror "starting this initscript."
		return 1
	fi
}

start() {
	checkconfig || return 1
	ebegin "Starting GIMPS"
	start-stop-daemon --quiet --start -b --exec /opt/gimps/mprime \
			--chdir ${GIMPS_DIR} --user ${USER}:${GROUP} \
			-- -w${GIMPS_DIR} ${GIMPS_OPTIONS}
	eend $?
}

stop() {
	ebegin "Stopping GIMPS"
	start-stop-daemon --quiet --stop --exec /opt/gimps/mprime
	eend $?
}