diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-01-29 15:41:05 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-01-29 15:41:05 +0100 |
commit | 41a163ac5ccf4ac5394edc84e40b3f47acea6b08 (patch) | |
tree | 60d5259e290b4a0166d8ef1651975b14b5afe304 /scripts | |
parent | a85d942be9008cf19086d8bd330c4be83a18167f (diff) | |
parent | e2b50213cf12623da31c8b49be4d40772876223c (diff) | |
download | mariadb-git-41a163ac5ccf4ac5394edc84e40b3f47acea6b08.tar.gz |
Merge branch '10.2' into 10.3mariadb-10.3.33
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/CMakeLists.txt | 1 | ||||
-rw-r--r-- | scripts/mysql_install_db.sh | 25 | ||||
-rw-r--r-- | scripts/mysqld_safe.sh | 10 |
3 files changed, 31 insertions, 5 deletions
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 68134aca664..41b4e556835 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -163,6 +163,7 @@ ENDIF() SET(HOSTNAME "hostname") SET(MYSQLD_USER "mysql") +SET(MYSQLD_GROUP "mysql") ENDIF(UNIX) # Really ugly, one script, "mysql_install_db", needs prefix set to ".", diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index f8a953f2d90..ee15cd6cb28 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -31,6 +31,7 @@ defaults="" defaults_group_suffix="" mysqld_opt="" user="" +group="" silent_startup="--silent-startup" force=0 @@ -95,6 +96,11 @@ Usage: $0 [OPTIONS] user. You must be root to use this option. By default mysqld runs using your current login name and files and directories that it creates will be owned by you. + --group=group_name The login group to use for running mysqld. Files and + directories created by mysqld will be owned by this + group. You must be root to use this option. By default + mysqld runs using your current group and files and + directories that it creates will be owned by you. All other options are passed to the mysqld program @@ -144,11 +150,11 @@ parse_arguments() --ldata=*|--datadir=*|--data=*) ldata=`parse_arg "$arg"` ;; --log-error=*) log_error=`parse_arg "$arg"` ;; - --user=*) # Note that the user will be passed to mysqld so that it runs # as 'user' (crucial e.g. if log-bin=/some_other_path/ # where a chown of datadir won't help) - user=`parse_arg "$arg"` ;; + --user=*) user=`parse_arg "$arg"` ;; + --group=*) group=`parse_arg "$arg"` ;; --skip-name-resolve) ip_only=1 ;; --verbose) verbose=1 ; silent_startup="" ;; --rpm) in_rpm=1 ;; @@ -457,7 +463,12 @@ do fi if test -n "$user" then - chown $user "$dir" + if test -z "$group" + then + chown $user $dir + else + chown $user:$group $dir + fi if test $? -ne 0 then echo "Cannot change ownership of the database directories to the '$user'" @@ -472,6 +483,11 @@ then args="$args --user=$user" fi +if test -n "$group" +then + args="$args --group=$group" +fi + # When doing a "cross bootstrap" install, no reference to the current # host should be added to the system tables. So we filter out any # lines which contain the current host name. @@ -488,7 +504,7 @@ mysqld_install_cmd_line() { "$mysqld_bootstrap" $defaults $defaults_group_suffix "$mysqld_opt" --bootstrap $silent_startup\ "--basedir=$basedir" "--datadir=$ldata" --log-warnings=0 --enforce-storage-engine="" \ - "--plugin-dir=${plugindir}" \ + "--plugin-dir=${plugindir}" --loose-disable-plugin-file-key-management \ $args --max_allowed_packet=8M \ --net_buffer_length=16K } @@ -520,6 +536,7 @@ cat_sql() s_echo "Installing MariaDB/MySQL system tables in '$ldata' ..." if cat_sql | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null then + printf "@VERSION@-MariaDB" > "$ldata/mysql_upgrade_info" s_echo "OK" else log_file_place=$ldata diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 0076e2964d2..152077fe2a0 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -29,6 +29,7 @@ logging=init want_syslog=0 syslog_tag= user='@MYSQLD_USER@' +group='@MYSQLD_GROUP@' pid_file= err_log= err_log_base= @@ -290,6 +291,7 @@ parse_arguments() { --pid[-_]file=*) pid_file="$val" ;; --plugin[-_]dir=*) PLUGIN_DIR="$val" ;; --user=*) user="$val"; SET_USER=1 ;; + --group=*) group="$val"; SET_USER=1 ;; --log[-_]basename=*|--hostname=*|--loose[-_]log[-_]basename=*) pid_file="$val.pid"; err_log_base="$val"; @@ -692,6 +694,7 @@ then if test "$user" != "root" -o $SET_USER = 1 then USER_OPTION="--user=$user" + GROUP_OPTION="--group=$group" fi if test -n "$open_files" then @@ -714,7 +717,12 @@ then log_error "Fatal error Can't create database directory '$mysql_unix_port'" exit 1 fi - chown $user $mysql_unix_port_dir + if [ "$user" -a "$group" ]; then + chown $user:$group $mysql_unix_port_dir + else + [ "$user" ] && chown $user $mysql_unix_port_dir + [ "$group" ] && chgrp $group $mysql_unix_port_dir + fi chmod 755 $mysql_unix_port_dir fi |