Browse Source

Merge pull request #18 from javacruft/configure-hook

Configure hook
configure-hook
James Page 3 years ago
committed by GitHub
parent
commit
2274a07e1f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 0
      patches/nginx/drop-nginx-setgroups.patch
  2. 75
      scripts/mysql/mysql-startup
  3. 186
      snap-overlay/bin/configure-openstack
  4. 0
      snap-overlay/bin/sudo
  5. 0
      snap-overlay/etc/cinder/cinder.conf
  6. 0
      snap-overlay/etc/glance/glance.conf.d/database.conf
  7. 0
      snap-overlay/etc/glance/glance.conf.d/keystone.conf
  8. 0
      snap-overlay/etc/horizon/horizon.conf
  9. 0
      snap-overlay/etc/keystone/keystone.conf
  10. 0
      snap-overlay/etc/keystone/keystone.conf.d/database.conf
  11. 0
      snap-overlay/etc/neutron/dhcp_agent.ini
  12. 0
      snap-overlay/etc/neutron/l3_agent.ini
  13. 0
      snap-overlay/etc/neutron/metadata_agent.ini
  14. 0
      snap-overlay/etc/neutron/neutron.conf
  15. 0
      snap-overlay/etc/neutron/neutron.conf.d/database.conf
  16. 0
      snap-overlay/etc/neutron/neutron.conf.d/keystone.conf
  17. 0
      snap-overlay/etc/neutron/neutron.conf.d/nova.conf
  18. 1
      snap-overlay/etc/neutron/neutron.conf.d/workers.conf
  19. 0
      snap-overlay/etc/neutron/plugins/ml2/ml2_conf.ini
  20. 6
      snap-overlay/etc/neutron/plugins/ml2/openvswitch_agent.ini
  21. 0
      snap-overlay/etc/nova/nova.conf
  22. 0
      snap-overlay/etc/nova/nova.conf.d/database.conf
  23. 0
      snap-overlay/etc/nova/nova.conf.d/glance.conf
  24. 1
      snap-overlay/etc/nova/nova.conf.d/hypervisor.conf
  25. 0
      snap-overlay/etc/nova/nova.conf.d/keystone.conf
  26. 6
      snap-overlay/etc/nova/nova.conf.d/neutron.conf
  27. 0
      snap-overlay/etc/nova/nova.conf.d/nova-placement.conf
  28. 0
      snap-overlay/etc/nova/nova.conf.d/rabbitmq.conf
  29. 0
      snap-overlay/etc/nova/nova.conf.d/scheduler.conf
  30. 0
      snap-overlay/etc/nova/nova.conf.d/workers.conf
  31. 0
      snap-overlay/etc/nova/policy.yaml
  32. 1
      snap-overlay/snap-openstack.yaml
  33. 0
      snap-overlay/templates/cinder-api.ini.j2
  34. 0
      snap-overlay/templates/cinder-nginx.conf.j2
  35. 0
      snap-overlay/templates/cinder-snap.conf.j2
  36. 0
      snap-overlay/templates/glance-snap.conf.j2
  37. 0
      snap-overlay/templates/horizon-nginx.conf.j2
  38. 0
      snap-overlay/templates/horizon-snap.conf.j2
  39. 0
      snap-overlay/templates/horizon.ini.j2
  40. 0
      snap-overlay/templates/keystone-api.ini.j2
  41. 0
      snap-overlay/templates/keystone-nginx.conf.j2
  42. 0
      snap-overlay/templates/keystone-snap.conf.j2
  43. 0
      snap-overlay/templates/neutron-snap.conf.j2
  44. 0
      snap-overlay/templates/nginx.conf.j2
  45. 0
      snap-overlay/templates/nova-nginx.conf.j2
  46. 0
      snap-overlay/templates/nova-placement-api.ini.j2
  47. 0
      snap-overlay/templates/nova-snap.conf.j2
  48. 3
      snap-wrappers/libvirtd/launch-libvirtd
  49. 0
      snap-wrappers/mysql/mysql-start-client
  50. 0
      snap-wrappers/mysql/mysql-start-server
  51. 0
      snap-wrappers/ovs/ovs-wrapper
  52. 0
      snap-wrappers/rabbitmq/erl
  53. 0
      snap-wrappers/rabbitmq/rabbitmq-defaults
  54. 0
      snap-wrappers/rabbitmq/rabbitmq-script-wrapper
  55. 18
      snap/bin/launch-libvirtd
  56. 16
      snap/bin/ovs-wrapper
  57. 49
      snap/hooks/configure
  58. 59
      snap/hooks/install
  59. 443
      snapcraft.yaml
  60. 34
      stage_binaries.sh

0
patches/drop-nginx-setgroups.patch → patches/nginx/drop-nginx-setgroups.patch

75
scripts/mysql/mysql-startup

@ -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}

186
snap-overlay/bin/configure-openstack

@ -0,0 +1,186 @@
#!/bin/bash -e
# Install conf.d configuration from snap for db etc
for project in neutron nova keystone glance; do
mkdir -p ${SNAP_COMMON}/etc/${project}/${project}.conf.d
cp -r ${SNAP}/etc/${project}/${project}.conf.d/* ${SNAP_COMMON}/etc/${project}/${project}.conf.d
done
# Create all of the databases
for db in neutron nova nova_api nova_cell0 cinder glance keystone; do
echo "CREATE DATABASE IF NOT EXISTS ${db}; GRANT ALL PRIVILEGES ON ${db}.* TO '${db}'@'localhost' IDENTIFIED BY '${db}';" \
| mysql-start-client -u root
done
# Grant nova user access to cell0
echo "GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'nova';" | mysql-start-client -u root
# RabbitMQ
echo "rabbit setup"
export HOME=$SNAP_COMMON/lib/rabbitmq # TODO: unset this?
# Rabbitmq isn't always started when we run this. Wait for it to start.
# TODO: develop this a bit more -- not 100% that this does what we want.
while :;
do
grep "Starting broker... completed" /var/snap/microstack/common/log/rabbitmq/startup_log && break
echo "waiting for rabbitmq to start" && sleep 1;
done
rabbitmqctl add_user openstack rabbitmq || true
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
# Keystone
echo "keystone setup"
snap-openstack keystone-manage fernet_setup --keystone-user root --keystone-group root
snap-openstack keystone-manage db_sync
systemctl restart snap.microstack.keystone-*
openstack user show admin || {
snap-openstack keystone-manage bootstrap \
--bootstrap-password $OS_PASSWORD \
--bootstrap-admin-url http://localhost:5000/v3/ \
--bootstrap-internal-url http://localhost:5000/v3/ \
--bootstrap-public-url http://localhost:5000/v3/ \
--bootstrap-region-id RegionOne
}
openstack project show service || {
openstack project create --domain default --description "Service Project" service
}
# Nova
echo "nova setup"
openstack user show nova || {
openstack user create --domain default --password nova nova
openstack role add --project service --user nova admin
}
openstack user show placement || {
openstack user create --domain default --password placement placement
openstack role add --project service --user placement admin
}
openstack service show compute || {
openstack service create --name nova \
--description "OpenStack Compute" compute
for endpoint in public internal admin; do
openstack endpoint create --region RegionOne \
compute $endpoint http://localhost:8774/v2.1 || :
done
}
openstack service show placement || {
openstack service create --name placement \
--description "Placement API" placement
for endpoint in public internal admin; do
openstack endpoint create --region RegionOne \
placement $endpoint http://localhost:8778 || :
done
}
snap-openstack nova-manage api_db sync
snap-openstack nova-manage cell_v2 list_cells | grep cell0 || {
snap-openstack nova-manage cell_v2 map_cell0
}
snap-openstack nova-manage cell_v2 list_cells | grep cell1 || {
snap-openstack nova-manage cell_v2 create_cell --name=cell1 --verbose
}
snap-openstack nova-manage db sync
systemctl restart snap.microstack.nova-*
while ! nc -z localhost 8774; do sleep 0.1; done;
sleep 5
openstack flavor show m1.tiny || {
openstack flavor create --id 1 --ram 512 --disk 1 --vcpus 1 m1.tiny
}
openstack flavor show m1.small || {
openstack flavor create --id 2 --ram 2048 --disk 20 --vcpus 1 m1.small
}
openstack flavor show m1.medium || {
openstack flavor create --id 3 --ram 4096 --disk 20 --vcpus 2 m1.medium
}
openstack flavor show m1.large || {
openstack flavor create --id 4 --ram 8192 --disk 20 --vcpus 4 m1.large
}
openstack flavor show m1.xlarge || {
openstack flavor create --id 5 --ram 16384 --disk 20 --vcpus 8 m1.xlarge
}
# Neutron
echo "neutron setup"
openstack user show neutron || {
openstack user create --domain default --password neutron neutron
openstack role add --project service --user neutron admin
}
openstack service show network || {
openstack service create --name neutron \
--description "OpenStack Network" network
for endpoint in public internal admin; do
openstack endpoint create --region RegionOne \
network $endpoint http://localhost:9696 || :
done
}
snap-openstack neutron-db-manage upgrade head
systemctl restart snap.microstack.neutron-*
while ! nc -z localhost 9696; do sleep 0.1; done;
sleep 5
openstack network show test || {
openstack network create test
}
openstack subnet show test-subnet || {
openstack subnet create --network test --subnet-range 192.168.222.0/24 test-subnet
}
# Glance
echo "glance setup"
openstack user show glance || {
openstack user create --domain default --password glance glance
openstack role add --project service --user glance admin
}
openstack service show image || {
openstack service create --name glance --description "OpenStack Image" image
for endpoint in internal admin public; do
openstack endpoint create --region RegionOne \
image $endpoint http://localhost:9292 || :
done
}
snap-openstack glance-manage db_sync
systemctl restart snap.microstack.glance*
while ! nc -z localhost 9292; do sleep 0.1; done;
sleep 5
openstack image show cirros || {
[ -f $HOME/images/cirros-0.3.5-x86_64-disk.img ] || {
export http_proxy=$SNAPSTACK_HTTP_PROXY
mkdir -p $HOME/images
wget \
http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img \
-O ${HOME}/images/cirros-0.3.5-x86_64-disk.img
unset http_proxy
}
openstack image create --file ${HOME}/images/cirros-0.3.5-x86_64-disk.img \
--public --container-format=bare --disk-format=qcow2 cirros
}

0
snap/bin/sudo → snap-overlay/bin/sudo

0
snap/etc/cinder/cinder.conf → snap-overlay/etc/cinder/cinder.conf

0
snap/etc/glance/glance.conf.d/database.conf → snap-overlay/etc/glance/glance.conf.d/database.conf

0
snap/etc/glance/glance.conf.d/keystone.conf → snap-overlay/etc/glance/glance.conf.d/keystone.conf

0
snap/etc/horizon/horizon.conf → snap-overlay/etc/horizon/horizon.conf

0
snap/etc/keystone/keystone.conf → snap-overlay/etc/keystone/keystone.conf

0
snap/etc/keystone/keystone.conf.d/database.conf → snap-overlay/etc/keystone/keystone.conf.d/database.conf

0
snap/etc/neutron/dhcp_agent.ini → snap-overlay/etc/neutron/dhcp_agent.ini

0
snap/etc/neutron/l3_agent.ini → snap-overlay/etc/neutron/l3_agent.ini

0
snap/etc/neutron/metadata_agent.ini → snap-overlay/etc/neutron/metadata_agent.ini

0
snap/etc/neutron/neutron.conf → snap-overlay/etc/neutron/neutron.conf

0
snap/etc/neutron/neutron.conf.d/database.conf → snap-overlay/etc/neutron/neutron.conf.d/database.conf

0
snap/etc/neutron/neutron.conf.d/keystone.conf → snap-overlay/etc/neutron/neutron.conf.d/keystone.conf

0
snap/etc/neutron/neutron.conf.d/nova.conf → snap-overlay/etc/neutron/neutron.conf.d/nova.conf

1
snap/etc/neutron/neutron.conf.d/workers.conf → snap-overlay/etc/neutron/neutron.conf.d/workers.conf

@ -1,3 +1,4 @@
[DEFAULT]
api_workers = 4
rpc_workers = 4
metadata_workers = 4

0
snap/etc/neutron/plugins/ml2/ml2_conf.ini → snap-overlay/etc/neutron/plugins/ml2/ml2_conf.ini

6
snap/etc/neutron/plugins/ml2/openvswitch_agent.ini → snap-overlay/etc/neutron/plugins/ml2/openvswitch_agent.ini

@ -1,7 +1,11 @@
# Snap provided defaults for neutron-openvswitch-agent
[securitygroup]
enable_security_group = True
firewall_driver = iptables_hybrid
firewall_driver = openvswitch
[AGENT]
tunnel_types = geneve,vxlan,gre
[ovs]
local_ip = 127.0.0.1
bridge_mappings = physnet1:br-ex

0
snap/etc/nova/nova.conf → snap-overlay/etc/nova/nova.conf

0
snap/etc/nova/nova.conf.d/database.conf → snap-overlay/etc/nova/nova.conf.d/database.conf

0
snap/etc/nova/nova.conf.d/glance.conf → snap-overlay/etc/nova/nova.conf.d/glance.conf

1
snap/etc/nova/nova.conf.d/hypervisor.conf → snap-overlay/etc/nova/nova.conf.d/hypervisor.conf

@ -6,3 +6,4 @@ disable_rootwrap = True
[libvirt]
virt_type = kvm
cpu_mode = host-passthrough

0
snap/etc/nova/nova.conf.d/keystone.conf → snap-overlay/etc/nova/nova.conf.d/keystone.conf

6
snap/etc/nova/nova.conf.d/neutron.conf → snap-overlay/etc/nova/nova.conf.d/neutron.conf

@ -1,7 +1,3 @@
[DEFAULT]
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[neutron]
url = http://localhost:9696
auth_url = http://localhost:5000
@ -13,3 +9,5 @@ region_name = RegionOne
project_name = service
username = neutron
password = neutron
service_metadata_proxy = True
metadata_proxy_shared_secret = supersecret

0
snap/etc/nova/nova.conf.d/nova-placement.conf → snap-overlay/etc/nova/nova.conf.d/nova-placement.conf

0
snap/etc/nova/nova.conf.d/rabbitmq.conf → snap-overlay/etc/nova/nova.conf.d/rabbitmq.conf

0
snap/etc/nova/nova.conf.d/scheduler.conf → snap-overlay/etc/nova/nova.conf.d/scheduler.conf

0
snap/etc/nova/nova.conf.d/workers.conf → snap-overlay/etc/nova/nova.conf.d/workers.conf

0
snap/etc/nova/policy.yaml → snap-overlay/etc/nova/policy.yaml

1
snap/snap-openstack.yaml → snap-overlay/snap-openstack.yaml

@ -21,6 +21,7 @@ setup:
- "{snap_common}/lock"
- "{snap_common}/log"
- "{snap_common}/run"
- "{snap_common}/instances"
templates:
keystone-nginx.conf.j2: "{snap_common}/etc/nginx/snap/sites-enabled/keystone.conf"
keystone-snap.conf.j2: "{snap_common}/etc/keystone/keystone.conf.d/keystone-snap.conf"

0
snap/templates/cinder-api.ini.j2 → snap-overlay/templates/cinder-api.ini.j2

0
snap/templates/cinder-nginx.conf.j2 → snap-overlay/templates/cinder-nginx.conf.j2

0
snap/templates/cinder-snap.conf.j2 → snap-overlay/templates/cinder-snap.conf.j2

0
snap/templates/glance-snap.conf.j2 → snap-overlay/templates/glance-snap.conf.j2

0
snap/templates/horizon-nginx.conf.j2 → snap-overlay/templates/horizon-nginx.conf.j2

0
snap/templates/horizon-snap.conf.j2 → snap-overlay/templates/horizon-snap.conf.j2

0
snap/templates/horizon.ini.j2 → snap-overlay/templates/horizon.ini.j2

0
snap/templates/keystone-api.ini.j2 → snap-overlay/templates/keystone-api.ini.j2

0
snap/templates/keystone-nginx.conf.j2 → snap-overlay/templates/keystone-nginx.conf.j2

0
snap/templates/keystone-snap.conf.j2 → snap-overlay/templates/keystone-snap.conf.j2

0
snap/templates/neutron-snap.conf.j2 → snap-overlay/templates/neutron-snap.conf.j2

0
snap/templates/nginx.conf.j2 → snap-overlay/templates/nginx.conf.j2

0
snap/templates/nova-nginx.conf.j2 → snap-overlay/templates/nova-nginx.conf.j2

0
snap/templates/nova-placement-api.ini.j2 → snap-overlay/templates/nova-placement-api.ini.j2

0
snap/templates/nova-snap.conf.j2 → snap-overlay/templates/nova-snap.conf.j2

3
snap-wrappers/libvirtd/launch-libvirtd

@ -0,0 +1,3 @@
#!/bin/sh -e
exec "$SNAP/sbin/libvirtd"

0
scripts/mysql/mysql-start-client → snap-wrappers/mysql/mysql-start-client

0
scripts/mysql/mysql-start-server → snap-wrappers/mysql/mysql-start-server

0
conf/bin/ovs-wrapper → snap-wrappers/ovs/ovs-wrapper

0
scripts/rabbitmq/erl → snap-wrappers/rabbitmq/erl

0
scripts/rabbitmq/rabbitmq-defaults → snap-wrappers/rabbitmq/rabbitmq-defaults

0
scripts/rabbitmq/rabbitmq-script-wrapper → snap-wrappers/rabbitmq/rabbitmq-script-wrapper

18
snap/bin/launch-libvirtd

@ -1,18 +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
driver="$(snapctl get driver)"
if [ "$driver" = "LIBVIRT" ]; then
export LD_LIBRARY_PATH=$SNAP/lib/$ARCH:$SNAP/usr/lib/$ARCH:$LD_LIBRARY_PATH
exec $SNAP/sbin/libvirtd
fi

16
snap/bin/ovs-wrapper

@ -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 $@

49
snap/hooks/configure

@ -1,49 +0,0 @@
#!/bin/bash -e
# Openstack Prep
# which openstack || echo "This snap currently requires the python openstack client to be installed and in your path. The intent is to add the client in before development is complete."; exit 1
# QEMU Setup
echo "qemu setup"
driver="$(snapctl get driver)"
if [[ -n $driver && ! $driver =~ (LIBVIRT|QEMU) ]]; then
echo "\"$driver\" is not a supported virtualization driver"
exit 1
fi
driver_saved="$(cat $SNAP_COMMON/driver)" || true
driver=${driver:-QEMU}
driver_saved=${driver_saved:-QEMU}
if [[ $driver != $driver_saved ]]; then
echo "$driver" > $SNAP_COMMON/driver
snapctl restart $SNAP_NAME
fi
# MySQL Setup
MYSQL_PASSWORD=fnord # TODO use snapctl
echo "ALTER USER 'root'@'localhost' IDENTIFIED BY 'fnord';" | mysql-start-client -u root
# Keystone Setup
echo "CREATE DATABASE IF NOT EXISTS keystone; GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'keystone';" | mysql-start-client -u root -p"$MYSQL_PASSWORD"
snap-openstack keystone-manage fernet_setup --keystone-user root --keystone-group root
snap-openstack keystone-manage db_sync
sudo systemctl restart snap.microstack.*
openstack user show admin || {
snap-openstack keystone-manage bootstrap \
--bootstrap-password $OS_PASSWORD \
--bootstrap-admin-url http://localhost:35357/v3/ \
--bootstrap-internal-url http://localhost:35357/v3/ \
--bootstrap-public-url http://localhost:5000/v3/ \
--bootstrap-region-id RegionOne
}
openstack project show service || {
openstack project create --domain default --description "Service Project" service
}

59
snap/hooks/install

@ -3,62 +3,3 @@ set -e
install -D $SNAP/var/snap/microstack/common/libvirt/libvirtd.conf $SNAP_COMMON/libvirt/libvirtd.conf
sed -i 's/unix_sock_group = "libvirtd"/unix_sock_group = "sudo"/' $SNAP_COMMON/libvirt/libvirtd.conf
# Mysql setup script
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

443
snapcraft.yaml

@ -1,5 +1,5 @@
name: microstack
version: alpha
version: rocky
summary: Openstack on your laptop.
description: |
Microstack gives you an easy way to develop and test Openstack
@ -8,7 +8,7 @@ description: |
grade: devel
confinement: classic
environment:
LD_LIBRARY_PATH: $SNAP/lib:$SNAP/usr/lib:$SNAP/usr/lib/x86_64-linux-gnu
LD_LIBRARY_PATH: $SNAP/lib:$SNAP/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/usr/lib:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET
PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH
LC_ALL: C
OS_PLACEMENT_CONFIG_DIR: $SNAP/etc/nova/
@ -28,11 +28,10 @@ apps:
command: openstack
plugs:
- network
configure-the-things:
command: bin/configure-the-things.sh
configure-openstack:
command: configure-openstack
plugs:
- network
- process-control
# Keystone
keystone-uwsgi:
@ -215,10 +214,14 @@ apps:
# Libvirt/Qemu
libvirt-bin:
command: bin/launch-libvirtd
command: launch-libvirtd
daemon: simple
environment:
LD_LIBRARY_PATH: $SNAP/lib:$SNAP/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/usr/lib:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio
PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH
LC_ALL: C
virsh:
command: bin/virsh
command: virsh
environment:
PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH
LC_ALL: C
@ -267,12 +270,12 @@ apps:
# Cinder
cinder-uwsgi:
command: snap-openstack cinder-uwsgi
daemon: simple
# daemon: simple
plugs:
- network-bind
cinder-backup:
command: snap-openstack cinder-backup
daemon: simple
# daemon: simple
plugs:
- network
cinder-manage:
@ -281,12 +284,12 @@ apps:
- network
cinder-scheduler:
command: snap-openstack cinder-scheduler
daemon: simple
# daemon: simple
plugs:
- network
cinder-volume:
command: snap-openstack cinder-volume
daemon: simple
# daemon: simple
plugs:
- network
@ -298,32 +301,52 @@ apps:
- network-bind
parts:
# Keystone
keystone:
# OpenStack Python Projects, keyed off Keystone
openstack-projects:
plugin: python
python-version: python2
constraints: https://raw.githubusercontent.com/openstack/requirements/stable/rocky/upper-constraints.txt
source: http://tarballs.openstack.org/keystone/keystone-stable-rocky.tar.gz
python-packages:
- mysql-python
- libvirt-python
- oslo.cache[dogpile]
- pymysql
- pysqlite
- uwsgi
- git+https://github.com/openstack/snap.openstack#egg=snap.openstack
- http://tarballs.openstack.org/nova/nova-stable-rocky.tar.gz
- http://tarballs.openstack.org/neutron/neutron-stable-rocky.tar.gz
- http://tarballs.openstack.org/glance/glance-stable-rocky.tar.gz
- http://tarballs.openstack.org/cinder/cinder-stable-rocky.tar.gz
- http://tarballs.openstack.org/horizon/horizon-stable-rocky.tar.gz
- python-cinderclient
- python-openstackclient
- python-swiftclient
build-packages:
- gcc
- libffi-dev
- libmysqlclient-dev
- libssl-dev
- libsqlite3-dev
configure-the-things:
plugin: dump
source: src/experiments
- libxml2-dev
- libxslt1-dev
- libvirt-dev
stage-packages:
- conntrack
- coreutils
- haproxy
override-build: |
# Ensure libvirt is discovered from previous built part
export PKG_CONFIG_PATH=$SNAPCRAFT_STAGE/lib/pkgconfig
snapcraftctl build
override-prime: |
snapcraftctl prime
# Now that everything is built, let's disable user site-packages
# as stated in PEP-0370
sed -i usr/lib/python2.7/site.py -e 's/^ENABLE_USER_SITE = None$/ENABLE_USER_SITE = False/'
# This is the last step, let's now compile all our pyc files.
# Ignore errors due to syntax issues in foobar python 2.
./usr/bin/python2.7 -m compileall . || true
keystone-config:
after: [keystone]
after: [openstack-projects]
plugin: dump
source: http://tarballs.openstack.org/keystone/keystone-stable-rocky.tar.gz
organize:
@ -334,68 +357,22 @@ parts:
filesets:
etc:
- etc/keystone/*.conf
- etc/keystone/*.ini
- etc/keystone/*.json
- etc/keystone/*.templates
- etc/keystone/*
stage: [$etc]
prime: [$etc]
# Nova
nova:
after: [keystone] # We abitrarily rely on keystone to be the one to patch things
plugin: python
python-version: python2
source: http://tarballs.openstack.org/nova/nova-stable-rocky.tar.gz
python-packages:
- libvirt-python
- pymysql
- uwsgi
- python-memcached
- git+https://github.com/openstack/snap.openstack#egg=snap.openstack
constraints: https://raw.githubusercontent.com/openstack/requirements/stable/rocky/upper-constraints.txt
build-packages:
- gcc
- libffi-dev
- libssl-dev
- libxml2-dev
- libxslt1-dev
- libvirt-dev
stage-packages:
- conntrack
- coreutils
- qemu-utils
nova-config:
after: [nova]
after: [openstack-projects]
plugin: dump
source: http://tarballs.openstack.org/nova/nova-stable-rocky.tar.gz
filesets:
etc:
- etc/nova/*.conf
- etc/nova/*.ini
- etc/nova/*.json
- etc/nova/rootwrap.d
- etc/nova/*
stage: [$etc]
prime: [$etc]
neutron:
after: [keystone] # We arbitrarily rely on keystone to patch some things
plugin: python
python-version: python2
source: http://tarballs.openstack.org/neutron/neutron-stable-rocky.tar.gz
python-packages:
- pymysql
- python-memcached
- git+https://github.com/openstack/snap.openstack#egg=snap.openstack
constraints: https://raw.githubusercontent.com/openstack/requirements/stable/rocky/upper-constraints.txt
build-packages:
- gcc
- libffi-dev
- libssl-dev
neutron-config:
after: [neutron]
after: [openstack-projects]
plugin: dump
source: http://tarballs.openstack.org/neutron/neutron-stable-rocky.tar.gz
organize:
@ -409,31 +386,8 @@ parts:
stage: [$etc]
prime: [$etc]
# Glance
glance:
after: [keystone] # We arbitrarily rely on keystone to patch some things
plugin: python
python-version: python2
source: http://tarballs.openstack.org/glance/glance-stable-rocky.tar.gz
python-packages:
- httplib2
- os-brick
- oslo.rootwrap
- oslo.vmware
- pymysql
- python-cinderclient
- python-memcached
- python-swiftclient
- git+https://github.com/openstack/snap.openstack#egg=snap.openstack
constraints: https://raw.githubusercontent.com/openstack/requirements/stable/rocky/upper-constraints.txt
build-packages:
- gcc
- libffi-dev
- libssl-dev
- libxml2-dev
- libxslt1-dev
glance-config:
after: [glance]
after: [openstack-projects]
plugin: dump
source: http://tarballs.openstack.org/glance/glance-stable-rocky.tar.gz
organize:
@ -442,14 +396,39 @@ parts:
etc/*.json: etc/glance/
filesets:
etc:
- etc/glance/*.conf
- etc/glance/*.ini
- etc/glance/*.json
- etc/glance/*
stage: [$etc]
prime: [$etc]
# Openvswitch
ovs-patches:
cinder-config:
after: [openstack-projects]
plugin: dump
source: http://tarballs.openstack.org/cinder/cinder-stable-rocky.tar.gz
organize:
etc/*.conf: etc/cinder/
etc/*.ini: etc/cinder/
etc/*.json: etc/cinder/
etc/*.templates: etc/cinder/
filesets:
etc:
- etc/cinder/*
stage: [$etc]
prime: [$etc]
horizon-config:
after: [openstack-projects]
plugin: dump
source: http://tarballs.openstack.org/horizon/horizon-stable-rocky.tar.gz
organize:
etc/*.conf: etc/horizon/
filesets:
etc:
- etc/horizon/*
stage: [$etc]
prime: [$etc]
# Snap patches
patches:
source: patches/
plugin: dump
organize:
@ -476,8 +455,8 @@ parts:
- "--localstatedir=/var/snap/$SNAPCRAFT_PROJECT_NAME/common"
- "--sysconfdir=/var/snap/$SNAPCRAFT_PROJECT_NAME/etc"
after:
- ovs-patches
prepare: |
- patches
override-build: |
# Apply patches
for patch in ${SNAPCRAFT_STAGE}/patches/openvswitch/*.patch; do
echo "Applying $(basename "$patch") ..."
@ -488,57 +467,49 @@ parts:
--input "$patch"
echo
done
snapcraftctl build
ovs-wrapper:
source: conf
source: ./snap-wrappers/ovs
plugin: dump
after:
- openvswitch
# Openstack Shared Parts
templates:
after:
- keystone-config
- nova-config
- neutron-config
- glance-config
- ovs-wrapper
- qemu
- kvm-support
- libvirt
- mysql-server
- rabbitmq-server
- memcached
- cinder-config
- horizon-config
- python-openstackclient
plugin: dump
source: snap
organize:
ovs-wrapper: bin/ovs-wrapper
nginx:
after: [keystone, nova, neutron, openvswitch]
source: http://www.nginx.org/download/nginx-1.13.0.tar.gz
plugin: autotools
after:
- patches
configflags:
- --prefix=/usr
- --http-log-path=/var/snap/microstack/common/log/nginx-access.log
- --error-log-path=/var/snap/microstack/common/log/nginx-error.log
- --lock-path=/var/snap/microstack/common/lock/nginx.lock
- --pid-path=/var/snap/microstack/common/run/nginx.pid
- --http-client-body-temp-path=/var/snap/microstack/common/lib/nginx_client_body
- --http-proxy-temp-path=/var/snap/microstack/common/lib/nginx_proxy
- --http-fastcgi-temp-path=/var/snap/microstack/common/lib/nginx_fastcgi
- --http-uwsgi-temp-path=/var/snap/microstack/common/lib/nginx_uwsgi
- --http-scgi-temp-path=/var/snap/microstack/common/lib/nginx_scgi
- "--http-log-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/log/nginx-access.log"
- "--error-log-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/log/nginx-error.log"
- "--lock-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/lock/nginx.lock"
- "--pid-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/run/nginx.pid"
- "--http-client-body-temp-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/lib/nginx_client_body"
- "--http-proxy-temp-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/lib/nginx_proxy"
- "--http-fastcgi-temp-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/lib/nginx_fastcgi"
- "--http-uwsgi-temp-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/lib/nginx_uwsgi"
- "--http-scgi-temp-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/lib/nginx_scgi"
- --with-http_ssl_module
build-packages:
- libpcre3-dev
- libssl-dev
- python-six
prepare: |
export SNAP_ROOT="../../.."
export SNAP_SOURCE="$SNAP_ROOT/parts/nginx/build"
patch -d $SNAP_SOURCE -p1 < $SNAP_ROOT/patches/drop-nginx-setgroups.patch
override-build: |
# Apply patches
for patch in ${SNAPCRAFT_STAGE}/patches/nginx/*.patch; do
echo "Applying $(basename "$patch") ..."
patch \
--batch \
--forward \
--strip 1 \
--input "$patch"
echo
done
snapcraftctl build
libxml2:
source: http://xmlsoft.org/sources/libxml2-2.9.4.tar.gz
@ -546,20 +517,69 @@ parts:
# libvirt/qemu
qemu:
plugin: nil
source: .
source-subdir: qemu-2.5+dfsg
plugin: autotools
stage-packages:
- on amd64: [qemu-system-x86]
- on i386: [qemu-system-x86]
- on armhf: [qemu-system-arm]
- on arm64: [qemu-system-arm]
- qemu-utils
- libslang2
- seabios
- ipxe-qemu
- try:
- libnuma1
build-packages:
- acpica-tools
- libaio-dev
- libasound2-dev
- libattr1-dev
- libbluetooth-dev
- libcap-dev
- libcap-ng-dev
- libcurl4-gnutls-dev
- libfdt-dev
- gnutls-dev
- libiscsi-dev
- libncurses5-dev
- try: [libnuma-dev]
- libpixman-1-dev
- libpulse-dev
- librados-dev
- librbd-dev
- libsasl2-dev
- libsdl1.2-dev
- libspice-server-dev
- libspice-protocol-dev
- libusb-1.0-0-dev
- libusbredirparser-dev
- linux-libc-dev
- uuid-dev
- xfslibs-dev
- libjpeg-dev
- zlib1g-dev
- libpng-dev
- wget
- dpkg-dev
- gcc
configflags:
- --disable-blobs
- --prefix=/snap/$SNAPCRAFT_PROJECT_NAME/current
- --localstatedir=/var/snap/$SNAPCRAFT_PROJECT_NAME/common
- --sysconfdir=/var/snap/$SNAPCRAFT_PROJECT_NAME/common
- --extra-cflags=-DCONFIG_QEMU_DATAPATH='"/snap/$SNAPCRAFT_PROJECT_NAME/current/share/qemu:/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/share/seabios:/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/lib/ipxe/qemu"'
- --disable-user
- --disable-linux-user
- --enable-system
- --target-list=x86_64-softmmu
override-build: |
wget http://archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu_2.5+dfsg.orig.tar.xz
wget http://archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu_2.5+dfsg-5ubuntu10.32.debian.tar.xz
wget http://archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu_2.5+dfsg-5ubuntu10.32.dsc
dpkg-source -x qemu_*.dsc
snapcraftctl build
organize:
usr/lib/*/pulseaudio/libpulsecommon-8.0.so: usr/lib/libpulsecommon-8.0.so
usr/share/seabios/bios-256k.bin: qemu/bios-256k.bin
usr/share/seabios/vgabios-stdvga.bin: qemu/vgabios-stdvga.bin
usr/share/seabios/kvmvapic.bin: qemu/kvmvapic.bin
usr/lib/ipxe/qemu/efi-virtio.rom: qemu/efi-virtio.rom
# Hack to shift installed qemu back to root of snap
# required to ensure that pathing to files etc works at
# runtime
# * is not used to avoid directory merge conflicts
snap/microstack/current/: ./
kvm-support:
plugin: nil
@ -593,6 +613,8 @@ parts:
stage-packages:
- dmidecode
- dnsmasq
- dnsmasq-utils
- ebtables
- libxml2
- libyajl2
- try: [libnuma1]
@ -622,6 +644,8 @@ parts:
- --sysconfdir=/var/snap/$SNAPCRAFT_PROJECT_NAME/common
- DNSMASQ=/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/sbin/dnsmasq
- DMIDECODE=/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/sbin/dmidecode
- OVSVSCTL=/snap/$SNAPCRAFT_PROJECT_NAME/current/bin/ovs-vsctl
- EBTABLES_PATH=/snap/$SNAPCRAFT_PROJECT_NAME/current/sbin/ebtables
override-build: |
wget http://archive.ubuntu.com/ubuntu/pool/main/libv/libvirt/libvirt_1.3.1.orig.tar.gz
wget http://archive.ubuntu.com/ubuntu/pool/main/libv/libvirt/libvirt_1.3.1-1ubuntu10.24.debian.tar.xz
@ -635,11 +659,18 @@ parts:
# * is not used to avoid directory merge conflicts
snap/microstack/current/: ./
libvirtd-wrapper:
source: ./snap-wrappers/libvirtd
plugin: dump
after:
- libvirt
organize:
launch-libvirtd: bin/launch-libvirtd
# MySQL
mysql-server:
plugin: dump
source: ./scripts/mysql
source: ./snap-wrappers/mysql
stage-packages:
- mysql-server
- mysql-client
@ -649,7 +680,7 @@ parts:
# RabbitMQ
rabbitmq-server:
source: ./scripts/rabbitmq
source: ./snap-wrappers/rabbitmq
plugin: dump
stage-packages:
- rabbitmq-server
@ -664,7 +695,7 @@ parts:
rabbitmq-defaults: usr/lib/rabbitmq/lib/rabbitmq_server-3.5.7/sbin/rabbitmq-defaults
erl: usr/bin/erl
# Memcached
# Memcached Token Caching
memcached:
plugin: autotools
source: https://memcached.org/files/memcached-1.5.10.tar.gz
@ -677,82 +708,50 @@ parts:
make
make install
# Cinder
# Cinder LVM backend
lvm2:
source: http://www.sourceware.org/pub/lvm2/releases/LVM2.2.02.172.tgz
plugin: autotools
configflags:
- --with-confdir=/var/snap/common/etc/
- --with-default-system-dir=/var/snap/common/etc/
- --with-confdir=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/etc/
- --with-default-system-dir=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/etc/
build-attributes: [no-patchelf]
cinder:
after: [keystone]
plugin: python
python-version: python2
source: http://tarballs.openstack.org/cinder/cinder-stable-rocky.tar.gz
python-packages:
- python-memcached
- pymysql
- uwsgi
- git+https://github.com/openstack/snap.openstack#egg=snap.openstack
constraints: https://raw.githubusercontent.com/openstack/requirements/stable/rocky/upper-constraints.txt
# Misc utils for hypervisor networking
bridge-utils:
source: https://www.kernel.org/pub/linux/utils/net/bridge-utils/bridge-utils-1.6.tar.gz
plugin: autotools
iproute2:
source: https://www.kernel.org/pub/linux/utils/net/iproute2/iproute2-4.9.0.tar.gz
plugin: autotools
build-packages:
- gcc
- libffi-dev
- libssl-dev
- libxml2-dev
- libxslt1-dev
cinder-config:
after: [cinder]
- bison
- flex
- libdb5.3-dev
iptables:
source: http://iptables.netfilter.org/projects/iptables/files/iptables-1.6.0.tar.bz2
plugin: autotools
build-packages:
- libnftnl-dev
configflags:
- --disable-nftables
install: |
cp --remove-destination $SNAPCRAFT_PART_INSTALL/sbin/xtables-multi $SNAPCRAFT_PART_INSTALL/bin/iptables-xml
ipset:
source: http://ipset.netfilter.org/ipset-6.30.tar.bz2
plugin: autotools
build-packages:
- libltdl-dev
- libmnl-dev
configflags:
- "--with-kmod=no"
# Openstack Shared Parts
overlay:
plugin: dump
source: http://tarballs.openstack.org/cinder/cinder-stable-rocky.tar.gz
organize:
etc/*.conf: etc/cinder/
etc/*.ini: etc/cinder/
etc/*.json: etc/cinder/
etc/*.templates: etc/cinder/
filesets:
etc:
- etc/cinder/*.conf
- etc/cinder/*.ini
- etc/cinder/*.json
- etc/cinder/*.templates
stage: [$etc]
prime: [$etc]
source: snap-overlay
# Horizon
horizon:
after: [keystone]
plugin: python
python-version: python2
source: http://tarballs.openstack.org/horizon/horizon-stable-rocky.tar.gz
python-packages:
- uwsgi
- git+https://github.com/openstack/snap.openstack#egg=snap.openstack
constraints: https://raw.githubusercontent.com/openstack/requirements/stable/rocky/upper-constraints.txt
build-packages:
- gcc
- libffi-dev
- libssl-dev
- libxml2-dev
- libxslt1-dev
horizon-config:
after: [horizon]
configure-the-things:
plugin: dump
source: http://tarballs.openstack.org/horizon/horizon-stable-rocky.tar.gz
organize:
etc/*.conf: etc/horizon/
filesets:
etc:
- etc/horizon/*.conf
stage: [$etc]
prime: [$etc]
source: src/experiments
# Openstackclient
python-openstackclient:
after: [keystone]
plugin: python
python-version: python2
python-packages:
- python-openstackclient==3.15.0
constraints: https://raw.githubusercontent.com/openstack/requirements/stable/rocky/upper-constraints.txt

34
stage_binaries.sh

@ -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…
Cancel
Save