summaryrefslogtreecommitdiff
blob: a8966dc14a4c5020fc34ca1be41e86cd6a23a892 (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
#!/sbin/openrc-run
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

command=/opt/teamviewer@TVV@/tv_bin/teamviewerd
command_args=-d
description="daemon for TeamViewer"
pidfile=/var/run/teamviewerd.pid

extra_stopped_commands="passwd"

passwd() {
	if [ -z "${PASSWD}" ]; then
		eerror "No password specified."
		exit 1
	fi

	ebegin "Attempting to change password."
	/opt/teamviewer@TVV@/tv_bin/teamviewerd --passwd "${PASSWD}"
	retr=$?
	case $retr in
		0)	einfo "Password successfully set." ;;
		11|12)	eerror "Password must be between 8 and 12 characters.";;
		13)	eerror "Invalid characters detected.";;
		14)	eerror "Password invalid. Validation failed.";;
		*)	eerror "Unknown error code";;
	esac
	eend $retr
	exit $retr
}