bind 9.10.3-P3
[git/cygwin-packages/bind.git] / named-config
CommitLineData
3eba9dbc
YS
1#!/bin/sh
2#
3# named-config, Copyright 2011 Yaakov Selkowitz
4#
5# This file is part of the Cygwin port of bind.
6
7# ======================================================================
8# Initialization
9# ======================================================================
10PROGNAME=$(basename $0)
11_tdir=$(dirname $0)
12PROGDIR=$(cd $_tdir && pwd)
13
14CSIH_SCRIPT=/usr/share/csih/cygwin-service-installation-helper.sh
15
16# Subdirectory where the new package is being installed
17PREFIX=/usr
18RUNDIR=/var/run/named
19
20source ${CSIH_SCRIPT}
21
22# ======================================================================
23# Routine: install_service
24# Install named as a service
25# ======================================================================
26install_service() {
27
28 if csih_is_nt
29 then
30
31 # Check if named is installed and remove on user request.
32 if cygrunsrv -Q named > /dev/null 2>&1
33 then
34 csih_warning "The named service is already installed."
35 echo
36 if csih_request "Do you want to reinstall it with different args?"
37 then
38 cygrunsrv -E named
39 cygrunsrv -R named
40 fi
41 fi
42
43 # Install named service if it is not already installed
44 if ! cygrunsrv -Q named > /dev/null 2>&1
45 then
46 echo
47 csih_warning "The following function requires administrator privileges!"
48 if csih_request "Do you want to install named as service?"
49 then
50 if cygrunsrv -I named -d "CYGWIN BIND named" -p /usr/sbin/named -a "-f"
51 then
52 echo
53 csih_inform "The named service has been installed under the LocalSystem"
54 csih_inform "account (also known as SYSTEM). To start the service now, call"
55 csih_inform "\`net start named' or \`cygrunsrv -S named'. Otherwise, it"
56 csih_inform "will start automatically after the next reboot."
57 echo
58 csih_inform "Check ${SYSCONFDIR}/system.conf first, if it suits your needs."
59 fi
60 fi # user allowed us to install named
61 fi # named already installed
62 fi # csih_is_nt
63} # --- End of install_service --- #
64
65
66# ======================================================================
67# Main Entry Point
68# ======================================================================
69
70
71# Check how the script has been started. If
72# (1) it has been started by giving the full path and
73# that path is /etc/postinstall, OR
74# (2) Otherwise, if the environment variable
75# CONFIG_AUTO_ANSWER_NO is set
76# then set auto_answer to "no". This allows automatic
77# creation of the config files in /etc w/o overwriting
78# them if they already exist. In both cases, color
79# escape sequences are suppressed, so as to prevent
80# cluttering setup's logfiles.
81if [ "$PROGDIR" = "/etc/postinstall" ]
82then
83 csih_auto_answer="no"
84 csih_disable_color
85fi
86if [ -n "${CONFIG_AUTO_ANSWER_NO}" ]
87then
88 csih_auto_answer="no"
89 csih_disable_color
90fi
91
92
93# ======================================================================
94# Parse options
95# ======================================================================
96while :
97do
98 case $# in
99 0)
100 break
101 ;;
102 esac
103
104 option=$1
105 shift
106
107 case "$option" in
108 -d | --debug )
109 set -x
110 csih_trace_on
111 ;;
112
113 -y | --yes )
114 csih_auto_answer=yes
115 ;;
116
117 -n | --no )
118 csih_auto_answer=no
119 ;;
120
121 *)
122 echo "usage: ${PROGNAME} [OPTION]..."
123 echo
124 echo "This script creates a basic named configuration."
125 echo
126 echo "Options:"
127 echo " --debug -d Enable shell's debug output."
128 echo " --yes -y Answer all questions with \"yes\" automatically."
129 echo " --no -n Answer all questions with \"no\" automatically."
130 echo
131 exit 1
132 ;;
133
134 esac
135done
136
137# ======================================================================
138# Action!
139# ======================================================================
140
141# Check for ${RUNDIR} directory
142csih_make_dir "${RUNDIR}" "PID files of running processes will not be created."
143chmod 775 "${RUNDIR}"
144setfacl -m u:system:rwx "${RUNDIR}"
145
146# maybe: csih_auto_answer=no will skip,
147# interactive user will get a chance to override
148install_service
149
150
151echo
152echo "Configuration finished. Have fun!"
This page took 0.030435 seconds and 5 git commands to generate.