3 # messagebus-config, Copyright 2009 Yaakov Selkowitz
5 # This file is part of the Cygwin port of dbus.
7 # ======================================================================
9 # ======================================================================
10 PROGNAME=$(basename $0)
12 PROGDIR=$(cd $_tdir && pwd)
14 CSIH_SCRIPT=/usr/share/csih/cygwin-service-installation-helper.sh
16 # Subdirectory where the new package is being installed
19 # Directory where the config files are stored
20 SYSCONFDIR=@sysconfdir@/dbus-1
23 RUNDIR=$(dirname @DBUS_SYSTEM_PID_FILE@)
24 SOCKDIR=$(dirname @DBUS_SYSTEM_SOCKET@)
28 # ======================================================================
29 # Routine: install_service
30 # Install messagebus as a service
31 # ======================================================================
37 # Check if messagebus is installed and remove on user request.
38 if cygrunsrv -Q messagebus > /dev/null 2>&1
40 csih_warning "The messagebus service is already installed."
42 if csih_request "Do you want to reinstall it with different args?"
44 cygrunsrv -E messagebus
45 cygrunsrv -R messagebus
49 # Install messagebus service if it is not already installed
50 if ! cygrunsrv -Q messagebus > /dev/null 2>&1
53 csih_warning "The following function requires administrator privileges!"
54 if csih_request "Do you want to install messagebus as service?"
56 if cygrunsrv -I messagebus -d "CYGWIN D-Bus system service" -p @EXPANDED_BINDIR@/dbus-daemon -a "--nofork --system"
59 csih_inform "The messagebus service has been installed under the LocalSystem"
60 csih_inform "account (also known as SYSTEM). To start the service now, call"
61 csih_inform "\`net start messagebus' or \`cygrunsrv -S messagebus'. Otherwise, it"
62 csih_inform "will start automatically after the next reboot."
64 csih_inform "Check ${SYSCONFDIR}/system.conf first, if it suits your needs."
66 fi # user allowed us to install messagebus
67 fi # messagebus already installed
69 } # --- End of install_service --- #
72 # ======================================================================
74 # ======================================================================
77 # Check how the script has been started. If
78 # (1) it has been started by giving the full path and
79 # that path is /etc/postinstall, OR
80 # (2) Otherwise, if the environment variable
81 # CONFIG_AUTO_ANSWER_NO is set
82 # then set auto_answer to "no". This allows automatic
83 # creation of the config files in /etc w/o overwriting
84 # them if they already exist. In both cases, color
85 # escape sequences are suppressed, so as to prevent
86 # cluttering setup's logfiles.
87 if [ "$PROGDIR" = "/etc/postinstall" ]
92 if [ -n "${CONFIG_AUTO_ANSWER_NO}" ]
99 # ======================================================================
101 # ======================================================================
128 echo "usage: ${PROGNAME} [OPTION]..."
130 echo "This script creates a basic messagebus configuration."
133 echo " --debug -d Enable shell's debug output."
134 echo " --yes -y Answer all questions with \"yes\" automatically."
135 echo " --no -n Answer all questions with \"no\" automatically."
143 # ======================================================================
145 # ======================================================================
147 # Check for ${SYSCONFDIR} directory
148 csih_make_dir "${SYSCONFDIR}" "Cannot create global configuration files."
149 chmod 775 "${SYSCONFDIR}"
150 setfacl -m u:system:rwx "${SYSCONFDIR}"
152 # Check for ${DEVDIR} directory
153 csih_make_dir "${DEVDIR}" "Syslogging using messagebus will not work."
154 chmod 775 "${DEVDIR}"
155 setfacl -m u:system:rwx "${DEVDIR}"
157 # Check for ${LOGDIR} directory
158 csih_make_dir "${LOGDIR}" "Syslogging using messagebus will not work."
159 chmod 775 "${LOGDIR}"
160 setfacl -m u:system:rwx "${LOGDIR}"
162 # Check for ${RUNDIR} directory
163 csih_make_dir "${RUNDIR}" "PID files of running processes will not be created."
164 chmod 775 "${RUNDIR}"
165 setfacl -m u:system:rwx "${RUNDIR}"
167 # Check for ${SOCKDIR} directory
168 csih_make_dir "${SOCKDIR}" "SOCKET files of running processes will not be created."
169 chmod 775 "${SOCKDIR}"
170 setfacl -m u:system:rwx "${SOCKDIR}"
172 # maybe: csih_auto_answer=no will skip,
173 # interactive user will get a chance to override
178 echo "Configuration finished. Have fun!"