projects/aports·blob master · refs

48 lines · 925 B

1#!/sbin/openrc-run
2command="/usr/bin/noip2"
3command_user="noip:noip"
4procname="noip2"
5
6description="no-ip.com Dynamic DNS Update Client"
7description_checkconfig="Verify existenace of a configuration file"
8description_configure="Generate a configuration file"
9
10extra_commands="checkconfig configure"
11
12depend() {
13 use logger dns
14 need net
15}
16
17checkconfig() {
18 if [ ! -f "${CFGFILE}" ] ; then
19 eerror "Please create ${CFGFILE} by using the command configure"
20 return 1
21 fi
22 return 0
23}
24
25configure() {
26 if [ -r "${CFGFILE}" ] ; then
27 read -p "Configuration file already exist, overwrite it? [y/N]: " a
28 if [[ "$a" != "y" ]] && [[ "$a" != "Y" ]] ; then
29 eerror "Aborting"
30 return 1
31 fi
32 fi
33
34 su -mp -s /bin/sh noip -c "$command -C"
35}
36
37start_pre() {
38 if [ "${RC_CMD}" != "restart" ] ; then
39 checkconfig || return $?
40 fi
41}
42
43stop_pre() {
44 if [ "${RC_CMD}" = "restart" ] ; then
45 checkconfig || return $?
46 fi
47}
48