blob: 39459dcb7c0872c735e92fcb23cdff1eacf24bfe (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
#!/bin/sh
#
# messagebus-config, Copyright 2009 Yaakov Selkowitz
#
# This file is part of the Cygwin port of dbus.
# ======================================================================
# Initialization
# ======================================================================
PROGNAME=$(basename $0)
_tdir=$(dirname $0)
PROGDIR=$(cd $_tdir && pwd)
CSIH_SCRIPT=/usr/share/csih/cygwin-service-installation-helper.sh
# Subdirectory where the new package is being installed
PREFIX=@prefix@
# Directory where the config files are stored
SYSCONFDIR=@sysconfdir@/dbus-1
DEVDIR=/dev
LOGDIR=/var/log
RUNDIR=$(dirname @DBUS_SYSTEM_PID_FILE@)
SOCKDIR=$(dirname @DBUS_SYSTEM_SOCKET@)
source ${CSIH_SCRIPT}
# ======================================================================
# Routine: install_service
# Install messagebus as a service
# ======================================================================
install_service() {
if csih_is_nt
then
# Check if messagebus is installed and remove on user request.
if cygrunsrv -Q messagebus > /dev/null 2>&1
then
csih_warning "The messagebus service is already installed."
echo
if csih_request "Do you want to reinstall it with different args?"
then
cygrunsrv -E messagebus
cygrunsrv -R messagebus
fi
fi
# Install messagebus service if it is not already installed
if ! cygrunsrv -Q messagebus > /dev/null 2>&1
then
echo
csih_warning "The following function requires administrator privileges!"
if csih_request "Do you want to install messagebus as service?"
then
if cygrunsrv -I messagebus -d "CYGWIN D-Bus system service" -p @EXPANDED_BINDIR@/dbus-daemon -a "--nofork --system"
then
echo
csih_inform "The messagebus service has been installed under the LocalSystem"
csih_inform "account (also known as SYSTEM). To start the service now, call"
csih_inform "\`net start messagebus' or \`cygrunsrv -S messagebus'. Otherwise, it"
csih_inform "will start automatically after the next reboot."
echo
csih_inform "Check ${SYSCONFDIR}/system.conf first, if it suits your needs."
fi
fi # user allowed us to install messagebus
fi # messagebus already installed
fi # csih_is_nt
} # --- End of install_service --- #
# ======================================================================
# Main Entry Point
# ======================================================================
# Check how the script has been started. If
# (1) it has been started by giving the full path and
# that path is /etc/postinstall, OR
# (2) Otherwise, if the environment variable
# CONFIG_AUTO_ANSWER_NO is set
# then set auto_answer to "no". This allows automatic
# creation of the config files in /etc w/o overwriting
# them if they already exist. In both cases, color
# escape sequences are suppressed, so as to prevent
# cluttering setup's logfiles.
if [ "$PROGDIR" = "/etc/postinstall" ]
then
csih_auto_answer="no"
csih_disable_color
fi
if [ -n "${CONFIG_AUTO_ANSWER_NO}" ]
then
csih_auto_answer="no"
csih_disable_color
fi
# ======================================================================
# Parse options
# ======================================================================
while :
do
case $# in
0)
break
;;
esac
option=$1
shift
case "$option" in
-d | --debug )
set -x
csih_trace_on
;;
-y | --yes )
csih_auto_answer=yes
;;
-n | --no )
csih_auto_answer=no
;;
*)
echo "usage: ${PROGNAME} [OPTION]..."
echo
echo "This script creates a basic messagebus configuration."
echo
echo "Options:"
echo " --debug -d Enable shell's debug output."
echo " --yes -y Answer all questions with \"yes\" automatically."
echo " --no -n Answer all questions with \"no\" automatically."
echo
exit 1
;;
esac
done
# ======================================================================
# Action!
# ======================================================================
# Check for ${SYSCONFDIR} directory
csih_make_dir "${SYSCONFDIR}" "Cannot create global configuration files."
chmod 775 "${SYSCONFDIR}"
setfacl -m u:system:rwx "${SYSCONFDIR}"
# Check for ${DEVDIR} directory
csih_make_dir "${DEVDIR}" "Syslogging using messagebus will not work."
chmod 775 "${DEVDIR}"
setfacl -m u:system:rwx "${DEVDIR}"
# Check for ${LOGDIR} directory
csih_make_dir "${LOGDIR}" "Syslogging using messagebus will not work."
chmod 775 "${LOGDIR}"
setfacl -m u:system:rwx "${LOGDIR}"
# Check for ${RUNDIR} directory
csih_make_dir "${RUNDIR}" "PID files of running processes will not be created."
chmod 775 "${RUNDIR}"
setfacl -m u:system:rwx "${RUNDIR}"
# Check for ${SOCKDIR} directory
csih_make_dir "${SOCKDIR}" "SOCKET files of running processes will not be created."
chmod 775 "${SOCKDIR}"
setfacl -m u:system:rwx "${SOCKDIR}"
# maybe: csih_auto_answer=no will skip,
# interactive user will get a chance to override
install_service
echo
echo "Configuration finished. Have fun!"
|