56 changed files with 21 additions and 153 deletions
@ -1,75 +0,0 @@
|
||||
#!/bin/bash |
||||
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; version 2 of the License. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
||||
|
||||
set -e |
||||
init_config() { |
||||
mkdir "${CONFDIR}" |
||||
echo "Generating config file in ${CONFFILE}..." |
||||
touch "${CONFFILE}" |
||||
echo "[mysqld]" >> ${CONFFILE} |
||||
echo "pid-file=${RUNDIR}/mysqld.pid" >> ${CONFFILE} |
||||
echo "socket=${RUNDIR}/mysqld.sock" >> ${CONFFILE} |
||||
echo "datadir=${DATADIR}" >> ${CONFFILE} |
||||
echo "log-error=${LOGDIR}/error.log" >> ${CONFFILE} |
||||
echo "secure-file-priv=${FILESDIR}" >> ${CONFFILE} |
||||
echo "basedir=${BASEDIR}" >> ${CONFFILE} |
||||
echo "[mysql]" >> ${CONFFILE} |
||||
echo "socket=${RUNDIR}/mysqld.sock" >> ${CONFFILE} |
||||
echo "Done" |
||||
} |
||||
|
||||
init_database() { |
||||
echo "Initializing new database in ${DATADIR}..." |
||||
mkdir "${DATADIR}" |
||||
mysqld --defaults-file="${CONFFILE}" --initialize |
||||
echo "Done" |
||||
cat ${LOGDIR}/error.log | grep "temporary password" |
||||
} |
||||
|
||||
USERID=$(id -u) |
||||
if [ "${USERID}" = "0" ];then |
||||
MYSQL_SNAPDIR="${SNAP_COMMON}" |
||||
else |
||||
MYSQL_SNAPDIR="${SNAP_USER_COMMON}" |
||||
fi |
||||
DATADIR="${MYSQL_SNAPDIR}/data" |
||||
RUNDIR="${MYSQL_SNAPDIR}/run" |
||||
LOGDIR="${MYSQL_SNAPDIR}/log" |
||||
CONFDIR="${MYSQL_SNAPDIR}/conf" |
||||
CONFFILE="${CONFDIR}/my.cnf" |
||||
FILESDIR="${MYSQL_SNAPDIR}/files" |
||||
BASEDIR="${SNAP}/usr" |
||||
|
||||
[ -d "${LOGDIR}" ] || mkdir "${LOGDIR}" |
||||
[ -f "${LOGDIR}/error.log" ] || touch "${LOGDIR}/error.log" |
||||
[ -d "${FILESDIR}" ] || mkdir "${FILESDIR}" |
||||
[ -d "${RUNDIR}" ] || mkdir "${RUNDIR}" |
||||
[ -d "${CONFDIR}" ] || init_config |
||||
[ -d "${DATADIR}" ] || init_database |
||||
|
||||
if [ "${USERID}" = "0" ]; |
||||
then |
||||
# Ensure mysql user exists and that the correct permissions are set on various directories |
||||
getent group mysql || addgroup mysql |
||||
adduser --system --disabled-login --ingroup mysql --home /nonexistent --gecos "MySQL Server" --shell /bin/false mysql >/dev/null |
||||
chown -R mysql:mysql "${LOGDIR}" "${FILESDIR}" "${DATADIR}" "${RUNDIR}" |
||||
chmod 750 "${LOGDIR}" "${DATADIR}" |
||||
chmod 770 "${FILESDIR}" |
||||
chmod 755 "${RUNDIR}" |
||||
VARS="--user=mysql" |
||||
fi |
||||
echo "user=root" >> ${CONFFILE} |
||||
echo "password=`sudo cat /var/snap/microstack/common/log/error.log | grep "temporary password" | cut -d " " -f11`" >> ${CONFFILE} |
@ -1,14 +0,0 @@
|
||||
#!/bin/sh -e |
||||
|
||||
if [ "$SNAP_ARCH" = "amd64" ]; then |
||||
ARCH="x86_64-linux-gnu" |
||||
elif [ "$SNAP_ARCH" = "armhf" ]; then |
||||
ARCH="arm-linux-gnueabihf" |
||||
elif [ "$SNAP_ARCH" = "arm64" ]; then |
||||
ARCH="aarch64-linux-gnu" |
||||
else |
||||
ARCH="$SNAP_ARCH-linux-gnu" |
||||
fi |
||||
|
||||
export LD_LIBRARY_PATH=$SNAP/lib/$ARCH:$SNAP/usr/lib/$ARCH:$LD_LIBRARY_PATH |
||||
exec $SNAP/sbin/libvirtd |
@ -1,16 +0,0 @@
|
||||
#!/bin/bash |
||||
|
||||
set -e |
||||
|
||||
export OVS_LOGDIR=${SNAP_COMMON}/log/openvswitch |
||||
export OVS_RUNDIR=${SNAP_COMMON}/run/openvswitch |
||||
export OVS_SYSCONFDIR=${SNAP_COMMON}/etc |
||||
export OVS_PKGDATADIR=${SNAP}/share/openvswitch |
||||
export OVS_BINDIR=${SNAP}/bin |
||||
export OVS_SBINDIR=${SNAP}/sbin |
||||
|
||||
mkdir -p ${OVS_LOGDIR} |
||||
mkdir -p ${OVS_RUNDIR} |
||||
mkdir -p ${OVS_SYSCONFDIR}/openvswitch |
||||
|
||||
exec $@ |
@ -1,34 +0,0 @@
|
||||
#!/bin/sh |
||||
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; version 2 of the License. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
||||
|
||||
SNAPDIR=$(pwd) |
||||
SNAPTMP=$(mktemp -d) |
||||
cd ${SNAPTMP} |
||||
MYSQL_VERSION_MAJOR=5.7 |
||||
MYSQL_VERSION_FULL=5.7.17-1ubuntu16.04 |
||||
FILENAME="mysql-server_${MYSQL_VERSION_FULL}_amd64.deb-bundle.tar" |
||||
wget "http://dev.mysql.com/get/Downloads/MySQL-{MYSQL_VERSION_MAJOR}/${FILENAME}" |
||||
tar -xvf "${FILENAME}" |
||||
ar x mysql-community-client_${MYSQL_VERSION_FULL}_amd64.deb |
||||
tar -xvf data.tar.xz |
||||
rm data.tar.xz |
||||
ar x mysql-community-server_${MYSQL_VERSION_FULL}_amd64.deb |
||||
tar -xvf data.tar.xz |
||||
mkdir staging-files |
||||
mv usr staging-files/ |
||||
rm -rf ${SNAPDIR}/staging-files |
||||
mv staging-files ${SNAPDIR} |
||||
cd ${SNAPDIR} |
Loading…
Reference in new issue