Debian Codegraph @

packaging/deb-in/mysql-router-packagesource.preinst

raw
1 #!/bin/sh
2
3 # Copyright (c) 2015, 2026, Oracle and/or its affiliates.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License, version 2.0,
7 # as published by the Free Software Foundation.
8 #
9 # This program is designed to work with certain software (including
10 # but not limited to OpenSSL) that is licensed under separate terms,
11 # as designated in a particular file or component or in included license
12 # documentation. The authors of MySQL hereby grant you an additional
13 # permission to link the program and your derivative works with the
14 # separately licensed software that they have either included with
15 # the program or referenced in the documentation.
16 #
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License, version 2.0, for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26 . /usr/share/debconf/confmodule
27
28 LOGDIR=/var/log/mysqlrouter
29 MYSQLROUTERHOME=/var/lib/mysqlrouter
30 LOGFILE=${LOGDIR}/mysqlrouter.log
31
32 case "$1" in
33 install)
34
35 set -e
36
37 if [ -x /etc/init.d/mysqlrouter ]; then
38 invoke-rc.d mysqlrouter stop || exit $?
39 fi
40
41 addgroup --quiet --system mysqlrouter
42 adduser --quiet --system --ingroup mysqlrouter --disabled-login --home ${MYSQLROUTERHOME} --shell /bin/false \
43 --gecos "MySQL Router" mysqlrouter
44
45 if [ ! -d $LOGDIR ] && [ ! -L $LOGDIR ]; then
46 install -d -m 0750 -o mysqlrouter -g adm ${LOGDIR}
47 fi
48 install /dev/null -m 0640 -o mysqlrouter -g adm ${LOGFILE}
49
50 set +e
51 ;;
52
53 upgrade)
54 set -e
55
56 #DEBHELPER#
57
58 set +e
59 ;;
60 esac
61
62 exit 0