Retire training-labs: remove repo content
As there is no maintainer for training-labs and it is decided to retire[1]. Depends-On: https://review.opendev.org/c/openstack/project-config/+/817502 [1] http://lists.openstack.org/pipermail/openstack-discuss/2021-October/025586.html Change-Id: I02ef4109509b4a6b87979aedca367ca7f9dabc10
This commit is contained in:
parent
2585b12b87
commit
e78d74f105
72
.gitignore
vendored
72
.gitignore
vendored
@ -1,72 +0,0 @@
|
||||
*.py[cod]
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist
|
||||
build
|
||||
.eggs
|
||||
eggs
|
||||
parts
|
||||
bin
|
||||
var
|
||||
sdist
|
||||
develop-eggs
|
||||
.installed.cfg
|
||||
.DS_Store
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
nosetests.xml
|
||||
.testrepository
|
||||
.venv
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
|
||||
# Mr Developer
|
||||
.mr.developer.cfg
|
||||
.project
|
||||
.pydevproject
|
||||
|
||||
# Complexity
|
||||
output/*.html
|
||||
output/*/index.html
|
||||
|
||||
# Sphinx
|
||||
doc/build
|
||||
|
||||
# pbr generates these
|
||||
AUTHORS
|
||||
ChangeLog
|
||||
|
||||
# Editors
|
||||
*~
|
||||
.*.swp
|
||||
.*sw?
|
||||
|
||||
# Others
|
||||
*.log
|
||||
*.sqlite
|
||||
tenvironment
|
||||
.ropeproject/
|
||||
|
||||
# Labs artifacts
|
||||
labs/osbash/autostart/
|
||||
labs/osbash/img/
|
||||
labs/osbash/log/
|
||||
labs/osbash/wbatch/
|
||||
labs/osbash/lib/vagrant-ssh-keys/
|
||||
labs/osbash/test_tmp/
|
||||
|
||||
labs/autostart/
|
||||
labs/img/
|
||||
labs/log/
|
||||
labs/wbatch/
|
17
.zuul.yaml
17
.zuul.yaml
@ -1,17 +0,0 @@
|
||||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- training-labs-scripts
|
||||
gate:
|
||||
jobs:
|
||||
- training-labs-scripts
|
||||
|
||||
post:
|
||||
jobs:
|
||||
- publish-training-labs-scripts
|
||||
- job:
|
||||
name: training-labs-scripts
|
||||
description: |
|
||||
Build scripts for training-labs repository.
|
||||
parent: unittests
|
||||
run: playbooks/scripts/run.yaml
|
@ -1,17 +0,0 @@
|
||||
If you would like to contribute to the development of OpenStack, you must
|
||||
follow the steps in this page:
|
||||
|
||||
http://docs.openstack.org/infra/manual/developers.html
|
||||
|
||||
If you already have a good understanding of how the system works and your
|
||||
OpenStack accounts are set up, you can skip to the development workflow
|
||||
section of this documentation to learn how changes to OpenStack should be
|
||||
submitted for review via the Gerrit tool:
|
||||
|
||||
http://docs.openstack.org/infra/manual/developers.html#development-workflow
|
||||
|
||||
Pull requests submitted through GitHub will be ignored.
|
||||
|
||||
Bugs should be filed on Launchpad, not GitHub:
|
||||
|
||||
https://bugs.launchpad.net/labs
|
134
HACKING.rst
134
HACKING.rst
@ -1,134 +0,0 @@
|
||||
Contributing to replace-labs scripts
|
||||
====================================
|
||||
|
||||
First things first
|
||||
------------------
|
||||
|
||||
Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest/
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
Contributing code to replace labs scripts follows the usual OpenStack process
|
||||
as described in `How To Contribute`__ in the OpenStack wiki.
|
||||
Our `main blueprint`__ contains the usual links for blueprints, bugs, etc.
|
||||
|
||||
__ contribute_
|
||||
.. _contribute: http://docs.openstack.org/infra/manual/developers.html
|
||||
|
||||
__ spec_
|
||||
.. _spec: http://specs.openstack.org/openstack/docs-specs/specs/liberty/traininglabs.html
|
||||
|
||||
Getting started
|
||||
---------------
|
||||
|
||||
.. TODO(psalunke): Fix Me. Add more content here.
|
||||
|
||||
Prerequisites
|
||||
-------------
|
||||
|
||||
.. TODO(psalunke): Fix Me. Add more content here.
|
||||
|
||||
Coding style
|
||||
------------
|
||||
|
||||
We follow the conventions of other OpenStack projects.
|
||||
|
||||
StackTrain
|
||||
~~~~~~~~~~
|
||||
|
||||
.. TODO(psalunke): Fix me. Add more content here.
|
||||
|
||||
Osbash
|
||||
~~~~~~
|
||||
|
||||
Osbash is written in BASH and follows conventions of DevStack:
|
||||
`devstack <https://docs.openstack.org/devstack/latest/>`_.
|
||||
|
||||
DevStack bash style guidelines can be found at the bottom of:
|
||||
https://opendev.org/openstack/devstack/src/branch/master/HACKING.rst
|
||||
|
||||
Structure
|
||||
---------
|
||||
|
||||
|
||||
.. TODO(psalunke): Add more information as the repo gets merged.
|
||||
|
||||
OSBASH:
|
||||
~~~~~~~
|
||||
|
||||
**autostart**
|
||||
|
||||
osbash/wbatch copy shell scripts (\*.sh) into this directory to have them
|
||||
automatically executed (and removed) upon boot.
|
||||
|
||||
**config**
|
||||
|
||||
Contains the configuration files for all the scripts. The setup can be customized here.
|
||||
|
||||
**img**
|
||||
|
||||
By default osbash will put into this directory its base disk images
|
||||
(base-\*-<distro>.vdi), the VM export images (labs-<distro>.ova),
|
||||
and all installation ISO images it may download.
|
||||
|
||||
**lib**
|
||||
|
||||
This directory contains bash libraries used by scripts.
|
||||
|
||||
**log**
|
||||
|
||||
Contains the log files written (and removed) by osbash/wbatch and
|
||||
the scripts running within the VMs.
|
||||
|
||||
**scripts**
|
||||
|
||||
All scripts in this directory run within the VMs.
|
||||
|
||||
**wbatch**
|
||||
|
||||
Files in this directory are Windows batch files generated by osbash to
|
||||
configure host-only networks, produce a base disk, and build OpenStack
|
||||
replace-labs VMs as configured when osbash created them.
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
Useful tools for checking scripts:
|
||||
|
||||
- `bashate <https://github.com/openstack-dev/bashate>`_ (must pass)
|
||||
- `shellcheck <https://github.com/koalaman/shellcheck.git>`_ (optional)
|
||||
|
||||
.. TODO (psalunke): Add Python checks etc.
|
||||
|
||||
Submitting patches
|
||||
------------------
|
||||
|
||||
These documents will help you submit patches to OpenStack projects (including
|
||||
this one):
|
||||
|
||||
- https://docs.openstack.org/infra/manual/developers.html#development-workflow
|
||||
- https://wiki.openstack.org/wiki/GitCommitMessages
|
||||
|
||||
If you change the behavior of the scripts as documented in the replace-guides,
|
||||
add a DocImpact flag to alert the documentation team. For instance, add a line
|
||||
like this to your commit message:
|
||||
|
||||
DocImpact new option added to osbash.sh
|
||||
|
||||
- https://wiki.openstack.org/wiki/Documentation/DocImpact
|
||||
|
||||
Reviewing
|
||||
---------
|
||||
|
||||
Learn how to review (or what to expect when having your patches reviewed) here:
|
||||
- https://docs.openstack.org/infra/manual/developers.html#development-workflow
|
||||
|
||||
TODO
|
||||
----
|
||||
|
||||
Anything not covered here
|
||||
-------------------------
|
||||
|
||||
Check README.md and get in touch with other scripts developers.
|
||||
|
175
LICENSE
175
LICENSE
@ -1,175 +0,0 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
217
README.rst
217
README.rst
@ -1,209 +1,14 @@
|
||||
========================
|
||||
Team and repository tags
|
||||
========================
|
||||
This project is no longer maintained.
|
||||
|
||||
.. image:: https://governance.openstack.org/tc/badges/training-labs.svg
|
||||
:target: https://governance.openstack.org/tc/reference/tags/index.html
|
||||
The contents of this repository are still available in the Git
|
||||
source code management system. To see the contents of this
|
||||
repository before it reached its end of life, please check out the
|
||||
previous commit with "git checkout HEAD^1".
|
||||
|
||||
.. Change things from this point on
|
||||
(Optional:)
|
||||
For an alternative project, please see <alternative project name> at
|
||||
<alternative project URL>.
|
||||
|
||||
=============
|
||||
Training labs
|
||||
=============
|
||||
|
||||
About
|
||||
-----
|
||||
|
||||
Training-labs provides an automated way to deploy Vanilla OpenStack, closely
|
||||
following the
|
||||
`OpenStack Install Guide <https://docs.openstack.org/install-guide>`_.
|
||||
|
||||
Training-labs offers an easy way to set up an OpenStack cluster which is a good
|
||||
starting point for beginners to learn OpenStack, and for advanced users to test
|
||||
out new features, and check out different capabilities of OpenStack.
|
||||
|
||||
On top of that training-labs is also a good way to test the installation
|
||||
instructions on a regular basis.
|
||||
|
||||
Training-labs is a project under OpenStack Documentation. For more information
|
||||
see the
|
||||
`OpenStack wiki <https://wiki.openstack.org/wiki/Documentation/training-labs>`_.
|
||||
|
||||
* Free software: Apache license
|
||||
* `Documentation:openstack-training-labs <https://docs.openstack.org/training_labs/>`_
|
||||
* `Source:openstack/training-labs <https://opendev.org/openstack/training-labs>`_
|
||||
* `Bugs:openstack-training-labs <https://bugs.launchpad.net/labs>`_
|
||||
* `Release Notes:openstack-training-labs <https://docs.openstack.org/releasenotes/openstack-manuals/>`_
|
||||
|
||||
Pre-requisite
|
||||
-------------
|
||||
|
||||
* Download and install `VirtualBox <https://www.virtualbox.org/wiki/Downloads>`_.
|
||||
|
||||
VirtualBox is the default hypervisor used by training-labs. Alternatively, you can use KVM (just set ``PROVIDER=kvm`` in ``labs/config/localrc``).
|
||||
|
||||
|
||||
Getting the Code for an OpenStack Release
|
||||
-----------------------------------------
|
||||
|
||||
The current release is master which usually deploys the current stable
|
||||
OpenStack release. Unless you have a reason to go with an older release,
|
||||
we recommend using master.
|
||||
|
||||
For non-development purposes (training, etc.), the easiest way to get the code is through downloading the desired archive from
|
||||
`OpenStack Training Labs <https://docs.openstack.org/training_labs/>`_.
|
||||
Unpack the archive and you are good to go.
|
||||
|
||||
How to run the scripts for GNU/Linux and macOS
|
||||
----------------------------------------------
|
||||
|
||||
Change directory::
|
||||
|
||||
$ cd training-labs/labs/
|
||||
|
||||
By default, the cluster is built on Virtualbox VMs.
|
||||
|
||||
Run the script by::
|
||||
|
||||
$ ./st.py -b cluster
|
||||
|
||||
How to run the scripts for Windows
|
||||
----------------------------------
|
||||
|
||||
The easiest and recommended way to get everything you need besides
|
||||
VirtualBox is to download a zip file for Windows from the
|
||||
`Training Labs page <https://docs.openstack.org/training_labs/>`_.
|
||||
|
||||
The zip files include pre-generated Windows batch files.
|
||||
|
||||
Creates the host-only networks used by the node VMs to communicate::
|
||||
|
||||
> create_hostnet.bat
|
||||
|
||||
Creates the base disk::
|
||||
|
||||
> create_base.bat
|
||||
|
||||
Creates the node VMs based on the base disk::
|
||||
|
||||
> create_ubuntu_cluster_node.bat
|
||||
|
||||
What the script installs
|
||||
------------------------
|
||||
|
||||
Running this will automatically spin up 2 virtual machines in VirtualBox/KVM:
|
||||
|
||||
* Controller node
|
||||
* Compute node
|
||||
|
||||
Now you have a multi-node deployment of OpenStack running with the following services installed.
|
||||
|
||||
* Keystone
|
||||
* Nova
|
||||
* Neutron
|
||||
* Glance
|
||||
* Cinder
|
||||
* Horizon
|
||||
|
||||
How to access the services
|
||||
--------------------------
|
||||
|
||||
There are two ways to access the services:
|
||||
|
||||
* OpenStack Dashboard (horizon)
|
||||
|
||||
You can access the dashboard at: http://10.0.0.11/horizon
|
||||
|
||||
Admin Login:
|
||||
|
||||
* Username: ``admin``
|
||||
* Password: ``admin_pass``
|
||||
|
||||
Demo User Login:
|
||||
|
||||
* Username: ``demo``
|
||||
* Password: ``demo_pass``
|
||||
|
||||
You can ssh to each of the nodes by::
|
||||
|
||||
# Controller node
|
||||
$ ssh osbash@10.0.0.11
|
||||
|
||||
# Compute node
|
||||
$ ssh osbash@10.0.0.31
|
||||
|
||||
Credentials for all nodes:
|
||||
|
||||
* Username: ``osbash``
|
||||
* Password: ``osbash``
|
||||
|
||||
After you have ssh access, you need to source the OpenStack credentials in order to access the services.
|
||||
|
||||
Two credential files are present on each of the nodes:
|
||||
|
||||
* ``demo-openstackrc.sh``
|
||||
* ``admin-openstackrc.sh``
|
||||
|
||||
Source the following credential files
|
||||
|
||||
For Admin user privileges::
|
||||
|
||||
$ source admin-openstackrc.sh
|
||||
|
||||
For Demo user privileges::
|
||||
|
||||
$ source demo-openstackrc.sh
|
||||
|
||||
Note: Instead 'source' you can use '.', or you define an alias.
|
||||
Now you can access the OpenStack services via CLI.
|
||||
|
||||
Specs
|
||||
-----
|
||||
|
||||
To review specifications, see `Training-labs
|
||||
<https://specs.openstack.org/openstack/docs-specs/specs/liberty/training-labs.html>`_
|
||||
|
||||
Mailing lists, IRC
|
||||
------------------
|
||||
|
||||
To contribute, join the IRC channel, ``#openstack-doc``, on IRC freenode
|
||||
or write an e-mail to the OpenStack Development Mailing List
|
||||
``openstack-discuss@lists.openstack.org``. Please use ``[training-labs]`` tag in the
|
||||
subject of the email message.
|
||||
|
||||
You may have to
|
||||
`subscribe to the OpenStack Development Mailing List <http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-discuss>`_
|
||||
to have your mail accepted by the mailing list software.
|
||||
|
||||
Sub-team leads
|
||||
--------------
|
||||
|
||||
Feel free to ping Roger, Julen, or Pranav via email or on the IRC channel
|
||||
``#openstack-doc`` regarding any queries about training-labs.
|
||||
|
||||
* Roger Luethi
|
||||
|
||||
* Email: ``rl@patchworkscience.org``
|
||||
* IRC: ``rluethi``
|
||||
|
||||
* Pranav Salunke
|
||||
|
||||
* Email: ``dguitarbite@gmail.com``
|
||||
* IRC: ``dguitarbite``
|
||||
|
||||
* Julen Larrucea
|
||||
|
||||
* Email: ``julen@larrucea.eu``
|
||||
* IRC: julen, julenl
|
||||
|
||||
Meetings
|
||||
--------
|
||||
|
||||
Training-labs uses the Doc Team Meeting:
|
||||
https://wiki.openstack.org/wiki/Meetings/DocTeamMeeting
|
||||
|
||||
Wiki
|
||||
----
|
||||
|
||||
Follow various links on training-labs here:
|
||||
https://wiki.openstack.org/wiki/Documentation/training-labs
|
||||
For any further questions, please email
|
||||
openstack-discuss@lists.openstack.org or join #openstack-dev on
|
||||
OFTC.
|
||||
|
64
bindep.txt
64
bindep.txt
@ -1,64 +0,0 @@
|
||||
# Edit this one. Remove all the non-required deps.
|
||||
|
||||
asciidoc
|
||||
build-essential [platform:dpkg]
|
||||
curl
|
||||
gawk
|
||||
# gettext and graphviz are needed by doc builds only. For transition,
|
||||
# have them in both doc and test.
|
||||
gettext [doc test]
|
||||
graphviz [doc test]
|
||||
language-pack-en [platform:ubuntu]
|
||||
libcurl-devel [platform:rpm]
|
||||
libcurl4-gnutls-dev [platform:dpkg]
|
||||
liberasurecode-dev [platform:dpkg]
|
||||
liberasurecode-devel [platform:rpm]
|
||||
libevent-dev [platform:dpkg]
|
||||
libevent-devel [platform:rpm]
|
||||
libffi-dev [platform:dpkg]
|
||||
libffi-devel [platform:rpm]
|
||||
libjerasure-dev [platform:ubuntu-trusty]
|
||||
libjpeg-dev [platform:dpkg]
|
||||
libjpeg-turbo-devel [platform:rpm]
|
||||
libldap2-dev [platform:dpkg]
|
||||
libmysqlclient-dev [platform:dpkg]
|
||||
libpcap-dev [platform:dpkg]
|
||||
libpcap-devel [platform:rpm]
|
||||
libpq-dev [platform:dpkg]
|
||||
librrd-dev [platform:dpkg]
|
||||
libsasl2-dev [platform:dpkg]
|
||||
libselinux-python [platform:rpm]
|
||||
libsqlite3-dev [platform:dpkg]
|
||||
libuuid-devel [platform:rpm]
|
||||
libvirt-dev [platform:dpkg]
|
||||
libvirt-devel [platform:rpm]
|
||||
libvirt-python [platform:rpm]
|
||||
libxml2-dev [platform:dpkg]
|
||||
libxml2-devel [platform:rpm]
|
||||
libxml2-utils [platform:dpkg]
|
||||
libxslt-devel [platform:rpm]
|
||||
libxslt1-dev [platform:dpkg]
|
||||
locales [platform:debian]
|
||||
pkg-config [platform:dpkg]
|
||||
pkgconfig [platform:rpm]
|
||||
pypy [platform:ubuntu-trusty]
|
||||
pypy-dev [platform:ubuntu-trusty]
|
||||
python-dev [platform:dpkg]
|
||||
python-devel [platform:rpm]
|
||||
python-libvirt [platform:dpkg]
|
||||
python-lxml
|
||||
python-zmq
|
||||
python3-all-dev [platform:ubuntu-trusty]
|
||||
python3-dev [platform:dpkg]
|
||||
python3-devel [platform:fedora]
|
||||
python3.4 [platform:ubuntu-trusty]
|
||||
python34-devel [platform:centos]
|
||||
sqlite [platform:rpm]
|
||||
sqlite-devel [platform:rpm]
|
||||
sqlite3 [platform:dpkg]
|
||||
unzip
|
||||
uuid-dev [platform:dpkg]
|
||||
xsltproc [platform:dpkg]
|
||||
zip
|
||||
zlib-devel [platform:rpm]
|
||||
zlib1g-dev [platform:dpkg]
|
@ -1,5 +0,0 @@
|
||||
Documentation for training-labs
|
||||
===============================
|
||||
|
||||
See the "Building the Dcumenation" section of
|
||||
doc/source/development.environment.rst.
|
@ -1,7 +0,0 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2 # BSD
|
||||
sphinx-testing # BSD
|
||||
openstackdocstheme>=1.31.2 # Apache-2.0
|
@ -1,34 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# -- General configuration ----------------------------------------------------
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'openstackdocs'
|
||||
]
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'OpenStack Training Labs'
|
||||
copyright = u'2013, OpenStack Foundation'
|
||||
|
||||
|
||||
# -- Options for HTML output --------------------------------------------------
|
||||
|
||||
html_theme = 'openstackdocs'
|
@ -1,4 +0,0 @@
|
||||
============
|
||||
Contributing
|
||||
============
|
||||
.. include:: ../../CONTRIBUTING.rst
|
@ -1,25 +0,0 @@
|
||||
.. labs documentation master file, created by
|
||||
sphinx-quickstart on Tue Jul 9 22:26:36 2013.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to labs's documentation!
|
||||
========================================================
|
||||
|
||||
Contents:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
readme
|
||||
installation
|
||||
usage
|
||||
contributing
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
|
@ -1,11 +0,0 @@
|
||||
============
|
||||
Installation
|
||||
============
|
||||
|
||||
At the command line::
|
||||
|
||||
$ git clone https://git.openstack.org/openstack/training-labs
|
||||
$ cd training-labs/labs
|
||||
$ ./st.py -h
|
||||
|
||||
Make sure that you have VirtualBox installed on your system.
|
@ -1,5 +0,0 @@
|
||||
========
|
||||
Usage
|
||||
========
|
||||
|
||||
|
@ -1,55 +0,0 @@
|
||||
# The format of this file isn't really documented; just use --generate-rcfile
|
||||
[MASTER]
|
||||
# Add <file or directory> to the black list. It should be a base name, not a
|
||||
# path. You may set this option multiple times.
|
||||
ignore=.git,tests
|
||||
|
||||
[Messages Control]
|
||||
# NOTE(justinsb): We might want to have a 2nd strict pylintrc in future
|
||||
# C0111: Don't require docstrings on every method
|
||||
# W0511: TODOs in code comments are fine.
|
||||
# W0142: *args and **kwargs are fine.
|
||||
# W0622: Redefining id is fine.
|
||||
disable=C0111,W0511,W0142,W0622
|
||||
|
||||
[Basic]
|
||||
# Variable names can be 1 to 31 characters long, with lowercase and underscores
|
||||
variable-rgx=[a-z_][a-z0-9_]{0,30}$
|
||||
|
||||
# Argument names can be 2 to 31 characters long, with lowercase and underscores
|
||||
argument-rgx=[a-z_][a-z0-9_]{1,30}$
|
||||
|
||||
# Method names should be at least 3 characters long
|
||||
# and be lowercased with underscores
|
||||
method-rgx=([a-z_][a-z0-9_]{2,50}|setUp|tearDown)$
|
||||
|
||||
# Module names
|
||||
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||
|
||||
# Don't require docstrings on tests.
|
||||
no-docstring-rgx=((__.*__)|([tT]est.*)|setUp|tearDown)$
|
||||
|
||||
[Miscellaneous]
|
||||
|
||||
# List of note tags to take in consideration, separated by a comma.
|
||||
notes=FIXME
|
||||
|
||||
[Format]
|
||||
# Maximum number of characters on a single line.
|
||||
max-line-length=79
|
||||
|
||||
[Design]
|
||||
max-public-methods=100
|
||||
min-public-methods=0
|
||||
max-args=6
|
||||
|
||||
[Variables]
|
||||
|
||||
# List of additional names supposed to be defined in builtins. Remember that
|
||||
# you should avoid to define new builtins when possible.
|
||||
# _ is used by our localization
|
||||
additional-builtins=_
|
||||
|
||||
[REPORTS]
|
||||
# Tells whether to display a full report or only the messages
|
||||
reports=no
|
@ -1 +0,0 @@
|
||||
osbash/autostart
|
@ -1 +0,0 @@
|
||||
osbash/config
|
@ -1,2 +0,0 @@
|
||||
osbash/wbatch copy shell scripts (*.sh) into this directory to have them
|
||||
automatically executed (and removed) upon boot.
|
@ -1,2 +0,0 @@
|
||||
The configuration files in this directory are used by osbash/wbatch and
|
||||
by scripts running inside the VMs (scripts directory).
|
@ -1,21 +0,0 @@
|
||||
# The variables in this file are exported for use by OpenStack client
|
||||
# applications.
|
||||
|
||||
# Use BASH_SOURCE so the file works when sourced from a shell, too; use
|
||||
# $0 to make it work on zsh
|
||||
CONFIG_DIR=$(dirname "${BASH_SOURCE[0]:-$0}")
|
||||
source "$CONFIG_DIR/openstack"
|
||||
source "$CONFIG_DIR/credentials"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# OpenStack client environment scripts
|
||||
# https://docs.openstack.org/keystone/train/install/keystone-openrc-ubuntu.html
|
||||
#------------------------------------------------------------------------------
|
||||
export OS_USERNAME=$ADMIN_USER_NAME
|
||||
export OS_PASSWORD=$ADMIN_PASS
|
||||
export OS_PROJECT_NAME=$ADMIN_PROJECT_NAME
|
||||
export OS_USER_DOMAIN_NAME=Default
|
||||
export OS_PROJECT_DOMAIN_NAME=Default
|
||||
export OS_AUTH_URL=http://controller:5000/v3
|
||||
export OS_IDENTITY_API_VERSION=3
|
||||
export OS_IMAGE_API_VERSION=2
|
@ -1,7 +0,0 @@
|
||||
# Base disk VM configuration. Used by osbash/wbatch (host and guest).
|
||||
|
||||
# Port forwarding
|
||||
VM_SSH_PORT=2229
|
||||
|
||||
# Our default RAM size (512 MB) is not sufficient for installation
|
||||
VM_MEM=1024
|
@ -1,32 +0,0 @@
|
||||
# Node VM configuration. Used by osbash/wbatch (host and guest).
|
||||
|
||||
# Port forwarding
|
||||
# ssh access to compute1: 127.0.0.1:2232
|
||||
VM_SSH_PORT=2232
|
||||
|
||||
# Assign network interfaces to networks
|
||||
NET_IF_0=dhcp
|
||||
#------------------------------------------------------------------------------
|
||||
# http://docs.openstack.org/mitaka/install-guide-ubuntu/environment-networking-compute.html
|
||||
#------------------------------------------------------------------------------
|
||||
# Mgmt network (elevate interface boot priority to 1; set when PXE booting)
|
||||
NET_IF_1="static 10.0.0.31 1"
|
||||
# Public network (select network, IP address configured manually)
|
||||
NET_IF_2="manual 203.0.113.0"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Size of second disk in MB (/dev/sdb)
|
||||
# Test volume is 1 GB; backing volume must be bigger
|
||||
SECOND_DISK_SIZE=1280
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# http://docs.openstack.org/mitaka/install-guide-ubuntu/environment.html
|
||||
#------------------------------------------------------------------------------
|
||||
# Controller node is running many services.
|
||||
# A default instance within compute uses 512 MB RAM. The install-guide
|
||||
# demands 2048 MB of RAM, but 1024 MB is enough for one CirrOS instance.
|
||||
VM_MEM=1024
|
||||
|
||||
# Override number of virtual CPUs (default is 1)
|
||||
# To edit uncomment the line below
|
||||
# VM_CPUS=1
|
@ -1,27 +0,0 @@
|
||||
# Node VM configuration. Used by osbash/wbatch (host and guest).
|
||||
|
||||
# Port forwarding
|
||||
# ssh access to controller: 127.0.0.1:2230
|
||||
VM_SSH_PORT=2230
|
||||
# Dashboard access: 127.0.0.1:8888
|
||||
VM_WWW_PORT=8888
|
||||
|
||||
# Assign network interfaces to networks
|
||||
NET_IF_0=dhcp
|
||||
#------------------------------------------------------------------------------
|
||||
# http://docs.openstack.org/mitaka/install-guide-ubuntu/environment-networking-controller.html
|
||||
#------------------------------------------------------------------------------
|
||||
# Mgmt network (elevate interface boot priority to 1; set when PXE booting)
|
||||
NET_IF_1="static 10.0.0.11 1"
|
||||
# Public network (select network, IP address configured manually)
|
||||
NET_IF_2="manual 203.0.113.0"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# http://docs.openstack.org/mitaka/install-guide-ubuntu/environment.html
|
||||
#------------------------------------------------------------------------------
|
||||
# Controller node is running many services.
|
||||
VM_MEM=5120
|
||||
|
||||
# Override number of virtual CPUs (default is 1)
|
||||
# To edit uncomment the line below
|
||||
# VM_CPUS=1
|
@ -1,14 +0,0 @@
|
||||
# Node VM configuration. Used by osbash/wbatch (host and guest).
|
||||
|
||||
# Port forwarding
|
||||
# ssh access to controller: 127.0.0.1:2250
|
||||
VM_SSH_PORT=2250
|
||||
|
||||
# Assign network interfaces to networks
|
||||
NET_IF_0=dhcp
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Mgmt network
|
||||
NET_IF_1="static 10.0.0.100"
|
||||
|
||||
PXE_GATEWAY="10.0.0.101"
|
@ -1,81 +0,0 @@
|
||||
# This file contains user names, passwords, and tokens that are set and used
|
||||
# by OpenStack applications and related software running in the VMs.
|
||||
|
||||
# Note that the VM shell user and its password are not set here. By default,
|
||||
# those are hard-coded in the preseed/kickstart files. The scripts get the
|
||||
# shell user name from deploy.{osbash} and don't need a password
|
||||
# (they use password-less sudo and -- if configured -- ssh keys).
|
||||
|
||||
# Used for MySQL or whatever other DBMS is configured
|
||||
: ${DATABASE_PASSWORD:=secrete}
|
||||
|
||||
# Used for MySQL or whatever other DBMS is configured
|
||||
: ${RABBIT_PASS:=rabbitPass}
|
||||
|
||||
# Project and role for admin accounts
|
||||
: ${ADMIN_ROLE_NAME:=admin}
|
||||
: ${ADMIN_PROJECT_NAME:=admin}
|
||||
|
||||
# Member role for generic use
|
||||
: ${MEMBER_ROLE_NAME:=_member_}
|
||||
|
||||
# User name and password for administrator
|
||||
: ${ADMIN_USER_NAME:=admin}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Passwords for OpenStack services
|
||||
# http://docs.openstack.org/mitaka/install-guide-ubuntu/environment-security.html
|
||||
#------------------------------------------------------------------------------
|
||||
: ${ADMIN_PASS:=admin_user_secret}
|
||||
|
||||
: ${CINDER_DB_USER:=cinder}
|
||||
: ${CINDER_DBPASS:=cinder_db_secret}
|
||||
: ${CINDER_PASS:=cinder_user_secret}
|
||||
|
||||
: ${GLANCE_DB_USER:=glance}
|
||||
: ${GLANCE_DBPASS:=glance_db_secret}
|
||||
: ${GLANCE_PASS:=glance_user_secret}
|
||||
|
||||
: ${HEAT_DB_USER:=heat}
|
||||
: ${HEAT_DBPASS:=heat_db_secret}
|
||||
: ${HEAT_DOMAIN_PASS:=heat_dom_pw}
|
||||
: ${HEAT_PASS:=heat_user_secret}
|
||||
|
||||
: ${KEYSTONE_DB_USER:=keystone}
|
||||
: ${KEYSTONE_DBPASS:=keystone_db_secret}
|
||||
|
||||
: ${NEUTRON_DB_USER:=neutron}
|
||||
: ${NEUTRON_DBPASS:=neutron_db_secret}
|
||||
: ${NEUTRON_PASS:=neutron_user_secret}
|
||||
|
||||
: ${NOVA_DB_USER:=nova}
|
||||
: ${NOVA_DBPASS:=nova_db_secret}
|
||||
: ${NOVA_PASS:=nova_user_secret}
|
||||
|
||||
: ${PLACEMENT_DB_USER:=placement}
|
||||
: ${PLACEMENT_DBPASS:=placement_db_secret}
|
||||
: ${PLACEMENT_PASS:=placement_user_secret}
|
||||
|
||||
# Project name, user name and password for normal (demo) user
|
||||
: ${DEMO_PROJECT_NAME:=myproject}
|
||||
: ${DEMO_USER_NAME:=myuser}
|
||||
: ${DEMO_PASS:=myuser_user_pass}
|
||||
|
||||
# User role
|
||||
: ${USER_ROLE_NAME:=myrole}
|
||||
|
||||
# OpenStack Services needs to be affiliated with a tenant to provide
|
||||
# authentication to other OpenStack services. We create a "service" tenant for
|
||||
# the OpenStack services. All the OpenStack services will be registered via
|
||||
# service tenant.
|
||||
|
||||
# Project and role for service accounts.
|
||||
: ${SERVICE_PROJECT_NAME:=service}
|
||||
|
||||
# Domain to use for email addresses (e.g. admin@example.com)
|
||||
: ${MAIL_DOMAIN:=example.com}
|
||||
|
||||
# Metadata secret used by neutron and nova.
|
||||
: ${METADATA_SECRET:=osbash_training}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,21 +0,0 @@
|
||||
# The variables in this file are exported for use by OpenStack client
|
||||
# applications.
|
||||
|
||||
# Use BASH_SOURCE so the file works when sourced from a shell, too; use
|
||||
# $0 to make it work on zsh
|
||||
CONFIG_DIR=$(dirname "${BASH_SOURCE[0]:-$0}")
|
||||
source "$CONFIG_DIR/openstack"
|
||||
source "$CONFIG_DIR/credentials"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# OpenStack client environment scripts
|
||||
# https://docs.openstack.org/keystone/train/install/keystone-openrc-ubuntu.html
|
||||
#------------------------------------------------------------------------------
|
||||
export OS_USERNAME=$DEMO_USER_NAME
|
||||
export OS_PASSWORD=$DEMO_PASS
|
||||
export OS_PROJECT_NAME=$DEMO_PROJECT_NAME
|
||||
export OS_USER_DOMAIN_NAME=Default
|
||||
export OS_PROJECT_DOMAIN_NAME=Default
|
||||
export OS_AUTH_URL=http://controller:5000/v3
|
||||
export OS_IDENTITY_API_VERSION=3
|
||||
export OS_IMAGE_API_VERSION=2
|
@ -1,17 +0,0 @@
|
||||
# Used by osbash.sh and guest scripts
|
||||
|
||||
: ${OSBASH_LIB_DIR:=$LIB_DIR/osbash}
|
||||
: ${OSBASH_SCRIPTS_DIR:=$SCRIPTS_DIR/osbash}
|
||||
|
||||
: ${TEMPLATE_DIR:=$LIB_DIR/osbash/templates}
|
||||
|
||||
# Name of VirtualBox shared folder
|
||||
: ${SHARE_NAME:=osbash}
|
||||
|
||||
# Note: shell user name and password are set in preseed.cfg
|
||||
VM_SHELL_USER=osbash
|
||||
|
||||
# Override disk size in MB (default is 10000 MB, inherited by node VMs)
|
||||
# BASE_DISK_SIZE=10000
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,17 +0,0 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# http://docs.openstack.org/mitaka/install-guide-ubuntu/environment-networking-controller.html
|
||||
#------------------------------------------------------------------------------
|
||||
# controller
|
||||
10.0.0.11 controller
|
||||
|
||||
# compute1
|
||||
10.0.0.31 compute1
|
||||
|
||||
# block1
|
||||
10.0.0.41 block1
|
||||
|
||||
# object1
|
||||
10.0.0.51 object1
|
||||
|
||||
# object2
|
||||
10.0.0.52 object2
|
@ -1,30 +0,0 @@
|
||||
# Set this if you already have the install ISO, but in a location other
|
||||
# than IMG_DIR (which defaults to TOP_DIR/img)
|
||||
#INSTALL_ISO=/data/iso/ubuntu/ubuntu-12.04.4-server-amd64.iso
|
||||
|
||||
# VM_PROXY will be used by osbash to get the ISO image and by apt/yum/wget once
|
||||
# the operating system is installed (i.e. for software updates and
|
||||
# installation). It should be sufficient to build a base disk if you have to
|
||||
# use a proxy to connect to the Internet. Building the cluster itself does not
|
||||
# require an Internet connection at all.
|
||||
#VM_PROXY="http://192.168.178.20:3128"
|
||||
|
||||
# Options:
|
||||
# ubuntu-18.04-server-amd64 (default)
|
||||
# ubuntu-18.04-server-i386
|
||||
# ubuntu-16.04-server-amd64
|
||||
# ubuntu-16.04-server-i386
|
||||
# ubuntu-14.04-server-amd64
|
||||
# ubuntu-14.04-server-i386
|
||||
#
|
||||
# example: DISTRO=ubuntu-18.04-server-i386
|
||||
: ${DISTRO:=ubuntu-18.04-server-amd64}
|
||||
|
||||
# PROVIDER: virtualbox or kvm (defaults to virtualbox)
|
||||
# KVM tends to give better performance (on Linux), but may be harder to set up
|
||||
# and osbash does not (yet) support all features with a KVM backend.
|
||||
#
|
||||
# example: PROVIDER=kvm
|
||||
: ${PROVIDER:=virtualbox}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,58 +0,0 @@
|
||||
# This file contains OpenStack configuration data. It is used by both
|
||||
# host (osbash, Windows batch) and VM guest scripts.
|
||||
|
||||
# train (production release; cloud-archive:train)
|
||||
# train-proposed (pre-release testing: cloud-archive:train-proposed)
|
||||
# train-staging (ppa:openstack-ubuntu-testing/train)
|
||||
: ${OPENSTACK_RELEASE:=train}
|
||||
|
||||
# CirrOS image URL
|
||||
if [ "$(uname -m)" = "x86_64" ]; then
|
||||
arch=x86_64
|
||||
else
|
||||
arch=i386
|
||||
fi
|
||||
CIRROS_URL="http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-$arch-disk.img"
|
||||
unset arch
|
||||
|
||||
# Name used for CirrOS image in glance
|
||||
CIRROS_IMG_NAME="cirros"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# https://docs.openstack.org/install-guide/environment-networking.html
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Networks used by OpenStack training-labs setup
|
||||
NETWORK_1="mgmt 10.0.0.0"
|
||||
NETWORK_2="provider 203.0.113.0"
|
||||
|
||||
# Static IP used temporarily by PXE booted machines before being reconfigured
|
||||
# by osbash
|
||||
PXE_INITIAL_NODE_IP="10.0.0.240"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# https://docs.openstack.org/install-guide/launch-instance-networks-provider.html
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Public network
|
||||
: ${PROVIDER_NETWORK_CIDR:=203.0.113.0/24}
|
||||
: ${PROVIDER_NETWORK_GATEWAY:=203.0.113.1}
|
||||
# Floating IP addresses
|
||||
: ${START_IP_ADDRESS:=203.0.113.101}
|
||||
: ${END_IP_ADDRESS:=203.0.113.200}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# https://docs.openstack.org/install-guide/launch-instance-selfservice.html
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Private demo network
|
||||
: ${SELFSERVICE_NETWORK_CIDR:=172.16.1.0/24}
|
||||
: ${SELFSERVICE_NETWORK_GATEWAY:=172.16.1.1}
|
||||
|
||||
# DNS name server used by instance VMs.
|
||||
# Default is Google Public DNS (8.8.4.4).
|
||||
: ${DNS_RESOLVER:=8.8.4.4}
|
||||
|
||||
: ${REGION:=RegionOne}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,33 +0,0 @@
|
||||
# This file is used by all scripts to find the directories for the files they
|
||||
# read or write. They find this file as "$TOP_DIR/config/paths".
|
||||
|
||||
# Configuration files
|
||||
: ${CONFIG_DIR:=$TOP_DIR/config}
|
||||
|
||||
# Installation ISO images, basedisk images, exported VM cluster images, etc.
|
||||
#
|
||||
# TODO(rluethi): merge these directories in the code, the option to have them
|
||||
# in separate directories doesn't seem very useful
|
||||
: ${DISK_DIR:=$TOP_DIR/img}
|
||||
: ${IMG_DIR:=$TOP_DIR/img}
|
||||
: ${ISO_DIR:=$TOP_DIR/img}
|
||||
|
||||
# Code libraries, templates, preseed/kickstart files
|
||||
: ${LIB_DIR:=$TOP_DIR/lib}
|
||||
|
||||
# Log files
|
||||
: ${LOG_DIR:=$TOP_DIR/log}
|
||||
|
||||
# Status files (progress indicator for running scripts)
|
||||
: ${STATUS_DIR:=$LOG_DIR/status}
|
||||
|
||||
# Scripts that run within the basedisk and node VMs
|
||||
: ${SCRIPTS_DIR:=$TOP_DIR/scripts}
|
||||
|
||||
# Directory shared with VM guest
|
||||
: ${SHARE_DIR:=$TOP_DIR}
|
||||
|
||||
# Autostart directory; files placed here are executed within the VM
|
||||
: ${AUTOSTART_DIR:=$SHARE_DIR/autostart}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,14 +0,0 @@
|
||||
# KVM specific settings; used by osbash
|
||||
|
||||
: ${KVM_VOL_POOL:=default}
|
||||
: ${LIBVIRT_CONNECT_URI:=qemu:///system}
|
||||
: ${VIRSH_CALL:=sudo virsh --connect=$LIBVIRT_CONNECT_URI}
|
||||
: ${VIRT_INSTALL_CALL:=sudo virt-install --connect=$LIBVIRT_CONNECT_URI}
|
||||
|
||||
# KVM VM group (stored in VM description)
|
||||
: ${VM_GROUP:=OpenStack training-labs}
|
||||
|
||||
# VM GUI type (one of headless, gui, vnc)
|
||||
: ${VM_UI:=vnc}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,21 +0,0 @@
|
||||
# VirtualBox specific settings; used by osbash
|
||||
|
||||
# Type of NIC to use for network interfaces, one of:
|
||||
# 82540EM for Intel PRO/1000 MT Desktop
|
||||
# 82543GC for Intel PRO/1000 T Server
|
||||
# 82545EM for Intel PRO/1000 MT Server
|
||||
# Am79C970A for PCnet-PCI II
|
||||
# Am79C973 for PCnet-FAST III
|
||||
# virtio for Paravirtualized network
|
||||
: ${NICTYPE:=virtio}
|
||||
|
||||
# Location of VBoxManage binary
|
||||
: ${VBM_EXE:=$(which VBoxManage)}
|
||||
|
||||
# VirtualBox VM group
|
||||
: ${VM_GROUP:=labs}
|
||||
|
||||
# VirtualBox VM GUI type
|
||||
: ${VM_UI:=headless}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,3 +0,0 @@
|
||||
# Scripts for CentOS installations
|
||||
cmd queue centos/yum_init.sh
|
||||
cmd queue centos/yum_update.sh
|
@ -1,6 +0,0 @@
|
||||
# Scripts for Ubuntu installations
|
||||
cmd queue ubuntu/apt_init.sh
|
||||
cmd queue ubuntu/apt_upgrade.sh
|
||||
cmd queue pre-download.sh
|
||||
cmd queue ubuntu/apt_pre-download.sh
|
||||
cmd queue osbash/enable_osbash_ssh_keys.sh
|
@ -1,102 +0,0 @@
|
||||
#==============================================================================
|
||||
# Scripts for controller node
|
||||
cmd create_node -n controller
|
||||
cmd queue_renamed -n controller osbash/init_xxx_node.sh
|
||||
|
||||
cmd queue etc_hosts.sh
|
||||
cmd queue osbash/enable_osbash_ssh_keys.sh
|
||||
cmd queue osbash/copy_openrc.sh
|
||||
cmd snapshot_cycle -n controller controller_node_init
|
||||
|
||||
# Environment
|
||||
cmd queue ubuntu/apt_install_mysql.sh
|
||||
cmd queue ubuntu/install_rabbitmq.sh
|
||||
cmd queue ubuntu/install_memcached.sh
|
||||
cmd snapshot_cycle -n controller pre-openstack_installed
|
||||
|
||||
# Identity
|
||||
cmd queue ubuntu/setup_keystone.sh
|
||||
cmd queue test/get_auth_token.sh
|
||||
cmd snapshot_cycle -n controller keystone_installed
|
||||
|
||||
# Image
|
||||
cmd queue ubuntu/setup_glance.sh
|
||||
cmd snapshot_cycle -n controller glance_installed
|
||||
|
||||
# Compute
|
||||
cmd queue ubuntu/setup_nova_controller.sh
|
||||
cmd queue ubuntu/setup_placement_controller.sh
|
||||
cmd snapshot_cycle -n controller nova-controller_installed
|
||||
|
||||
# Networking
|
||||
cmd queue ubuntu/setup_neutron_controller.sh
|
||||
cmd queue ubuntu/setup_self-service_controller.sh
|
||||
cmd queue ubuntu/setup_neutron_controller_part_2.sh
|
||||
cmd snapshot_cycle -n controller neutron-controller_installed
|
||||
|
||||
# Dashboard
|
||||
cmd queue ubuntu/setup_horizon.sh
|
||||
cmd snapshot_cycle -n controller horizon_installed
|
||||
|
||||
# Block Storage
|
||||
cmd queue ubuntu/setup_cinder_controller.sh
|
||||
cmd snapshot_cycle -n controller cinder_installed
|
||||
|
||||
# Orchestration
|
||||
cmd queue ubuntu/setup_heat_controller.sh
|
||||
cmd snapshot_cycle -n controller heat_controller_installed
|
||||
|
||||
cmd boot -n controller
|
||||
#==============================================================================
|
||||
# Scripts for compute1 node
|
||||
cmd create_node -n compute1
|
||||
cmd queue_renamed -n compute1 osbash/init_xxx_node.sh
|
||||
|
||||
cmd queue etc_hosts.sh
|
||||
cmd queue osbash/enable_osbash_ssh_keys.sh
|
||||
cmd queue osbash/copy_openrc.sh
|
||||
cmd snapshot_cycle -n compute1 compute1_node_init
|
||||
|
||||
# Compute
|
||||
cmd queue ubuntu/setup_nova_compute.sh
|
||||
cmd snapshot_cycle -n compute1 nova-compute1_installed
|
||||
|
||||
# Networking
|
||||
cmd queue ubuntu/setup_neutron_compute.sh
|
||||
cmd queue ubuntu/setup_self-service_compute.sh
|
||||
cmd queue ubuntu/setup_neutron_compute_part_2.sh
|
||||
cmd snapshot_cycle -n compute1 neutron-compute_installed
|
||||
|
||||
# Block Storage
|
||||
cmd queue ubuntu/setup_cinder_volumes.sh
|
||||
cmd snapshot_cycle -n compute1 cinder-volume_installed
|
||||
|
||||
cmd boot -n compute1
|
||||
#==============================================================================
|
||||
# Create networks
|
||||
cmd shutdown -n controller
|
||||
cmd queue config_public_network.sh
|
||||
cmd queue config_private_network.sh
|
||||
cmd boot -n controller
|
||||
#==============================================================================
|
||||
# Always take snapshots of finished cluster
|
||||
cmd shutdown -n controller
|
||||
cmd shutdown -n compute1
|
||||
cmd snapshot -n controller controller_-_cluster_installed
|
||||
cmd snapshot -n compute1 compute-_cluster_installed
|
||||
|
||||
# Boot cluster nodes -- cluster is ready for use
|
||||
cmd boot -n compute1
|
||||
|
||||
# Enable extra services as needed:
|
||||
#
|
||||
#cmd queue ubuntu/barbican/setup_barbican_server.sh
|
||||
#
|
||||
#cmd queue ubuntu/mistral/setup_mistral_server.sh
|
||||
#
|
||||
# Note: tacker depends on mistral and barbican
|
||||
#cmd queue ubuntu/tacker/setup_tacker_server.sh
|
||||
#cmd queue ubuntu/tacker/create_vim.sh
|
||||
#cmd queue ubuntu/tacker/create_vnf.sh
|
||||
|
||||
cmd boot -n controller
|
@ -1,26 +0,0 @@
|
||||
#==============================================================================
|
||||
# Only create VMs (don't install any software)
|
||||
#==============================================================================
|
||||
|
||||
# Scripts for controller node
|
||||
cmd create_node -n controller
|
||||
cmd queue_renamed -n controller osbash/init_xxx_node.sh
|
||||
|
||||
cmd queue etc_hosts.sh
|
||||
cmd queue osbash/enable_osbash_ssh_keys.sh
|
||||
cmd queue osbash/copy_openrc.sh
|
||||
cmd snapshot_cycle -n controller controller_node_init
|
||||
|
||||
#==============================================================================
|
||||
# Scripts for compute1 node
|
||||
cmd create_node -n compute1
|
||||
cmd queue_renamed -n compute1 osbash/init_xxx_node.sh
|
||||
|
||||
cmd queue etc_hosts.sh
|
||||
cmd queue osbash/enable_osbash_ssh_keys.sh
|
||||
cmd snapshot_cycle -n compute1 compute1_node_init
|
||||
|
||||
#==============================================================================
|
||||
# Both nodes are built, boot them
|
||||
cmd boot -n controller
|
||||
cmd boot -n compute1
|
@ -1,102 +0,0 @@
|
||||
cmd boot -n pxeserver
|
||||
#==============================================================================
|
||||
# Scripts for controller node
|
||||
cmd create_pxe_node -n controller
|
||||
cmd boot_set_tmp_node_ip -n controller
|
||||
cmd queue_renamed -n controller osbash/init_xxx_node.sh
|
||||
|
||||
cmd queue etc_hosts.sh
|
||||
cmd queue ubuntu/apt_init.sh
|
||||
cmd queue ubuntu/apt_upgrade.sh
|
||||
cmd queue pre-download.sh
|
||||
cmd queue osbash/enable_osbash_ssh_keys.sh
|
||||
# This reboot is not optional, we must switch from temporary PXE IP address to
|
||||
# final address before installing servers
|
||||
cmd queue shutdown.sh
|
||||
cmd boot -n controller
|
||||
cmd wait_for_shutdown -n controller
|
||||
cmd snapshot -n controller controller_node_init
|
||||
|
||||
# Environment
|
||||
cmd queue ubuntu/apt_install_mysql.sh
|
||||
cmd queue ubuntu/install_rabbitmq.sh
|
||||
cmd queue ubuntu/install_memcached.sh
|
||||
cmd snapshot_cycle -n controller pre-openstack_installed
|
||||
|
||||
# Identity
|
||||
cmd queue ubuntu/setup_keystone.sh
|
||||
cmd queue test/get_auth_token.sh
|
||||
cmd snapshot_cycle -n controller keystone_installed
|
||||
|
||||
# Image
|
||||
cmd queue ubuntu/setup_glance.sh
|
||||
cmd snapshot_cycle -n controller glance_installed
|
||||
|
||||
# Compute
|
||||
cmd queue ubuntu/setup_nova_controller.sh
|
||||
cmd snapshot_cycle -n controller nova-controller_installed
|
||||
|
||||
# Networking
|
||||
cmd queue ubuntu/setup_neutron_controller.sh
|
||||
cmd queue ubuntu/setup_self-service_controller.sh
|
||||
cmd queue ubuntu/setup_neutron_controller_part_2.sh
|
||||
cmd snapshot_cycle -n controller neutron-controller_installed
|
||||
|
||||
# Dashboard
|
||||
cmd queue ubuntu/setup_horizon.sh
|
||||
cmd snapshot_cycle -n controller horizon_installed
|
||||
|
||||
# Block Storage
|
||||
cmd queue ubuntu/setup_cinder_controller.sh
|
||||
cmd snapshot_cycle -n controller cinder_installed
|
||||
|
||||
# Orchestration
|
||||
cmd queue ubuntu/setup_heat_controller.sh
|
||||
cmd snapshot_cycle -n controller heat_controller_installed
|
||||
|
||||
cmd boot -n controller
|
||||
#==============================================================================
|
||||
# Scripts for compute1 node
|
||||
cmd create_pxe_node -n compute1
|
||||
cmd boot_set_tmp_node_ip -n compute1
|
||||
cmd queue_renamed -n compute1 osbash/init_xxx_node.sh
|
||||
|
||||
cmd queue etc_hosts.sh
|
||||
cmd queue ubuntu/apt_init.sh
|
||||
cmd queue ubuntu/apt_upgrade.sh
|
||||
cmd queue pre-download.sh
|
||||
cmd queue osbash/enable_osbash_ssh_keys.sh
|
||||
# This reboot is not optional, we must switch from temporary PXE IP address to
|
||||
# final address before installing servers
|
||||
cmd queue shutdown.sh
|
||||
cmd boot -n compute1
|
||||
cmd wait_for_shutdown -n compute1
|
||||
cmd snapshot -n compute1 compute1_node_init
|
||||
|
||||
# Compute
|
||||
cmd queue ubuntu/setup_nova_compute.sh
|
||||
cmd snapshot_cycle -n compute1 nova-compute1_installed
|
||||
|
||||
# Networking
|
||||
cmd queue ubuntu/setup_neutron_compute.sh
|
||||
cmd queue ubuntu/setup_self-service_compute.sh
|
||||
cmd queue ubuntu/setup_neutron_compute_part_2.sh
|
||||
cmd snapshot_cycle -n compute1 neutron-compute_installed
|
||||
|
||||
# Block Storage
|
||||
cmd queue ubuntu/setup_cinder_volumes.sh
|
||||
cmd snapshot_cycle -n compute1 cinder-volume_installed
|
||||
|
||||
cmd boot -n compute1
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Take snapshot of database changes on controller VM, too
|
||||
cmd shutdown -n controller
|
||||
|
||||
cmd snapshot -n controller controller_-_compute1_node_installed
|
||||
#==============================================================================
|
||||
cmd queue config_public_network.sh
|
||||
cmd queue config_private_network.sh
|
||||
cmd snapshot_cycle -n controller public_private_networks
|
||||
#==============================================================================
|
||||
|
||||
cmd boot -n controller
|
@ -1,25 +0,0 @@
|
||||
#==============================================================================
|
||||
cmd create_node -n pxeserver
|
||||
cmd queue_renamed -n pxeserver osbash/init_xxx_node.sh
|
||||
|
||||
cmd queue etc_hosts.sh
|
||||
cmd queue osbash/enable_osbash_ssh_keys.sh
|
||||
cmd queue osbash/copy_openrc.sh
|
||||
cmd snapshot_cycle -n pxeserver pxe_server_node_init
|
||||
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Copy ISO image to pxeserver
|
||||
cmd boot -n pxeserver
|
||||
cmd cp_iso -n pxeserver
|
||||
cmd shutdown -n pxeserver
|
||||
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
cmd queue pxe_server/install_pxeserver.sh
|
||||
|
||||
# Add scripts for creating netboot config file on PXE server
|
||||
cmd queue_renamed -n controller ubuntu/create_xxx_node_pxeboot.sh
|
||||
|
||||
# Add scripts for creating netboot config file on PXE server
|
||||
cmd queue_renamed -n compute1 ubuntu/create_xxx_node_pxeboot.sh
|
||||
|
||||
cmd snapshot_cycle -n pxeserver pxe_server_ready
|
||||
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
cmd boot -n pxeserver
|
@ -1,18 +0,0 @@
|
||||
OsBash
|
||||
------
|
||||
|
||||
About
|
||||
-----
|
||||
|
||||
By default, osbash will put into this directory its base disk images
|
||||
(base-*-<distro>.vdi), the VM export images (labs-<distro>.ova),
|
||||
and all installation ISO images it may download.
|
||||
|
||||
- 'img' folder stores all the base disk and ISO images.
|
||||
- To find individual virtualbox disk images, please look into the
|
||||
virtualbox default machine folder.
|
||||
- For Linux: "~/VirtualBox/labs/"
|
||||
- In case your default folder is at another location (manually set)
|
||||
please get the location by opening the VirtualBox GUI at this location
|
||||
"File>Preferences>General>Default Machine Folder"
|
||||
|
@ -1,9 +0,0 @@
|
||||
This directory contains bash libraries used by scripts.
|
||||
|
||||
Configuration files for kickstart (Fedora) and preseed (Ubuntu) are in
|
||||
osbash/netboot.
|
||||
|
||||
The osbash-ssh-keys can be automatically installed into osbash
|
||||
VMs to make them accessible.
|
||||
|
||||
The templates used to build Windows batch files are in the wbatch subdirectory.
|
File diff suppressed because it is too large
Load Diff
@ -1,38 +0,0 @@
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Fedora /etc/sysconfig/network-scripts/ifcfg-* configuration
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
function config_netif {
|
||||
local if_type=$1
|
||||
local if_num=${2:-""}
|
||||
local ip_address=${3:-""}
|
||||
local template
|
||||
|
||||
if [ "$if_type" = "dhcp" ]; then
|
||||
template="template-fedora-ifcfg-dhcp"
|
||||
else
|
||||
template="template-fedora-ifcfg-static"
|
||||
fi
|
||||
|
||||
local if_name="$(ifnum_to_ifname "$if_num")"
|
||||
|
||||
local if_file=/etc/sysconfig/network-scripts/ifcfg-$if_name
|
||||
|
||||
sed -e "
|
||||
s,%IF_NAME%,$if_name,g;
|
||||
s,%IP_ADDRESS%,$ip_address,g;
|
||||
" "$TEMPLATE_DIR/$template" | sudo tee "$if_file"
|
||||
}
|
||||
|
||||
function netcfg_init {
|
||||
: # Not needed for Fedora
|
||||
}
|
||||
|
||||
function netcfg_show {
|
||||
local cfg
|
||||
for cfg in /etc/sysconfig/network-scripts/ifcfg-*; do
|
||||
echo ---------- "$cfg"
|
||||
cat "$cfg"
|
||||
done
|
||||
echo ---------------------------------------------------------------
|
||||
}
|
@ -1,466 +0,0 @@
|
||||
# This file contains bash functions that may be used by guest systems (VMs).
|
||||
|
||||
# Sourcing this file calls functions fix_path_env and source_deploy.
|
||||
|
||||
source "$CONFIG_DIR/credentials"
|
||||
source "$LIB_DIR/functions.sh"
|
||||
source "$LIB_DIR/functions-common-devstack"
|
||||
|
||||
# Make devstack's operating system identification work with nounset
|
||||
function init_os_ident {
|
||||
if [[ -z "${os_PACKAGE:-""}" ]]; then
|
||||
GetOSVersion
|
||||
fi
|
||||
}
|
||||
|
||||
function source_deploy {
|
||||
if [ -n "${VM_SHELL_USER:-}" ]; then
|
||||
# Already sourced
|
||||
return 0
|
||||
fi
|
||||
if mountpoint -q /vagrant; then
|
||||
source "$CONFIG_DIR/deploy.vagrant"
|
||||
else
|
||||
source "$CONFIG_DIR/deploy.osbash"
|
||||
fi
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# If our sudo user's PATH is preserved (and does not contain sbin dirs),
|
||||
# some commands won't be found. Observed with Vagrant shell provisioner
|
||||
# scripts using sudo after "su - vagrant".
|
||||
# Adding to the path seems preferable to messing with the vagrant user's
|
||||
# sudoers environment (or working with a separate Vagrant user).
|
||||
|
||||
function fix_path_env {
|
||||
if is_root; then return 0; fi
|
||||
if echo 'echo $PATH'|sudo sh|grep -q '/sbin'; then return 0; fi
|
||||
export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
function zero_empty_space {
|
||||
echo "Filling empty disk space with zeros"
|
||||
sudo dd if=/dev/zero of=/filler bs=1M 2>/dev/null || true
|
||||
sudo rm /filler
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# For guest scripts to let osbash know they are running; used when osbashauto
|
||||
# runs scripts inside of the VM (STATUS_DIR directory must be shared between
|
||||
# host and VM).
|
||||
|
||||
function indicate_current_auto {
|
||||
if [ "${VM_SHELL_USER:-}" = "osbash" ]; then
|
||||
local scr_name=${1:-$(basename "$0")}
|
||||
local fpath=${2:-"/$STATUS_DIR/$scr_name.begin"}
|
||||
mkdir -p "$STATUS_DIR"
|
||||
touch "$fpath"
|
||||
fi
|
||||
log_point "script begin"
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Debug function to make a script halt execution until a tmp file is removed
|
||||
|
||||
function wait_for_file {
|
||||
# If no argument is passed, use empty string (to pass nounset option)
|
||||
local msg=${1-""}
|
||||
local wait_file=remove_to_continue
|
||||
[ -n "$msg" ] && wait_file=${wait_file}_${msg}
|
||||
echo >&2 "DEBUG wait_for_file pause; remove /tmp/$wait_file to continue."
|
||||
touch "/tmp/$wait_file"
|
||||
while [ -e "/tmp/$wait_file" ]; do
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copy stdin/stderr to log file
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function exec_logpath {
|
||||
local log_path=$1
|
||||
|
||||
# Append all stdin and stderr to log file
|
||||
exec > >(tee -a "$log_path") 2>&1
|
||||
}
|
||||
|
||||
function exec_logfile {
|
||||
local log_dir=${1:-/home/$VM_SHELL_USER/log}
|
||||
|
||||
# Default extension is log
|
||||
local ext=${2:-log}
|
||||
|
||||
mkdir -p "$log_dir"
|
||||
|
||||
# Log name based on name of running script
|
||||
local base_name=$(basename "$0" .sh)
|
||||
|
||||
local prefix=$(get_next_prefix "$log_dir" "$ext")
|
||||
local log_name="${prefix}_$base_name.$ext"
|
||||
|
||||
exec_logpath "$log_dir/$log_name"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Functions that need to run as root
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# /sbin/mount.vboxsf often ends up as a broken symlink, resulting in errors
|
||||
# when trying to mount the share in osbashauto.
|
||||
function as_root_fix_mount_vboxsf_link {
|
||||
local file=/sbin/mount.vboxsf
|
||||
if [ -L $file -a ! -e $file ]; then
|
||||
echo "$file is a broken symlink:"
|
||||
ls -l "$file"
|
||||
echo "Trying to fix it."
|
||||
|
||||
sdir="/usr/lib/VBoxGuestAdditions"
|
||||
if [ -L "$sdir" -a ! -e "$sdir" ]; then
|
||||
# /usr/lib/VBoxGuestAdditions is a convenient link into a directory
|
||||
# under /opt that changes its name with VirtualBox versions.
|
||||
# In some cases, the link was missing but /sbin/mount.vboxsf
|
||||
# pointed there.
|
||||
echo "$sdir is a broken symlink:"
|
||||
ls -l "sdir"
|
||||
shopt -s nullglob
|
||||
local new=(/opt/VBoxGuestAdditions*/lib/VBoxGuestAdditions)
|
||||
if [ -n "$new" ]; then
|
||||
ln -sv "$new" "$sdir"
|
||||
else
|
||||
echo "as_root_fix_mount_vboxsf_link: no VGA dir, aborting."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -L $file -a ! -e $file ]; then
|
||||
# In some cases, /sbin/mount.vboxsf gets the path in
|
||||
# /usr/lib/VBoxGuestAdditions. Try to fix the link.
|
||||
echo "Trying harder."
|
||||
new_target=$(find "$sdir/" -name "mount.vboxsf")
|
||||
if [ -z "$new_target" ]; then
|
||||
echo "as_root_fix_mount_vboxsf_link: no mount.vboxsf, aborting."
|
||||
return 1
|
||||
else
|
||||
echo "Found new target: $new_target"
|
||||
fi
|
||||
ln -svf "$new_target" "$file"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function as_root_inject_sudoer {
|
||||
if grep -q "${VM_SHELL_USER}" /etc/sudoers; then
|
||||
echo "${VM_SHELL_USER} already in /etc/sudoers"
|
||||
else
|
||||
echo "${VM_SHELL_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
echo "Defaults:${VM_SHELL_USER} !requiretty" >> /etc/sudoers
|
||||
fi
|
||||
}
|
||||
|
||||
# Change to a regular user to execute a guest script (and log its output)
|
||||
|
||||
function as_root_exec_script {
|
||||
local script_path=$1
|
||||
local script_name="$(basename "$script_path" .sh)"
|
||||
|
||||
echo "$(date) start $script_path"
|
||||
|
||||
local prefix=$(get_next_prefix "$LOG_DIR" "auto")
|
||||
local log_path=$LOG_DIR/${prefix}_$script_name.auto
|
||||
|
||||
su - "$VM_SHELL_USER" -c "bash $script_path" >"$log_path" 2>&1
|
||||
local rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo "$(date) ERROR: status $rc for $script_path" |
|
||||
tee >&2 -a "$LOG_DIR/error.log"
|
||||
else
|
||||
echo "$(date) done"
|
||||
fi
|
||||
return $rc
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Root wrapper around devstack functions for manipulating config files
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Return predictable temporary path for configuration file editing.
|
||||
# Used to simplify debugging.
|
||||
function get_iniset_tmpfile {
|
||||
local file=$1
|
||||
|
||||
# Set tmpdir="$LOG_DIR" if you want the temporary files to survive reboots.
|
||||
local tmpdir="/tmp"
|
||||
local ext="iniset"
|
||||
|
||||
local prefix=$(get_next_prefix "$tmpdir" "$ext")
|
||||
|
||||
# Typical tmpfile path: /tmp/000_etc_keystone_keystone.conf.iniset
|
||||
local tmpfile=$tmpdir/$prefix$(echo "$file" | tr '/' '_').$ext
|
||||
|
||||
# Create file owned by regular user so it can be edited without privileges
|
||||
touch "$tmpfile"
|
||||
|
||||
echo "$tmpfile"
|
||||
}
|
||||
|
||||
# Set an option in an INI file
|
||||
# iniset config-file section option value
|
||||
function iniset_sudo {
|
||||
if (($# != 4)); then
|
||||
echo -n "ERROR: $# instead of 4 arguments for iniset: $*"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local file=$1
|
||||
shift
|
||||
local tmpfile=$(get_iniset_tmpfile "$file")
|
||||
# Create a temporary copy, work on it, and copy it back into place
|
||||
sudo cp -fv "$file" "$tmpfile"
|
||||
echo >&2 iniset "$tmpfile" "$@"
|
||||
iniset "$tmpfile" "$@"
|
||||
cat "$tmpfile" | sudo tee "$file" >/dev/null
|
||||
}
|
||||
|
||||
# Comment an option in an INI file
|
||||
# inicomment config-file section option
|
||||
function inicomment_sudo {
|
||||
local file=$1
|
||||
shift
|
||||
local tmpfile=$(get_iniset_tmpfile "$file")
|
||||
# Create a temporary copy, work on it, and copy it back into place
|
||||
sudo cp -fv "$file" "$tmpfile"
|
||||
echo >&2 inicomment "$tmpfile" "$@"
|
||||
inicomment "$tmpfile" "$@"
|
||||
cat "$tmpfile" | sudo tee "$file" >/dev/null
|
||||
}
|
||||
|
||||
# Determinate is the given option present in the INI file
|
||||
# ini_has_option config-file section option
|
||||
function ini_has_option_sudo {
|
||||
local file=$1
|
||||
shift
|
||||
local tmpfile=$(get_iniset_tmpfile "$file")
|
||||
# Create a temporary copy, work on it
|
||||
sudo cp -fv "$file" "$tmpfile"
|
||||
echo >&2 ini_has_option "$tmpfile" "$@"
|
||||
ini_has_option "$tmpfile" "$@"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Functions for manipulating config files without section
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function iniset_sudo_no_section {
|
||||
local file=$1
|
||||
shift
|
||||
local tmpfile=$(get_iniset_tmpfile "$file")
|
||||
# Create a temporary copy, work on it, and copy it back into place
|
||||
sudo cp -fv "$file" "$tmpfile"
|
||||
iniset_no_section "$tmpfile" "$@"
|
||||
cat "$tmpfile" | sudo tee "$file" >/dev/null
|
||||
}
|
||||
|
||||
# ini_has_option_no_section config-file option
|
||||
function ini_has_option_no_section {
|
||||
local xtrace=$(set +o | grep xtrace)
|
||||
set +o xtrace
|
||||
local file=$1
|
||||
local option=$2
|
||||
local line
|
||||
line=$(sed -ne "/^$option[ \t]*=/ p;" "$file")
|
||||
$xtrace
|
||||
[ -n "$line" ]
|
||||
}
|
||||
|
||||
# Set an option in an INI file
|
||||
# iniset_no_section config-file option value
|
||||
function iniset_no_section {
|
||||
local xtrace=$(set +o | grep xtrace)
|
||||
set +o xtrace
|
||||
local file=$1
|
||||
local option=$2
|
||||
local value=$3
|
||||
|
||||
[[ -z $option ]] && return
|
||||
|
||||
if ! ini_has_option_no_section "$file" "$option"; then
|
||||
# Add it
|
||||
sed -i -e "1 i\
|
||||
$option = $value
|
||||
" "$file"
|
||||
else
|
||||
local sep=$(echo -ne "\x01")
|
||||
# Replace it
|
||||
sed -i -e '/^'${option}'/ s'${sep}'^\('${option}'[ \t]*=[ \t]*\).*$'${sep}'\1'"${value}"${sep} "$file"
|
||||
fi
|
||||
$xtrace
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# OpenStack helpers
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function mysql_exe {
|
||||
local cmd="$1"
|
||||
echo "mysql cmd: $cmd."
|
||||
sudo mysql -u "root" -p"$DATABASE_PASSWORD" -e "$cmd"
|
||||
}
|
||||
|
||||
function setup_database {
|
||||
local service=$1
|
||||
local db_user=$2
|
||||
local db_password=$3
|
||||
|
||||
echo -n "Waiting for database server to come up."
|
||||
until mysql_exe quit >/dev/null 2>&1; do
|
||||
sleep 1
|
||||
echo -n .
|
||||
done
|
||||
echo
|
||||
|
||||
mysql_exe "CREATE DATABASE $service"
|
||||
mysql_exe "GRANT ALL ON ${service}.* TO '$db_user'@'%' IDENTIFIED BY '$db_password';"
|
||||
mysql_exe "GRANT ALL ON ${service}.* TO '$db_user'@'localhost' IDENTIFIED BY '$db_password';"
|
||||
}
|
||||
|
||||
# Wait for neutron to come up. Due to a race during the operating system boot
|
||||
# process, the neutron server sometimes fails to come up. We restart the
|
||||
# neutron server if it does not reply for too long.
|
||||
function wait_for_neutron {
|
||||
(
|
||||
source $CONFIG_DIR/demo-openstackrc.sh
|
||||
echo -n "Waiting for neutron to come up."
|
||||
local cnt=0
|
||||
until openstack network list >/dev/null 2>&1; do
|
||||
if [ "$cnt" -eq 10 ]; then
|
||||
echo
|
||||
echo "ERROR No response from neutron. Restarting neutron-server."
|
||||
node_ssh controller "sudo service neutron-server restart"
|
||||
echo -n "Waiting for neutron to come up."
|
||||
elif [ "$cnt" -eq 20 ]; then
|
||||
echo
|
||||
echo "ERROR neutron does not seem to come up. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
echo -n .
|
||||
sleep 1
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
echo
|
||||
)
|
||||
}
|
||||
|
||||
# Wait for keystone to come up
|
||||
function wait_for_keystone {
|
||||
(
|
||||
source "$CONFIG_DIR/admin-openstackrc.sh"
|
||||
echo -n "Waiting for keystone to come up."
|
||||
until openstack user list >/dev/null 2>&1; do
|
||||
echo -n .
|
||||
sleep 1
|
||||
done
|
||||
echo
|
||||
)
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Network configuration
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Return the nth network interface name (not counting loopback; 0 -> eth0)
|
||||
function ifnum_to_ifname {
|
||||
local if_num=$1
|
||||
|
||||
# Skip loopback and start counting with next interface
|
||||
local iface=${IF_NAMES[$((if_num + 1))]}
|
||||
|
||||
echo >&2 "ifnum_to_ifname: interface $if_num is $iface"
|
||||
echo "$iface"
|
||||
}
|
||||
|
||||
# Get all network interfaces (e.g. eth0, p2p1, ens0, enp0s3) into an array
|
||||
function set_iface_list {
|
||||
unset IF_NAMES
|
||||
local iface
|
||||
for iface in $(ip -o link show|awk '/: / {print $2}'|tr -d ':'); do
|
||||
IF_NAMES+=($iface)
|
||||
done
|
||||
echo "Set IF_NAMES to ${IF_NAMES[*]}"
|
||||
}
|
||||
|
||||
function hostname_to_ip {
|
||||
local host_name=$1
|
||||
getent hosts "$host_name"|awk '{print $1}'
|
||||
}
|
||||
|
||||
function config_network {
|
||||
init_os_ident
|
||||
if is_ubuntu; then
|
||||
source "$LIB_DIR/functions.ubuntu.sh"
|
||||
else
|
||||
source "$LIB_DIR/functions.fedora.sh"
|
||||
fi
|
||||
|
||||
netcfg_init
|
||||
|
||||
# Get network interface configuration (NET_IF_?) for this node
|
||||
unset -v NET_IF_0 NET_IF_1 NET_IF_2 NET_IF_3
|
||||
get_node_netif_config "$(hostname)"
|
||||
|
||||
local index
|
||||
local iftype
|
||||
for index in "${!NODE_IF_TYPE[@]}"; do
|
||||
iftype=${NODE_IF_TYPE[index]}
|
||||
config_netif "$iftype" "$index" "${NODE_IF_IP[index]}"
|
||||
done
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Log points
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Record current size of log files of interest so we can later split them
|
||||
# accordingly.
|
||||
# Log points can be set anywhere in a client script simply by adding a
|
||||
# line: log_point "log point name"
|
||||
|
||||
function log_point {
|
||||
local caller=$(basename "$0" .sh)
|
||||
local commit_msg=$1
|
||||
local logdir=${2:-/var/log}
|
||||
local ext=lsl
|
||||
local prefix=$(get_next_prefix "$logdir" "$ext")
|
||||
|
||||
local fname
|
||||
fname=${prefix}_$(echo "${caller}_-_$commit_msg"|tr ' ' '_').$ext
|
||||
|
||||
(
|
||||
cd "$logdir"
|
||||
sudo bash -c "shopt -s nullglob; ls -l auth.log* keystone/* upstart/*.log mysql/* neutron/*" | \
|
||||
sudo tee "$logdir/$fname" > /dev/null
|
||||
)
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# ssh wrapper functions
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function no_chk_ssh {
|
||||
echo >&2 "ssh $*"
|
||||
# Options set to disable strict host key checking and related messages.
|
||||
ssh \
|
||||
-o "UserKnownHostsFile /dev/null" \
|
||||
-o "StrictHostKeyChecking no" \
|
||||
-o LogLevel=error \
|
||||
"$@"
|
||||
}
|
||||
|
||||
# ssh from one node VM to another node in the cluster
|
||||
function node_ssh {
|
||||
no_chk_ssh -i "$HOME/.ssh/osbash_key" "$@"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
fix_path_env
|
||||
source_deploy
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,199 +0,0 @@
|
||||
# This file contains bash functions that may be used by both guest and host
|
||||
# systems.
|
||||
|
||||
# Non-recursive removal of all files except README.*
|
||||
function clean_dir {
|
||||
local target_dir=$1
|
||||
if [ ! -e "$target_dir" ]; then
|
||||
mkdir -pv "$target_dir"
|
||||
elif [ ! -d "$target_dir" ]; then
|
||||
echo >&2 "Not a directory: $target_dir"
|
||||
return 1
|
||||
fi
|
||||
shopt -s nullglob
|
||||
local entries=("$target_dir"/*)
|
||||
if [ -n "${entries[0]-}" ]; then
|
||||
for f in "${entries[@]}"; do
|
||||
# Skip directories
|
||||
if [ ! -f "$f" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Skip README.*
|
||||
if [[ $f =~ /README\. ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
rm -f "$f"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
function is_root {
|
||||
if [ $EUID -eq 0 ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function yes_or_no {
|
||||
local prompt=$1
|
||||
local input=""
|
||||
while : ; do
|
||||
read -p "$prompt (Y/n): " input
|
||||
case "$input" in
|
||||
N|n)
|
||||
return 1
|
||||
;;
|
||||
""|Y|y)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
echo -e "${CError:-}Invalid input: ${CData:-}$input${CReset:-}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Network helpers
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function get_host_network_config {
|
||||
source "$CONFIG_DIR/openstack"
|
||||
|
||||
local line
|
||||
# Iterate over all NETWORK_? variables
|
||||
for hostnet in "${!NETWORK_@}"; do
|
||||
line=(${!hostnet})
|
||||
NET_NAME+=(${line[0]})
|
||||
NET_IP+=(${line[1]})
|
||||
# Set .1 (e.g., 203.0.113.1) as the default gateway address
|
||||
NET_GW+=($(remove_last_octet ${line[1]}).1)
|
||||
done
|
||||
}
|
||||
|
||||
function get_node_netif_config {
|
||||
local vm_name=$1
|
||||
source "$CONFIG_DIR/config.$vm_name"
|
||||
|
||||
local net_if=""
|
||||
local line
|
||||
# Iterate over all NET_IF_? variables
|
||||
for net_if in "${!NET_IF_@}"; do
|
||||
local if_num=${net_if##*_}
|
||||
line=(${!net_if})
|
||||
NODE_IF_TYPE[$if_num]=${line[0]}
|
||||
NODE_IF_IP[$if_num]=${line[1]:-""}
|
||||
# Default boot priority is 0 for all interfaces
|
||||
NODE_IF_PRIO[$if_num]=${line[2]:=0}
|
||||
done
|
||||
}
|
||||
|
||||
function remove_last_octet {
|
||||
# Remove last period and everything after it
|
||||
echo "${1%.*}"
|
||||
}
|
||||
|
||||
function netname_to_network {
|
||||
local net_name=$1
|
||||
local index
|
||||
|
||||
if [ -z "${NET_NAME+1}" ]; then
|
||||
# NET_NAME array is undefined
|
||||
get_host_network_config
|
||||
fi
|
||||
|
||||
for index in "${!NET_NAME[@]}"; do
|
||||
if [ "$net_name" = "${NET_NAME[index]}" ]; then
|
||||
echo "${NET_IP[index]}"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
echo >&2 "ERROR: No network named $net_name."
|
||||
exit 1
|
||||
}
|
||||
|
||||
function ip_to_netname {
|
||||
local ip=$1
|
||||
local ip_net=$(remove_last_octet "$ip").0
|
||||
local index
|
||||
|
||||
if [ -z "${NET_NAME+1}" ]; then
|
||||
# NET_NAME array is undefined
|
||||
get_host_network_config
|
||||
fi
|
||||
|
||||
for index in "${!NET_IP[@]}"; do
|
||||
# Remove last octet
|
||||
if [ "$ip_net" = "${NET_IP[index]}" ]; then
|
||||
echo "${NET_NAME[index]}"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
echo >&2 "ERROR: No network for IP address $ip. Exiting."
|
||||
exit 1
|
||||
}
|
||||
|
||||
function get_node_ip_in_network {
|
||||
local vm_name=$1
|
||||
local netname=$2
|
||||
local ip
|
||||
|
||||
if [ -z "${NET_NAME+1}" ]; then
|
||||
# NET_NAME array is undefined
|
||||
get_host_network_config
|
||||
fi
|
||||
|
||||
get_node_netif_config "$vm_name"
|
||||
|
||||
for ip in "${NODE_IF_IP[@]}"; do
|
||||
if [ -z "$ip" ]; then
|
||||
# This interface has no IP address. Next.
|
||||
continue
|
||||
elif [ "$(ip_to_netname "$ip")" = "$netname" ]; then
|
||||
echo >&2 "Success. Node $vm_name in $netname: $ip."
|
||||
echo "$ip"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
echo >&2 "ERROR: Node $vm_name not in network $netname. Exiting."
|
||||
exit 1
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Helpers to incrementally number files via name prefixes
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function get_next_file_number {
|
||||
local dir=$1
|
||||
local ext=${2:-""}
|
||||
|
||||
# Get number of *.log files in directory
|
||||
shopt -s nullglob
|
||||
if [ -n "$ext" ]; then
|
||||
# Count files with specific extension
|
||||
local files=("$dir/"*".$ext")
|
||||
else
|
||||
# Count all files
|
||||
local files=("$dir/"*)
|
||||
fi
|
||||
echo "${#files[*]}"
|
||||
}
|
||||
|
||||
function get_next_prefix {
|
||||
local dir=$1
|
||||
local ext=$2
|
||||
# Number of digits in prefix string (default 3)
|
||||
local digits=${3:-3}
|
||||
|
||||
# Get number of *.$ext files in $dir
|
||||
local cnt=$(get_next_file_number "$dir" "$ext")
|
||||
|
||||
printf "%0${digits}d" "$cnt"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,42 +0,0 @@
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Ubuntu /etc/network/interfaces configuration
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
readonly UBUNTU_IF_FILE=/etc/network/interfaces
|
||||
|
||||
function config_netif {
|
||||
local if_type=$1
|
||||
local if_num=${2:-""}
|
||||
local ip_address=${3:-""}
|
||||
local template
|
||||
|
||||
if [ "$if_type" = "dhcp" ]; then
|
||||
template="template-ubuntu-interfaces-dhcp"
|
||||
elif [ "$if_type" = "manual" ]; then
|
||||
template="template-ubuntu-interfaces-manual"
|
||||
else
|
||||
template="template-ubuntu-interfaces-static"
|
||||
fi
|
||||
|
||||
local if_name="$(ifnum_to_ifname "$if_num")"
|
||||
|
||||
# Empty line before this entry
|
||||
echo | sudo tee -a "$UBUNTU_IF_FILE"
|
||||
|
||||
sed -e "
|
||||
s,%IF_NAME%,$if_name,g;
|
||||
s,%IP_ADDRESS%,$ip_address,g;
|
||||
" "$TEMPLATE_DIR/$template" | sudo tee -a "$UBUNTU_IF_FILE"
|
||||
}
|
||||
|
||||
function netcfg_init {
|
||||
# Configuration functions will append to this file
|
||||
sudo cp -v "$TEMPLATE_DIR/template-ubuntu-interfaces-loopback" \
|
||||
"$UBUNTU_IF_FILE"
|
||||
}
|
||||
|
||||
function netcfg_show {
|
||||
echo ---------- "$UBUNTU_IF_FILE"
|
||||
cat "$UBUNTU_IF_FILE"
|
||||
echo ---------------------------------------------------------------
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
This directory contains the insecure ssh keys used by osbash for logging into
|
||||
the node VMs.
|
@ -1,27 +0,0 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEowIBAAKCAQEA0pxig+FU4OyoaJjYRcYzvFX70h2Sc7hUr7YSvYyHh9vjOOUE
|
||||
0eG2rWPuKjravQ8xoI7ElaeoT9kEn3FW2bUi9444d7I0jdxK0+FCnqkXoTV/2wip
|
||||
nR4NHiuZtRGz6SZWPn80mI+Kg8OcfKw3haB1R8nYdo8kRXXd/fzHGjUDmLkEZmW0
|
||||
fX+yCEh/fYrCMZqLGJ9z3gHyFQHC6k/TnGD4DyifrbE72xZGBNoTokuxHpNAvdCj
|
||||
lWyT9NVc92/3HBGEOVhZS9KKhZHrFUOSOHLYdcDBtuoJW2TuUlU9BgJXTML5vh/8
|
||||
J1YUPwIxeTZriBBp+OSuP3NHLKCM1nCnbjxMnwIDAQABAoIBAAkrH6rIE27bPpWX
|
||||
GcsnzrbDM3w5J1f8TUt87KHtzTSf4OtoJOaSIea4c/TIrR8P20Q3Et3E97HKK8ZZ
|
||||
I8PEe+o0+cZULq+CSIuiwciwacPt1UwOu3uIhF+s3DsisydSMOz1kq+ViB0mVdij
|
||||
kqMxkgl3AwJeRuDzOZ/F8lD0v9xVFVggqA5DLJhrXtPXrkMZYDlI9RtA3qvD1/RN
|
||||
/0QFiZNvbG9DpH/us5SWhI8FAtLgVBeylx5rLBebY59WGl2plyitGGOjtmTc7060
|
||||
bBWOZzT6PfruXvLj9O7dQwcEb0QNtAeNKHnyllYPNRHK8+WWP9JMg+h0JmV3r/UW
|
||||
ArGUvAECgYEA9pBDiTPdHKEdJW/Aic4ZGWMNbkCbxN6tHNXPfUQrOiyWtpShUjzI
|
||||
l4A9k6KTuWhsNQuLV2Cthdoa9WvEx9do/KXGuiXOhSkBm0ictsEeJMH50LbnQ6bX
|
||||
qMx7EPdyxmKQjcblUkB2Q+0TovPTPI61U9KYRFsj4iDXDftlrf/+Jp8CgYEA2qve
|
||||
2uWQvXWHe4EMKZpc/BqAIWmJiXzP9o4AD9ClOP9InNr2RVxVcTTVG0YEEqQDbPYi
|
||||
lq5k65QAA7NaojvHaawhz+VPqRFAKtzqzUpsDZPh9Db737Qclh3WacQiEecmHwtP
|
||||
1mYEIQTlCKTKfZ5yM0NASBD9kwWtjSSf2zpuGgECgYAEFfPojCF33fubqTRplC66
|
||||
SvfoAc4S/xWjSq+7hauptR9yOxhJQpSYXhmnHqSQB/jzEBPpCMMXWrvjoTuLjDhD
|
||||
J4QZhZLchgduyU8/gAe92DEJkl5WsqcUNv87Er6mJu/6SXd3W3YaPg17P8saT8sV
|
||||
boHzcAcyMhUeODJBJeLSRQKBgQDVOdygNFPz+oO20XoroyLijXC9o+yCTVt4PrUe
|
||||
tsQ1lPCYSwbzUXrbXboj0x0rlBTnDgdiSQGNmY5+DUjmg0YK69c4opEP+gtJAIxQ
|
||||
zC4a+0XMXkUyuK1bUBMApUjXjj7k7KHYHTgPfnda+12cKoGPLRekbjTlRRcbV0gt
|
||||
fIdaAQKBgGE1nzOZtA0z1cEVcucfy9yHjZqic1JN0os1H52CzsPUwCjpAwTMct9J
|
||||
7aLusbHBKQZgoOBuC0O/erV02oQIzTLWcjf45Uj52r0Rgt2kJpOKy8aPMZ9cpbq4
|
||||
tfMrBy/mZc7joHtfwtexLMm5EotkvHEzGXDIRZuyzOSTmlpSzEz3
|
||||
-----END RSA PRIVATE KEY-----
|
@ -1 +0,0 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key
|
@ -1,730 +0,0 @@
|
||||
# This file contains bash functions that are used by osbash on the host.
|
||||
|
||||
source "$LIB_DIR/functions.sh"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Conditional execution
|
||||
#-------------------------------------------------------------------------------
|
||||
# TODO: Create a help function and display it under help by default or with
|
||||
# option --help (-h).
|
||||
# exec_cmd is used for conditional execution:
|
||||
#
|
||||
# OSBASH=exec_cmd
|
||||
#
|
||||
# Execute command only if OSBASH is set:
|
||||
# ${OSBASH:-:} cmd args
|
||||
#
|
||||
# Execute command only if OSBASH is not set:
|
||||
# ${OSBASH:+:} cmd args
|
||||
#
|
||||
# Disable actual call to VBoxManage (selectively override configuration):
|
||||
# OSBASH= cmd args
|
||||
#
|
||||
# Enable call to VBoxManage (selectively override configuration):
|
||||
# OSBASH=exec_cmd cmd args
|
||||
|
||||
function exec_cmd {
|
||||
local cmd=$1
|
||||
shift
|
||||
$cmd "$@"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
function get_base_disk_name {
|
||||
echo "base-$VM_ACCESS-$OPENSTACK_RELEASE-$DISTRO"
|
||||
}
|
||||
|
||||
# From DISTRO string (e.g., ubuntu-14.04-server-amd64), get first component
|
||||
function get_distro_name {
|
||||
# Match up to first dash
|
||||
local re='([^-]*)'
|
||||
|
||||
if [[ $DISTRO =~ $re ]]; then
|
||||
echo "${BASH_REMATCH[1]}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Wrapper around vm_snapshot to deal with collisions with cluster rebuilds
|
||||
# starting from snapshot. We could delete the existing snapshot first,
|
||||
# rename the new one, or just skip the snapshot.
|
||||
function vm_conditional_snapshot {
|
||||
local vm_name=$1
|
||||
local shot_name=$2
|
||||
|
||||
# On Windows, don't test; take snapshots unconditionally
|
||||
if ! WBATCH= vm_snapshot_exists "$vm_name" "$shot_name"; then
|
||||
vm_snapshot "$vm_name" "$shot_name"
|
||||
fi
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Virtual VM keyboard using keycodes
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function keyboard_send_escape {
|
||||
local vm_name=$1
|
||||
_keyboard_push_scancode "$vm_name" "$(esc2scancode)"
|
||||
}
|
||||
|
||||
function keyboard_send_enter {
|
||||
local vm_name=$1
|
||||
_keyboard_push_scancode "$vm_name" "$(enter2scancode)"
|
||||
}
|
||||
|
||||
function keyboard_send_backspace {
|
||||
local vm_name=$1
|
||||
_keyboard_push_scancode "$vm_name" "$(backspace2scancode)"
|
||||
}
|
||||
|
||||
function keyboard_send_f6 {
|
||||
local vm_name=$1
|
||||
_keyboard_push_scancode "$vm_name" "$(f6_2scancode)"
|
||||
}
|
||||
|
||||
# Turn strings into keycodes and send them to target VM
|
||||
function keyboard_send_string {
|
||||
local vm_name=$1
|
||||
local str=$2
|
||||
local cnt=0
|
||||
|
||||
# This loop is inefficient enough that we don't overrun the keyboard input
|
||||
# buffer when pushing scancodes to the VM.
|
||||
while IFS= read -r -n1 char; do
|
||||
if [ -n "$char" ]; then
|
||||
SC=$(char2scancode "$char")
|
||||
if [ -n "$SC" ]; then
|
||||
_keyboard_push_scancode "$vm_name" "$SC"
|
||||
else
|
||||
echo >&2 "not found: $char"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Inject sleep into the wbatch files because the Windows batch file
|
||||
# is sometimes _too_ efficient and overruns the keyboard input buffer
|
||||
if [[ $((cnt % 50)) -eq 0 ]]; then
|
||||
OSBASH= ${WBATCH:-:} conditional_sleep 1
|
||||
fi
|
||||
cnt=$((cnt + 1))
|
||||
|
||||
done <<< "$str"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Conditional sleeping
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function conditional_sleep {
|
||||
sec=$1
|
||||
|
||||
# Don't sleep if we are just faking it for wbatch
|
||||
${OSBASH:-:} sleep "$sec"
|
||||
${WBATCH:-:} wbatch_sleep "$sec"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Networking
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function create_host_networks {
|
||||
get_host_network_config
|
||||
|
||||
local index
|
||||
for index in "${!NET_NAME[@]}"; do
|
||||
create_network "$index"
|
||||
done
|
||||
}
|
||||
|
||||
function configure_node_netifs {
|
||||
local vm_name=$1
|
||||
|
||||
get_node_netif_config "$vm_name"
|
||||
|
||||
local index
|
||||
local type
|
||||
local prio
|
||||
for index in "${!NODE_IF_TYPE[@]}"; do
|
||||
type=${NODE_IF_TYPE[index]}
|
||||
prio=${NODE_IF_PRIO[index]}
|
||||
if [ "$type" = "dhcp" ]; then
|
||||
vm_nic_base "$vm_name" "$index"
|
||||
elif [ "$type" = "manual" ]; then
|
||||
vm_nic_std "$vm_name" "$index"
|
||||
elif [ "$type" = "static" ]; then
|
||||
vm_nic_std "$vm_name" "$index"
|
||||
else
|
||||
echo >&2 "ERROR Unknown interface type: $type."
|
||||
exit 1
|
||||
fi
|
||||
if [ "$prio" -ne 0 ]; then
|
||||
# Elevate boot prio so this particular NIC is used for PXE booting
|
||||
vm_nic_set_boot_prio "$vm_name" "$index" "$prio"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# ssh
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Check permission for osbash insecure private key
|
||||
function check_osbash_private_key {
|
||||
local key_name="osbash_key"
|
||||
local osbash_key_dir=$LIB_DIR/osbash-ssh-keys
|
||||
local osbash_key_path=$osbash_key_dir/$key_name
|
||||
|
||||
if ! ls -l "$osbash_key_path"|grep -q "^-r--------"; then
|
||||
echo "Adjusting permissions for $osbash_key_path"
|
||||
chmod 400 "$osbash_key_path"
|
||||
fi
|
||||
}
|
||||
|
||||
function strip_top_dir {
|
||||
local full_path=$1
|
||||
echo "${full_path/$TOP_DIR\//}"
|
||||
}
|
||||
|
||||
# Copy files or directories to VM (incl. implied directories; HOME is TOP_DIR)
|
||||
function vm_scp_to_vm {
|
||||
local ssh_port=$1
|
||||
shift
|
||||
local ssh_ip=${SSH_IP:=127.0.0.1}
|
||||
|
||||
check_osbash_private_key
|
||||
|
||||
while (($#)); do
|
||||
local src_path=$1
|
||||
shift
|
||||
local target_path=$(strip_top_dir "$src_path")
|
||||
local target_dir=$(dirname "$target_path")
|
||||
vm_ssh "$ssh_port" "mkdir -p $target_dir"
|
||||
# To avoid getting stuck on broken ssh connection, disable connection
|
||||
# sharing (ControlPath) and use a timeout when connecting.
|
||||
scp -q -r \
|
||||
-i "$LIB_DIR/osbash-ssh-keys/osbash_key" \
|
||||
-o "UserKnownHostsFile /dev/null" \
|
||||
-o "StrictHostKeyChecking no" \
|
||||
-o ConnectTimeout=10 \
|
||||
-o ControlPath=none \
|
||||
-P "$ssh_port" \
|
||||
"$src_path" "$VM_SHELL_USER@$ssh_ip:$target_dir"
|
||||
done
|
||||
}
|
||||
|
||||
# Execute commands via ssh
|
||||
function vm_ssh {
|
||||
local ssh_port=$1
|
||||
shift
|
||||
local ssh_ip=${SSH_IP:=127.0.0.1}
|
||||
|
||||
check_osbash_private_key
|
||||
|
||||
# Some operating systems (e.g., Mac OS X) export locale settings to the
|
||||
# target that cause some Python clients to fail. Override with a standard
|
||||
# setting (LC_ALL=C).
|
||||
# To avoid getting stuck on broken ssh connection, disable connection
|
||||
# sharing (ControlPath) and use a timeout when connecting.
|
||||
LC_ALL=C ssh -q \
|
||||
-i "$LIB_DIR/osbash-ssh-keys/osbash_key" \
|
||||
-o "UserKnownHostsFile /dev/null" \
|
||||
-o "StrictHostKeyChecking no" \
|
||||
-o ConnectTimeout=10 \
|
||||
-o ControlPath=none \
|
||||
-p "$ssh_port" \
|
||||
"$VM_SHELL_USER@$ssh_ip" "$@"
|
||||
}
|
||||
|
||||
function wait_for_ssh {
|
||||
local ssh_port=$1
|
||||
|
||||
echo -e -n "${CStatus:-}Waiting for ssh server to respond on ${CData:-}${SSH_IP:-127.0.0.1}:$ssh_port${CReset:-}."
|
||||
while : ; do
|
||||
if vm_ssh "$ssh_port" exit ; then
|
||||
break
|
||||
else
|
||||
echo -n .
|
||||
sleep 1
|
||||
fi
|
||||
done
|
||||
echo
|
||||
}
|
||||
|
||||
# Copy one script to VM and execute it via ssh; log output to separate file
|
||||
function ssh_exec_script {
|
||||
local ssh_port=$1
|
||||
local script_path=$2
|
||||
|
||||
vm_scp_to_vm "$ssh_port" "$script_path"
|
||||
|
||||
local remote_path=$(strip_top_dir "$script_path")
|
||||
|
||||
echo -en "\n$(date) start $remote_path"
|
||||
|
||||
local script_name=$(basename "$script_path" .sh)
|
||||
local prefix=$(get_next_prefix "$LOG_DIR" "auto")
|
||||
local log_path=$LOG_DIR/${prefix}_${script_name}.auto
|
||||
|
||||
local rc=0
|
||||
vm_ssh "$ssh_port" "bash $remote_path && rm -vf $remote_path" \
|
||||
> "$log_path" 2>&1 || rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo >&2
|
||||
echo -e "${CError:-}ERROR: ssh returned status ${CData:-}$rc${CError:-} for${CData:-} $remote_path${CReset:-}" |
|
||||
tee >&2 -a "$LOG_DIR/error.log"
|
||||
touch "$STATUS_DIR/error"
|
||||
return $rc
|
||||
fi
|
||||
|
||||
echo -en "\n$(date) done"
|
||||
}
|
||||
|
||||
# Wait for sshd, prepare autostart dirs, and execute autostart scripts on VM
|
||||
function ssh_process_autostart {
|
||||
local vm_name=$1
|
||||
|
||||
# Run this function in sub-shell to protect our caller's environment
|
||||
# (which might be _our_ environment if we get called again)
|
||||
(
|
||||
source "$CONFIG_DIR/config.$vm_name"
|
||||
ssh_env_for_node "$vm_name"
|
||||
|
||||
local ssh_port
|
||||
if [ -n "${PXE_TMP_NODE_IP:-""}" ]; then
|
||||
ssh_port=22
|
||||
elif [ ${PROVIDER:-""} = virtualbox ]; then
|
||||
ssh_port=$VM_SSH_PORT
|
||||
else
|
||||
ssh_port=22
|
||||
fi
|
||||
|
||||
wait_for_ssh "$ssh_port"
|
||||
vm_ssh "$ssh_port" "rm -rf lib config autostart scripts"
|
||||
vm_scp_to_vm "$ssh_port" "$TOP_DIR/lib" "$TOP_DIR/config" "$TOP_DIR/scripts"
|
||||
|
||||
local script_path=""
|
||||
for script_path in "$AUTOSTART_DIR/"*.sh; do
|
||||
ssh_exec_script "$ssh_port" "$script_path"
|
||||
rm -f "$script_path" >&2
|
||||
done
|
||||
touch "$STATUS_DIR/done"
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Autostart mechanism
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function autostart_reset {
|
||||
clean_dir "$AUTOSTART_DIR"
|
||||
clean_dir "$STATUS_DIR"
|
||||
}
|
||||
|
||||
function process_begin_files {
|
||||
local processing=("$STATUS_DIR"/*.sh.begin)
|
||||
if [ -n "${processing[0]-}" ]; then
|
||||
local file
|
||||
for file in "${processing[@]}"; do
|
||||
echo >&2 -en "\nVM processing $(basename "$file" .begin)"
|
||||
rm "$file"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Wait until all autofiles are processed (indicated by a "$STATUS_DIR/done"
|
||||
# file created either by osbashauto or ssh_process_autostart)
|
||||
function wait_for_autofiles {
|
||||
shopt -s nullglob
|
||||
|
||||
${WBATCH:-:} wbatch_wait_auto
|
||||
# Remove autostart files and return if we are just faking it for wbatch
|
||||
${OSBASH:+:} autostart_reset
|
||||
${OSBASH:+:} return 0
|
||||
|
||||
until [ -f "$STATUS_DIR/done" -o -f "$STATUS_DIR/error" ]; do
|
||||
# Note: begin files (created by indicate_current_auto) are only visible
|
||||
# if the STATUS_DIR directory is shared between host and VM
|
||||
${WBATCH:-:} process_begin_files
|
||||
echo >&2 -n .
|
||||
sleep 1
|
||||
done
|
||||
# Check for remaining *.sh.begin files
|
||||
${WBATCH:-:} process_begin_files
|
||||
if [ -f "$STATUS_DIR/done" ]; then
|
||||
rm "$STATUS_DIR/done"
|
||||
else
|
||||
echo -e >&2 "${CError:-}\nERROR occured. Exiting.${CReset:-}"
|
||||
exit 1
|
||||
fi
|
||||
echo
|
||||
}
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
# Prepending numbers ensures scripts will be executed in the order they
|
||||
# were added to the queue.
|
||||
|
||||
function _autostart_queue {
|
||||
local src_path=$SCRIPTS_DIR/$1
|
||||
local src_name=${1##*/}
|
||||
|
||||
# If we get a target name, file will be renamed
|
||||
local target_name=${2:-$src_name}
|
||||
|
||||
if [[ $target_name = *.sh ]]; then
|
||||
# Create target file name like 01_apt_init.sh
|
||||
local prefix=$(get_next_prefix "$AUTOSTART_DIR" "sh" 2)
|
||||
target_name="${prefix}_$target_name"
|
||||
fi
|
||||
|
||||
if [ "$src_name" = "$target_name" ]; then
|
||||
echo >&2 -e "\t$src_name"
|
||||
else
|
||||
echo >&2 -e "\t$src_name -> $target_name"
|
||||
fi
|
||||
|
||||
cp -- "$src_path" "$AUTOSTART_DIR/$target_name"
|
||||
${WBATCH:-:} wbatch_cp_auto "$src_path" "$AUTOSTART_DIR/$target_name"
|
||||
}
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
# Print to the console which file requested guest scripts to run
|
||||
function log_autostart_source {
|
||||
# If the caller doesn't provide a config file, log the caller's source file
|
||||
local src_file=${1:-${BASH_SOURCE[1]##*/}}
|
||||
echo >&2 "Copying autostart files set in $src_file"
|
||||
}
|
||||
|
||||
# autostart <file> [<file> ...]
|
||||
# e.g. autostart zero_empty.sh osbash/base_fixups.sh
|
||||
function autostart {
|
||||
# Don't log this file -- log our caller's source file
|
||||
log_autostart_source "${BASH_SOURCE[1]##*/}"
|
||||
|
||||
while (($#)); do
|
||||
local src_file=$1
|
||||
shift
|
||||
_autostart_queue "$src_file"
|
||||
done
|
||||
}
|
||||
|
||||
# Parse options given to configuration commands. Return parsed values by
|
||||
# setting variables to be used by caller.
|
||||
function get_cmd_options {
|
||||
local OPTIND
|
||||
local opt
|
||||
|
||||
while getopts :g:n: opt; do
|
||||
case $opt in
|
||||
g)
|
||||
vm_ui=$OPTARG
|
||||
;;
|
||||
n)
|
||||
vm_name=$OPTARG
|
||||
;;
|
||||
*)
|
||||
echo -e >&2 "${CError:-}Error: bad option ${CData:-}$OPTARG.${CReset:-}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
# Assign the remaining arguments back to args
|
||||
args=$@
|
||||
}
|
||||
|
||||
# Parse command and arguments after a "cmd" token in config/scripts.*
|
||||
function command_from_config {
|
||||
local cmd=$1
|
||||
shift
|
||||
|
||||
# Local variables that may be changed by get_cmd_options
|
||||
local vm_name=${NODE_NAME:-""}
|
||||
local vm_ui=${VM_UI:-""}
|
||||
|
||||
local args=$@
|
||||
case "$cmd" in
|
||||
boot)
|
||||
# Format: boot [-g <gui_type>] [-n <node_name>]
|
||||
# Boot with queued autostart files now, wait for end of scripts
|
||||
# processing
|
||||
get_cmd_options $args
|
||||
echo >&2 "VM_UI=$vm_ui _vm_boot_with_autostart $vm_name"
|
||||
VM_UI=$vm_ui _vm_boot_with_autostart "$vm_name"
|
||||
if [ -n "${PXE_TMP_NODE_IP:-""}" ]; then
|
||||
echo >&2 "Unsetting PXE_TMP_NODE_IP."
|
||||
unset PXE_TMP_NODE_IP
|
||||
fi
|
||||
;;
|
||||
snapshot)
|
||||
# Format: snapshot [-n <node_name>] <snapshot_name>
|
||||
get_cmd_options $args
|
||||
local shot_name=$args
|
||||
echo >&2 vm_conditional_snapshot "$vm_name" "$shot_name"
|
||||
vm_conditional_snapshot "$vm_name" "$shot_name"
|
||||
;;
|
||||
shutdown)
|
||||
# Format: shutdown [-n <node_name>]
|
||||
get_cmd_options $args
|
||||
echo >&2 "vm_acpi_shutdown $vm_name"
|
||||
vm_acpi_shutdown "$vm_name"
|
||||
echo >&2 vm_wait_for_shutdown "$vm_name"
|
||||
vm_wait_for_shutdown "$vm_name"
|
||||
conditional_sleep 1
|
||||
;;
|
||||
wait_for_shutdown)
|
||||
# Format: wait_for_shutdown [-n <node_name>]
|
||||
get_cmd_options $args
|
||||
echo >&2 vm_wait_for_shutdown "$vm_name"
|
||||
vm_wait_for_shutdown "$vm_name"
|
||||
;;
|
||||
snapshot_cycle)
|
||||
# Skip command if user disabled snapshot cycles
|
||||
if [ "${SNAP_CYCLE:-}" = "no" ]; then
|
||||
return
|
||||
fi
|
||||
# Format: snapshot_cycle [-g <gui_type>] [-n <node_name>]
|
||||
# comprises shutdown, boot, wait_for_shutdown, snapshot
|
||||
get_cmd_options $args
|
||||
local shot_name=$args
|
||||
echo >&2 snapshot_cycle "$vm_name" "$shot_name"
|
||||
_autostart_queue "shutdown.sh"
|
||||
_vm_boot_with_autostart "$vm_name"
|
||||
if [ -n "${PXE_TMP_NODE_IP:-""}" ]; then
|
||||
echo >&2 "Unsetting PXE_TMP_NODE_IP."
|
||||
unset PXE_TMP_NODE_IP
|
||||
fi
|
||||
vm_wait_for_shutdown "$vm_name"
|
||||
vm_conditional_snapshot "$vm_name" "$shot_name"
|
||||
;;
|
||||
boot_set_tmp_node_ip)
|
||||
# format: boot_set_tmp_node_ip
|
||||
get_cmd_options $args
|
||||
echo >&2 PXE_TMP_NODE_IP=$PXE_INITIAL_NODE_IP
|
||||
PXE_TMP_NODE_IP=$PXE_INITIAL_NODE_IP
|
||||
;;
|
||||
create_node)
|
||||
# Format: create_node [-n <node_name>]
|
||||
get_cmd_options $args
|
||||
echo >&2 vm_create_node "$vm_name"
|
||||
vm_create_node "$vm_name"
|
||||
;;
|
||||
create_pxe_node)
|
||||
# Format: create_pxe_node [-n <node_name>]
|
||||
get_cmd_options $args
|
||||
if [ "$PROVIDER" = "kvm" ]; then
|
||||
echo -e >&2 "${CError:-}PXE booting with KVM is currently" \
|
||||
"not supported.\nPlease file a bug if you need it." \
|
||||
"${CReset:-}"
|
||||
exit 1
|
||||
fi
|
||||
# Set FIRST_DISK_SIZE to disable use of basedisk for PXE booting
|
||||
FIRST_DISK_SIZE=10000
|
||||
echo >&2 "PXE boot node, set FIRST_DISK_SIZE=$FIRST_DISK_SIZE."
|
||||
echo >&2 vm_create_node "$vm_name"
|
||||
vm_create_node "$vm_name"
|
||||
;;
|
||||
queue_renamed)
|
||||
# Queue a script for autostart, replacing xxx with vm_name
|
||||
# Format: queue <script_name> [-n <node_name>]
|
||||
get_cmd_options $args
|
||||
local script_rel_path=$args
|
||||
local old_name=$(basename "$script_rel_path")
|
||||
# Replace xxx with vm_name
|
||||
local new_name=${old_name/xxx/$vm_name}
|
||||
echo >&2 _autostart_queue "$script_rel_path" "$new_name"
|
||||
_autostart_queue "$script_rel_path" "$new_name"
|
||||
;;
|
||||
queue)
|
||||
# Queue a script for autostart
|
||||
# Format: queue <script_name>
|
||||
local script_rel_path=$args
|
||||
echo >&2 _autostart_queue "$script_rel_path"
|
||||
_autostart_queue "$script_rel_path"
|
||||
;;
|
||||
cp_iso)
|
||||
# Format: cp_iso [-n <node_name>]
|
||||
get_cmd_options $args
|
||||
local iso_name=$(get_iso_name)
|
||||
# Run this function in sub-shell to protect our caller's environment
|
||||
# (which might be _our_ environment if we get called again)
|
||||
(
|
||||
source "$CONFIG_DIR/config.$vm_name"
|
||||
ssh_env_for_node "$vm_name"
|
||||
|
||||
local ssh_port
|
||||
if [ ${PROVIDER:-""} = virtualbox ]; then
|
||||
ssh_port=$VM_SSH_PORT
|
||||
else
|
||||
ssh_port=22
|
||||
fi
|
||||
echo >&2 "cp_iso $vm_name $args"
|
||||
vm_scp_to_vm "$ssh_port" "$ISO_DIR/$iso_name"
|
||||
)
|
||||
;;
|
||||
*)
|
||||
echo -e >&2 "${CError:-}Error: invalid cmd: ${CData:-}$cmd${CReset:-}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Parse config/scripts.* configuration files
|
||||
function autostart_from_config {
|
||||
local config_file=$1
|
||||
local config_path=$CONFIG_DIR/$config_file
|
||||
|
||||
if [ ! -f "$config_path" ]; then
|
||||
echo -e >&2 "${CMissing:-}Config file not found: ${CData:-}$config_file${CReset:-}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_autostart_source "$config_file"
|
||||
|
||||
# Open file on file descriptor 3 so programs we call in this loop (ssh)
|
||||
# are free to mess with the standard file descriptors.
|
||||
exec 3< "$config_path"
|
||||
while read -r field_1 field_2 <&3; do
|
||||
if [[ $field_1 =~ (^$|^#) ]]; then
|
||||
# Skip empty lines and lines that are commented out
|
||||
continue
|
||||
elif [ "$field_1" == "cmd" ]; then
|
||||
if [ -n "${JUMP_SNAPSHOT:-""}" ]; then
|
||||
if [[ $field_2 =~ ^snapshot.*${JUMP_SNAPSHOT} ]]; then
|
||||
echo >&2 "Skipped forward to snapshot $JUMP_SNAPSHOT."
|
||||
unset JUMP_SNAPSHOT
|
||||
fi
|
||||
else
|
||||
command_from_config $field_2
|
||||
fi
|
||||
else
|
||||
# Syntax error
|
||||
echo -e -n >&2 "${CError:-}ERROR in ${CInfo:-}$config_file: ${CData:-}'$field_1${CReset:-}"
|
||||
if [ -n "$field_2" ]; then
|
||||
echo >&2 " $field_2'"
|
||||
else
|
||||
echo >&2 "'"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
# Get node names from scripts config file
|
||||
function script_cfg_get_nodenames {
|
||||
local config_name=$(get_distro_name "$DISTRO")_cluster
|
||||
local scripts_cfg="$CONFIG_DIR/scripts.$config_name"
|
||||
local node
|
||||
|
||||
node_names=""
|
||||
|
||||
while read -r line; do
|
||||
if [[ $line =~ ^cmd\ .*\ -n\ ([^ ]*)\ .* ]]; then
|
||||
node=${BASH_REMATCH[1]}
|
||||
if ! [[ $node_names =~ $node ]]; then
|
||||
node_names="$node_names $node"
|
||||
fi
|
||||
fi
|
||||
done < "$scripts_cfg"
|
||||
echo $node_names
|
||||
echo >&2 $node_names
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Functions to get install ISO images
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function download {
|
||||
local url=$1
|
||||
local dest_dir=$2
|
||||
local dest_file=$3
|
||||
local rc=0
|
||||
|
||||
if [ -n "${VM_PROXY:-""}" ]; then
|
||||
echo "Using VM_PROXY as http_proxy: $VM_PROXY"
|
||||
export http_proxy=$VM_PROXY
|
||||
fi
|
||||
|
||||
local wget_exe=$(which wget)
|
||||
mkdir -pv "$dest_dir"
|
||||
if [ -n "$wget_exe" ]; then
|
||||
$wget_exe --output-document "$dest_dir/$dest_file" "$url"||rc=$?
|
||||
else
|
||||
# Mac OS X has curl instead of wget
|
||||
local curl_exe=$(which curl)
|
||||
if [ -n "$curl_exe" ]; then
|
||||
$curl_exe "$url" -o "$dest_dir/$dest_file"||rc=$?
|
||||
fi
|
||||
fi
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo -e >&2 "${CError:-}Unable to download ${CData:-}$url${CError:-}.${CReset:-}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function get_iso_name {
|
||||
basename "${ISO_URL:-}"
|
||||
}
|
||||
|
||||
# If ISO image is missing from IMG_DIR, try downloading it.
|
||||
function download_iso_if_necessary {
|
||||
local iso_name=$(get_iso_name)
|
||||
if [ ! -f "$ISO_DIR/$iso_name" ]; then
|
||||
echo >&2 "$iso_name not in $ISO_DIR; downloading."
|
||||
if ! download "$ISO_URL" "$ISO_DIR" "$iso_name"; then
|
||||
echo -e >&2 "${CError:-}Download failed.${CReset:-}"
|
||||
# Remove empty file
|
||||
rm "$ISO_DIR/$iso_name"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
echo >&2 "$iso_name already in $ISO_DIR."
|
||||
fi
|
||||
}
|
||||
|
||||
# Get ISO image for installation. If the download fails, get an alternative URL
|
||||
# and try again.
|
||||
function find_install-iso {
|
||||
if ! download_iso_if_necessary; then
|
||||
# No local ISO file and download failed
|
||||
echo -e >&2 "${CStatus:-}Trying to find alternative.${CReset:-}"
|
||||
update_iso_variables
|
||||
|
||||
if ! download_iso_if_necessary; then
|
||||
echo -e >&2 "${CError:-}Exiting.${CReset:-}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function check_md5 {
|
||||
local file=$1
|
||||
local csum=$2
|
||||
local md5exe
|
||||
if [ ! -f "$file" ]; then
|
||||
echo -e >&2 "${CError:-}File $file not found. Aborting.${CReset:-}"
|
||||
exit 1
|
||||
fi
|
||||
if ! md5exe=$(which md5sum); then
|
||||
# On Mac OS X, the tool is called md5
|
||||
if ! md5exe=$(which md5); then
|
||||
echo -e >&2 "${CError:-}Neither md5sum nor md5 executable found." \
|
||||
" Aborting.${CReset:-}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo -e >&2 -n "${CStatus:-}Verifying MD5 checksum: ${CReset:-}"
|
||||
if $md5exe "$file" | grep -q "$csum"; then
|
||||
echo >&2 "okay."
|
||||
else
|
||||
echo -e >&2 "${CError:-}Verification failed. File corrupt:${CReset:-}"
|
||||
echo >&2 "$file"
|
||||
echo -e >&2 "${CError:-}Please remove file and re-run osbash script.${CReset:-}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,454 +0,0 @@
|
||||
source "$CONFIG_DIR/provider.$PROVIDER"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# virt-install / virsh
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
VIRSH=virsh
|
||||
VIRT_INSTALL=virt_install
|
||||
|
||||
: ${VIRT_LOG:=$LOG_DIR/virt.log}
|
||||
|
||||
function virsh {
|
||||
mkdir -p "$(dirname "$VIRT_LOG")"
|
||||
|
||||
echo "$VIRSH_CALL" "$@" >> "$VIRT_LOG"
|
||||
local rc=0
|
||||
$VIRSH_CALL "$@" || rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo -e >&2 "${CError:-}FAILURE ($rc): virsh: ${*}${CReset:-}"
|
||||
echo "FAILURE ($rc): $VIRSH_CALL $@" >> "$VIRT_LOG"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function virt_install {
|
||||
mkdir -p "$(dirname "$VIRT_LOG")"
|
||||
|
||||
echo "$VIRT_INSTALL_CALL" "$@" >> "$VIRT_LOG"
|
||||
local rc=0
|
||||
$VIRT_INSTALL_CALL "$@" || rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo -e >&2 "${CError:-}FAILURE ($rc): $VIRT_INSTALL_CALL ${*}${CReset:-}"
|
||||
echo "FAILURE ($rc): $VIRT_INSTALL_CALL $@" >> "$VIRT_LOG"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function virsh_uses_kvm {
|
||||
$VIRSH capabilities | grep -q kvm
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# VM status
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function set_vm_group {
|
||||
local vm_name=$1
|
||||
|
||||
$VIRSH desc "$vm_name" --config --live --title \
|
||||
--new-desc "$vm_name: $VM_GROUP"
|
||||
$VIRSH desc "$vm_name" --config --live --new-desc "All VMs with" \
|
||||
"'$VM_GROUP' in their description title get shut down when a new" \
|
||||
"cluster build starts."
|
||||
}
|
||||
|
||||
function get_vm_group {
|
||||
local vm_name=$1
|
||||
|
||||
$VIRSH desc "$vm_name" --title
|
||||
}
|
||||
|
||||
function vm_exists {
|
||||
local vm_name=$1
|
||||
|
||||
return $($VIRSH domstate "$vm_name" >/dev/null 2>&1)
|
||||
}
|
||||
|
||||
function vm_is_running {
|
||||
local vm_name=$1
|
||||
|
||||
return $($VIRSH domstate "$vm_name" 2>/dev/null | grep -q running)
|
||||
}
|
||||
|
||||
function vm_wait_for_shutdown {
|
||||
local vm_name=$1
|
||||
|
||||
echo -e >&2 -n "${CStatus:-}Machine shutting down${CReset:-}"
|
||||
while $VIRSH domstate "$vm_name" | grep -q -e running -e "in shutdown"; do
|
||||
echo -n .
|
||||
sleep 1
|
||||
done
|
||||
echo >&2 -e "${CStatus:-}\nMachine powered off.${CReset:-}"
|
||||
}
|
||||
|
||||
function vm_power_off {
|
||||
local vm_name=$1
|
||||
if vm_is_running "$vm_name"; then
|
||||
echo -e >&2 "${CStatus:-}Powering off VM ${CData:-}\"$vm_name\"${CReset:-}"
|
||||
$VIRSH destroy "$vm_name"
|
||||
fi
|
||||
}
|
||||
|
||||
function vm_acpi_shutdown {
|
||||
local vm_name=$1
|
||||
if vm_is_running "$vm_name"; then
|
||||
echo -e >&2 "${CStatus:-}ACPI shutdown for VM ${CData:-}\"$vm_name\"${CReset:-}"
|
||||
$VIRSH shutdown "$vm_name"
|
||||
fi
|
||||
}
|
||||
|
||||
function stop_running_cluster_vms {
|
||||
local vm_id
|
||||
|
||||
$VIRSH list --uuid | while read vm_id; do
|
||||
if [ -z "$vm_id" ]; then
|
||||
continue
|
||||
elif [[ "$(get_vm_group "$vm_id")" =~ $VM_GROUP ]]; then
|
||||
# vm_id instead of vm_name works just as well
|
||||
vm_acpi_shutdown "$vm_id"
|
||||
vm_wait_for_shutdown "$vm_id"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Snapshots
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function vm_snapshot_list_tree {
|
||||
local vm_name=$1
|
||||
|
||||
$VIRSH snapshot-list --tree "$vm_name"
|
||||
}
|
||||
|
||||
function vm_snapshot_list {
|
||||
local vm_name=$1
|
||||
|
||||
$VIRSH snapshot-list "$vm_name"
|
||||
}
|
||||
|
||||
function vm_snapshot_exists {
|
||||
local vm_name=$1
|
||||
local shot_name=$2
|
||||
|
||||
vm_snapshot_list "$vm_name" | grep -q "^ $shot_name "
|
||||
}
|
||||
|
||||
function vm_snapshot {
|
||||
local vm_name=$1
|
||||
local shot_name=$2
|
||||
|
||||
$VIRSH snapshot-create-as "$vm_name" "$shot_name" "$vm_name: $shot_name"
|
||||
}
|
||||
|
||||
function vm_snapshot_restore {
|
||||
local vm_name=$1
|
||||
local shot_name=$2
|
||||
|
||||
$VIRSH snapshot-revert "$vm_name" "$shot_name"
|
||||
}
|
||||
|
||||
function vm_snapshot_restore_current {
|
||||
local vm_name=$1
|
||||
|
||||
$VIRSH snapshot-revert "$vm_name" --current
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Network functions
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Get the MAC address from a node name (default network)
|
||||
function node_to_mac {
|
||||
local node=$1
|
||||
local rc=""
|
||||
local mac=""
|
||||
|
||||
echo >&2 "Waiting for MAC address."
|
||||
while : ; do
|
||||
mac=$($VIRSH dumpxml "$node"|grep -Po '[a-z0-9:]{17}'|head -n1) || rc=$?
|
||||
if [ -n "$mac" ]; then
|
||||
echo "$mac"
|
||||
echo >&2
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
echo >&2 -n .
|
||||
done
|
||||
}
|
||||
|
||||
# Get the IP address from a MAC address (default network)
|
||||
function mac_to_ip {
|
||||
local mac=$1
|
||||
local rc=""
|
||||
local ip=""
|
||||
|
||||
echo >&2 "Waiting for IP address."
|
||||
while : ; do
|
||||
ip=$(sudo arp -n|grep "$mac"|awk '{print $1}') || rc=$?
|
||||
if [ -n "$ip" ]; then
|
||||
echo >&2
|
||||
echo "$ip"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
echo >&2 -n .
|
||||
done
|
||||
}
|
||||
|
||||
NODE_IP_DB=$LOG_DIR/node_ip.db
|
||||
|
||||
function node_to_ip {
|
||||
local node=$1
|
||||
|
||||
local mac=$(node_to_mac "$node")
|
||||
echo -e >&2 "${CInfo:-}MAC address for $node: ${CData:-}$mac${CReset:-}"
|
||||
|
||||
local ip=$(mac_to_ip "$mac")
|
||||
echo -e >&2 "${CInfo:-}IP address for $node: ${CData:-}$ip${CReset:-}"
|
||||
|
||||
# Store node name, IP address, and MAC address in text file for later use
|
||||
echo "$mac $ip $node" >> "$NODE_IP_DB"
|
||||
|
||||
# Return IP address to caller
|
||||
echo "$ip"
|
||||
}
|
||||
|
||||
# Get ssh IP address and port from node name (non-default networks)
|
||||
function ssh_env_for_node {
|
||||
local node=$1
|
||||
|
||||
# No port forwarding with KVM; ignore VM_SSH_PORT from config.<node>
|
||||
VM_SSH_PORT=22
|
||||
|
||||
if [ -f "$NODE_IP_DB" ]; then
|
||||
if grep "$node" "$NODE_IP_DB"; then
|
||||
SSH_IP=$(grep " $node$" "$NODE_IP_DB"|awk '{print $2}')
|
||||
return 0
|
||||
else
|
||||
echo >&2 "Node $node not found in $NODE_IP_DB."
|
||||
fi
|
||||
else
|
||||
echo >&2 "$NODE_IP_DB missing."
|
||||
fi
|
||||
echo >&2 "Getting IP address through arp."
|
||||
SSH_IP=$(node_to_ip "$node")
|
||||
}
|
||||
|
||||
function virsh_define_network {
|
||||
local net=labs-$1
|
||||
local if_ip=$2
|
||||
|
||||
echo >&2 "Defining network $net ($if_ip)."
|
||||
if ! $VIRSH net-info "$net" >/dev/null 2>&1; then
|
||||
local cfg=$LOG_DIR/kvm-net-$net.xml
|
||||
|
||||
# FIXME Limit port forwarding to networks that need it.
|
||||
cat << NETCFG > "$cfg"
|
||||
<network>
|
||||
<name>$net</name>
|
||||
<forward mode='nat'/>
|
||||
<ip address='$if_ip' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
</network>
|
||||
NETCFG
|
||||
|
||||
$VIRSH net-define "$cfg"
|
||||
fi
|
||||
}
|
||||
|
||||
function virsh_start_network {
|
||||
local net=labs-$1
|
||||
|
||||
if $VIRSH net-info "$net" 2>/dev/null|grep -q "Active:.*no"; then
|
||||
echo >&2 "Starting network $net."
|
||||
$VIRSH net-start "$net"
|
||||
fi
|
||||
|
||||
# Save, update, and restore iptables configuration made by libvirt
|
||||
sudo iptables-save > "$LOG_DIR/iptables"
|
||||
# Forward new connections, too (except on virbr0); this allows our
|
||||
# NAT networks to talk to each other
|
||||
sed -i -e '/FORWARD.*virbr[^0]/ s/ RELATED/ NEW,RELATED/' "$LOG_DIR/iptables"
|
||||
sudo iptables-restore "$LOG_DIR/iptables"
|
||||
}
|
||||
|
||||
function virsh_stop_network {
|
||||
local net=labs-$1
|
||||
|
||||
# Undo our changes to iptables before letting libvirt deal with it
|
||||
sudo iptables-save > "$LOG_DIR/iptables"
|
||||
sed -i -e '/FORWARD.*virbr/ s/ NEW,RELATED/ RELATED/' "$LOG_DIR/iptables"
|
||||
sudo iptables-restore "$LOG_DIR/iptables"
|
||||
|
||||
if $VIRSH net-info "$net" 2>/dev/null|grep -q "Active:.*yes"; then
|
||||
echo >&2 "Stopping network $net."
|
||||
$VIRSH net-destroy "$net"
|
||||
fi
|
||||
}
|
||||
|
||||
function virsh_undefine_network {
|
||||
local net=labs-$1
|
||||
|
||||
if $VIRSH net-info "$net" >/dev/null 2>&1; then
|
||||
echo >&2 "Undefining network $net."
|
||||
$VIRSH net-undefine "$net"
|
||||
fi
|
||||
}
|
||||
|
||||
function vm_nic_base {
|
||||
KVM_NET_OPTIONS="${KVM_NET_OPTIONS:-} --network bridge=virbr0"
|
||||
}
|
||||
|
||||
function vm_nic_std {
|
||||
local vm_name=$1
|
||||
local index=$2
|
||||
local netname=labs-$(ip_to_netname "${NODE_IF_IP[index]}")
|
||||
|
||||
KVM_NET_OPTIONS="${KVM_NET_OPTIONS:-} --network network=$netname"
|
||||
}
|
||||
|
||||
function vm_nic_set_boot_prio {
|
||||
: Not implemented
|
||||
}
|
||||
|
||||
function create_network {
|
||||
local index=$1
|
||||
local net_name=${NET_NAME[index]}
|
||||
local if_ip=${NET_GW[index]}
|
||||
|
||||
virsh_stop_network "$net_name"
|
||||
|
||||
virsh_undefine_network "$net_name"
|
||||
|
||||
virsh_define_network "$net_name" "$if_ip"
|
||||
|
||||
virsh_start_network "$net_name"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Disk functions
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function disk_exists {
|
||||
local disk=$1
|
||||
|
||||
return $($VIRSH vol-info --pool "$KVM_VOL_POOL" "$disk" >/dev/null 2>&1)
|
||||
}
|
||||
|
||||
function base_disk_exists {
|
||||
disk_exists "$(get_base_disk_name)"
|
||||
}
|
||||
|
||||
function disk_create {
|
||||
local disk=$1
|
||||
# Size in MB
|
||||
local size=$2
|
||||
|
||||
if ! disk_exists "$disk"; then
|
||||
$VIRSH vol-create-as "$KVM_VOL_POOL" "$disk" "${size}M" --format qcow2
|
||||
fi
|
||||
}
|
||||
|
||||
function disk_delete {
|
||||
local disk=$1
|
||||
|
||||
if disk_exists "$disk"; then
|
||||
$VIRSH vol-delete --pool "$KVM_VOL_POOL" "$disk"
|
||||
fi
|
||||
}
|
||||
|
||||
function base_disk_delete {
|
||||
disk_delete "$(get_base_disk_name)"
|
||||
}
|
||||
|
||||
# Use virt-sparsify to compress disk image and make it sparse
|
||||
function disk_compress {
|
||||
local disk_name=$1
|
||||
local disk_path=$($VIRSH vol-path --pool "$KVM_VOL_POOL" "$disk_name")
|
||||
local pool_dir=$(dirname "$disk_path")
|
||||
|
||||
local spexe
|
||||
if ! spexe=$(which virt-sparsify); then
|
||||
echo -e >&2 "${CError:-}No virt-sparsify executable found." \
|
||||
"Consider installing libguestfs-tools.${CReset:-}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo -e >&2 "${CStatus:-}Compressing disk image, input file:${CReset:-}"
|
||||
sudo file "$disk_path"
|
||||
sudo ls -lh "$disk_path"
|
||||
sudo du -sh "$disk_path"
|
||||
|
||||
# virt-sparsify uses about 10 GB additional, temporary work space.
|
||||
# The default (/tmp) is often too small (especially if it is a RAM
|
||||
# disk). We use the pool_dir instead.
|
||||
sudo "$spexe" --tmp "$pool_dir" --compress "$disk_path" \
|
||||
"$pool_dir/.$disk_name"
|
||||
|
||||
# Copy owner and file modes from original file
|
||||
sudo chown -v --reference="$disk_path" "$pool_dir/.$disk_name"
|
||||
sudo chmod -v --reference="$disk_path" "$pool_dir/.$disk_name"
|
||||
|
||||
# Replace original with compressed file
|
||||
sudo mv -vf "$pool_dir/.$disk_name" "$disk_path"
|
||||
|
||||
echo -e >&2 "${CStatus:-}Output file:${CReset:-}"
|
||||
sudo file "$disk_path"
|
||||
sudo ls -lh "$disk_path"
|
||||
sudo du -sh "$disk_path"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# VM unregister, remove, delete
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function vm_delete {
|
||||
local vm_name=$1
|
||||
|
||||
echo >&2 -n "Asked to delete VM \"$vm_name\" "
|
||||
|
||||
if vm_exists "$vm_name"; then
|
||||
echo >&2 "(found)"
|
||||
vm_power_off "$vm_name"
|
||||
# Take a break before undefining the VM
|
||||
sleep 1
|
||||
$VIRSH undefine --snapshots-metadata --remove-all-storage "$vm_name"
|
||||
else
|
||||
echo >&2 "(not found)"
|
||||
fi
|
||||
|
||||
if disk_exists "$vm_name"; then
|
||||
echo >&2 -e "${CInfo:-}Disk exists: ${CData:-}$vm_name${CReset:-}"
|
||||
echo >&2 -e "Deleting disk $vm_name."
|
||||
disk_delete "$vm_name"
|
||||
fi
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Booting a VM and passing boot parameters
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
source "$OSBASH_LIB_DIR/kvm-keycodes.sh"
|
||||
|
||||
function _keyboard_push_scancode {
|
||||
local vm_name=$1
|
||||
shift
|
||||
# Split string (e.g. '01 81') into arguments (works also if we
|
||||
# get each hexbyte as a separate argument)
|
||||
# Not quoting $@ is intentional -- we want to split on blanks
|
||||
local scan_code=( $@ )
|
||||
$VIRSH send-key "$vm_name" --codeset linux "${scan_code[@]}" >/dev/null
|
||||
}
|
||||
|
||||
function vm_boot {
|
||||
local vm_name=$1
|
||||
|
||||
echo -e >&2 "${CStatus:-}Starting VM ${CData:-}\"$vm_name\"${CReset:-}"
|
||||
$VIRSH start "$vm_name"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,115 +0,0 @@
|
||||
# This bash library contains the main function that creates the base disk.
|
||||
|
||||
function vm_install_base {
|
||||
local base_disk_name=$(get_base_disk_name)
|
||||
local vm_name=base
|
||||
|
||||
echo >&2 "$(date) osbash vm_install starts."
|
||||
|
||||
if virsh_uses_kvm; then
|
||||
echo -e "${CInfo:-}KVM support is available.${CReset:-}"
|
||||
else
|
||||
echo -e "${CError:-}No KVM support available. Using qemu.${CReset:-}"
|
||||
fi
|
||||
|
||||
vm_delete "$vm_name"
|
||||
|
||||
if [ -z "${INSTALL_ISO-}" ]; then
|
||||
|
||||
if [ -z "$ISO_URL" ]; then
|
||||
echo -e >&2 "${CMissing:-}Either ISO URL or name needed (ISO_URL, INSTALL_ISO).${CReset:-}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
find_install-iso
|
||||
|
||||
INSTALL_ISO=$ISO_DIR/$(get_iso_name)
|
||||
fi
|
||||
|
||||
echo >&2 -e "${CInfo:-}Install ISO:\n\t${CData:-}$INSTALL_ISO${CReset:-}"
|
||||
|
||||
check_md5 "$INSTALL_ISO" "$ISO_MD5"
|
||||
|
||||
# Configure autostart
|
||||
autostart_reset
|
||||
|
||||
autostart osbash/base_fixups.sh
|
||||
|
||||
# By default, set by lib/osbash/lib.* to something like scripts.ubuntu_base
|
||||
autostart_from_config "$BASE_INSTALL_SCRIPTS"
|
||||
|
||||
autostart zero_empty.sh shutdown.sh
|
||||
|
||||
disk_create "$base_disk_name" "${BASE_DISK_SIZE:=10000}"
|
||||
|
||||
local console_type
|
||||
if [ "$VM_UI" = "headless" ]; then
|
||||
console_type="--noautoconsole"
|
||||
elif [ "$VM_UI" = "vnc" ]; then
|
||||
console_type="--graphics vnc,listen=0.0.0.0"
|
||||
else
|
||||
# gui option: should open a console viewer
|
||||
console_type=""
|
||||
fi
|
||||
|
||||
# Boot VM into distribution installer
|
||||
(
|
||||
source "$CONFIG_DIR/config.$vm_name"
|
||||
$VIRT_INSTALL \
|
||||
--disk "vol=$KVM_VOL_POOL/$base_disk_name,cache=none" \
|
||||
--cdrom "$INSTALL_ISO" \
|
||||
--name $vm_name \
|
||||
--os-type linux \
|
||||
--ram "${VM_MEM}" \
|
||||
--vcpus 1 \
|
||||
--virt-type kvm \
|
||||
$console_type \
|
||||
--wait=-1 \
|
||||
&
|
||||
)
|
||||
|
||||
local delay=10
|
||||
echo >&2 "Waiting $delay seconds for VM \"$vm_name\" to come up."
|
||||
conditional_sleep "$delay"
|
||||
|
||||
distro_start_installer "$vm_name"
|
||||
|
||||
echo -e >&2 "${CStatus:-}Installing operating system; waiting for reboot.${CReset:-}"
|
||||
|
||||
# Prevent "time stamp from the future" due to race between two sudos in
|
||||
# VIRT_INSTALL (background) above and VIRSH below
|
||||
sleep 1
|
||||
|
||||
echo >&2 "Waiting for VM to be defined."
|
||||
until vm_is_running "$vm_name"; do
|
||||
sleep 1
|
||||
echo -n .
|
||||
done
|
||||
|
||||
SSH_IP=$(node_to_ip "$vm_name")
|
||||
|
||||
echo >&2 "Waiting for ping returning from $SSH_IP."
|
||||
while ! ping -c1 "$SSH_IP" > /dev/null; do
|
||||
echo -n .
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Wait for ssh connection and execute scripts in autostart directory
|
||||
ssh_process_autostart "$vm_name" &
|
||||
# After reboot
|
||||
wait_for_autofiles
|
||||
echo -e >&2 "${CStatus:-}Installation done for VM ${CData:-}$vm_name${CReset:-}"
|
||||
|
||||
vm_wait_for_shutdown "$vm_name"
|
||||
|
||||
disk_compress "$base_disk_name"
|
||||
|
||||
# Just undefine the VM without deleting the base disk
|
||||
$VIRSH undefine "$vm_name"
|
||||
|
||||
echo -e >&2 "${CStatus:-}Base disk created${CReset:-}"
|
||||
|
||||
echo >&2 -e "${CData:-}$(date) ${CStatus:-}osbash vm_install ends\n${CReset:-}"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,111 +0,0 @@
|
||||
# This bash library contains the main function that creates a node VM.
|
||||
|
||||
# Boot node VM; wait until autostart files are processed
|
||||
function _vm_boot_with_autostart {
|
||||
local vm_name=$1
|
||||
|
||||
if $VIRSH domstate "$vm_name" | grep -q "shut off"; then
|
||||
vm_boot "$vm_name"
|
||||
else
|
||||
echo >&2 "VM is already running."
|
||||
$VIRSH domstate "$vm_name"
|
||||
fi
|
||||
|
||||
# Wait for ssh connection and execute scripts in autostart directory
|
||||
ssh_process_autostart "$vm_name" &
|
||||
|
||||
wait_for_autofiles
|
||||
echo >&2 "VM \"$vm_name\": autostart files executed"
|
||||
}
|
||||
|
||||
# Create a new node VM
|
||||
function vm_create_node {
|
||||
# XXX Run this function in sub-shell to protect our caller's environment
|
||||
# (which might be _our_ environment if we get called again)
|
||||
local vm_name=$1
|
||||
|
||||
(
|
||||
source "$CONFIG_DIR/config.$vm_name"
|
||||
|
||||
local base_disk_name=$(get_base_disk_name)
|
||||
|
||||
configure_node_netifs "$vm_name"
|
||||
|
||||
vm_delete "$vm_name"
|
||||
|
||||
echo -e "${CStatus:-}Creating copy-on-write VM disk.${CReset:-}"
|
||||
$VIRSH vol-create-as "$KVM_VOL_POOL" "$vm_name" \
|
||||
"${BASE_DISK_SIZE:=10000}M" \
|
||||
--format qcow2 \
|
||||
--backing-vol "$base_disk_name" \
|
||||
--backing-vol-format qcow2
|
||||
|
||||
if [ "${SECOND_DISK_SIZE:-0}" -gt 0 ]; then
|
||||
disk_create "$vm_name-sdb" "$SECOND_DISK_SIZE"
|
||||
local disks="--disk vol=$KVM_VOL_POOL/${vm_name}-sdb,cache=none"
|
||||
echo >&2 "Adding second disk: $disks:"
|
||||
fi
|
||||
|
||||
local console_type
|
||||
if [ "$VM_UI" = "headless" ]; then
|
||||
console_type="--noautoconsole"
|
||||
elif [ "$VM_UI" = "vnc" ]; then
|
||||
console_type="--graphics vnc,listen=0.0.0.0"
|
||||
else
|
||||
# gui option: should open a console viewer
|
||||
console_type=""
|
||||
fi
|
||||
|
||||
$VIRT_INSTALL \
|
||||
--name "$vm_name" \
|
||||
--ram "${VM_MEM:-512}" \
|
||||
--vcpus "${VM_CPUS:-1}" \
|
||||
--os-type=linux \
|
||||
--disk vol="$KVM_VOL_POOL/${vm_name},cache=none" \
|
||||
${disks:-} \
|
||||
${KVM_NET_OPTIONS:-""} \
|
||||
--import \
|
||||
$console_type \
|
||||
&
|
||||
)
|
||||
|
||||
# Prevent "time stamp from the future" due to race between two sudos in
|
||||
# VIRT_INSTALL (background) above and VIRSH below
|
||||
sleep 1
|
||||
|
||||
echo >&2 "Waiting for VM to come up."
|
||||
until vm_is_running "$vm_name"; do
|
||||
sleep 1
|
||||
echo -n .
|
||||
done
|
||||
|
||||
# Set VM group in description so we know which VMs are ours.
|
||||
set_vm_group "$vm_name"
|
||||
|
||||
SSH_IP=$(node_to_ip "$vm_name")
|
||||
|
||||
echo >&2 "Waiting for ping returning from $SSH_IP."
|
||||
while ! ping -c1 "$SSH_IP" > /dev/null; do
|
||||
echo -n .
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
function vm_build_nodes {
|
||||
|
||||
if virsh_uses_kvm; then
|
||||
echo -e "${CInfo:-}KVM support is available.${CReset:-}"
|
||||
else
|
||||
echo -e "${CError:-}No KVM support available. Using qemu.${CReset:-}"
|
||||
fi
|
||||
|
||||
CONFIG_NAME=$(get_distro_name "$DISTRO")_$1
|
||||
echo -e "${CInfo:-}Configuration file: ${CData:-}$CONFIG_NAME${CReset:-}"
|
||||
|
||||
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
autostart_reset
|
||||
autostart_from_config "scripts.$CONFIG_NAME"
|
||||
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,310 +0,0 @@
|
||||
# The functions in this library are used to get scancode strings for virsh
|
||||
# keyboard input (send-key).
|
||||
#
|
||||
# It is based on:
|
||||
# http://libvirt.org/git/?p=libvirt.git;a=blob_plain;f=src/util/keymaps.csv
|
||||
#
|
||||
# The library works with bash 3.2 (shipped with Mac OS X as of 2014).
|
||||
|
||||
function char2scancode {
|
||||
local key=$1
|
||||
case "$key" in
|
||||
'a')
|
||||
echo -n " KEY_A"
|
||||
;;
|
||||
'b')
|
||||
echo -n " KEY_B"
|
||||
;;
|
||||
'c')
|
||||
echo -n " KEY_C"
|
||||
;;
|
||||
'd')
|
||||
echo -n " KEY_D"
|
||||
;;
|
||||
'e')
|
||||
echo -n " KEY_E"
|
||||
;;
|
||||
'f')
|
||||
echo -n " KEY_F"
|
||||
;;
|
||||
'g')
|
||||
echo -n " KEY_G"
|
||||
;;
|
||||
'h')
|
||||
echo -n " KEY_H"
|
||||
;;
|
||||
'i')
|
||||
echo -n " KEY_I"
|
||||
;;
|
||||
'j')
|
||||
echo -n " KEY_J"
|
||||
;;
|
||||
'k')
|
||||
echo -n " KEY_K"
|
||||
;;
|
||||
'l')
|
||||
echo -n " KEY_L"
|
||||
;;
|
||||
'm')
|
||||
echo -n " KEY_M"
|
||||
;;
|
||||
'n')
|
||||
echo -n " KEY_N"
|
||||
;;
|
||||
'o')
|
||||
echo -n " KEY_O"
|
||||
;;
|
||||
'p')
|
||||
echo -n " KEY_P"
|
||||
;;
|
||||
'q')
|
||||
echo -n " KEY_Q"
|
||||
;;
|
||||
'r')
|
||||
echo -n " KEY_R"
|
||||
;;
|
||||
's')
|
||||
echo -n " KEY_S"
|
||||
;;
|
||||
't')
|
||||
echo -n " KEY_T"
|
||||
;;
|
||||
'u')
|
||||
echo -n " KEY_U"
|
||||
;;
|
||||
'v')
|
||||
echo -n " KEY_V"
|
||||
;;
|
||||
'w')
|
||||
echo -n " KEY_W"
|
||||
;;
|
||||
'x')
|
||||
echo -n " KEY_X"
|
||||
;;
|
||||
'y')
|
||||
echo -n " KEY_Y"
|
||||
;;
|
||||
'z')
|
||||
echo -n " KEY_Z"
|
||||
;;
|
||||
'A')
|
||||
echo -n " KEY_LEFTSHIFT KEY_A"
|
||||
;;
|
||||
'B')
|
||||
echo -n " KEY_LEFTSHIFT KEY_B"
|
||||
;;
|
||||
'C')
|
||||
echo -n " KEY_LEFTSHIFT KEY_C"
|
||||
;;
|
||||
'D')
|
||||
echo -n " KEY_LEFTSHIFT KEY_D"
|
||||
;;
|
||||
'E')
|
||||
echo -n " KEY_LEFTSHIFT KEY_E"
|
||||
;;
|
||||
'F')
|
||||
echo -n " KEY_LEFTSHIFT KEY_F"
|
||||
;;
|
||||
'G')
|
||||
echo -n " KEY_LEFTSHIFT KEY_G"
|
||||
;;
|
||||
'H')
|
||||
echo -n " KEY_LEFTSHIFT KEY_H"
|
||||
;;
|
||||
'I')
|
||||
echo -n " KEY_LEFTSHIFT KEY_I"
|
||||
;;
|
||||
'J')
|
||||
echo -n " KEY_LEFTSHIFT KEY_J"
|
||||
;;
|
||||
'K')
|
||||
echo -n " KEY_LEFTSHIFT KEY_K"
|
||||
;;
|
||||
'L')
|
||||
echo -n " KEY_LEFTSHIFT KEY_L"
|
||||
;;
|
||||
'M')
|
||||
echo -n " KEY_LEFTSHIFT KEY_M"
|
||||
;;
|
||||
'N')
|
||||
echo -n " KEY_LEFTSHIFT KEY_N"
|
||||
;;
|
||||
'O')
|
||||
echo -n " KEY_LEFTSHIFT KEY_O"
|
||||
;;
|
||||
'P')
|
||||
echo -n " KEY_LEFTSHIFT KEY_P"
|
||||
;;
|
||||
'Q')
|
||||
echo -n " KEY_LEFTSHIFT KEY_Q"
|
||||
;;
|
||||
'R')
|
||||
echo -n " KEY_LEFTSHIFT KEY_R"
|
||||
;;
|
||||
'S')
|
||||
echo -n " KEY_LEFTSHIFT KEY_S"
|
||||
;;
|
||||
'T')
|
||||
echo -n " KEY_LEFTSHIFT KEY_T"
|
||||
;;
|
||||
'U')
|
||||
echo -n " KEY_LEFTSHIFT KEY_U"
|
||||
;;
|
||||
'V')
|
||||
echo -n " KEY_LEFTSHIFT KEY_V"
|
||||
;;
|
||||
'W')
|
||||
echo -n " KEY_LEFTSHIFT KEY_W"
|
||||
;;
|
||||
'X')
|
||||
echo -n " KEY_LEFTSHIFT KEY_X"
|
||||
;;
|
||||
'Y')
|
||||
echo -n " KEY_LEFTSHIFT KEY_Y"
|
||||
;;
|
||||
'Z')
|
||||
echo -n " KEY_LEFTSHIFT KEY_Z"
|
||||
;;
|
||||
'1')
|
||||
echo -n " KEY_1"
|
||||
;;
|
||||
'2')
|
||||
echo -n " KEY_2"
|
||||
;;
|
||||
'3')
|
||||
echo -n " KEY_3"
|
||||
;;
|
||||
'4')
|
||||
echo -n " KEY_4"
|
||||
;;
|
||||
'5')
|
||||
echo -n " KEY_5"
|
||||
;;
|
||||
'6')
|
||||
echo -n " KEY_6"
|
||||
;;
|
||||
'7')
|
||||
echo -n " KEY_7"
|
||||
;;
|
||||
'8')
|
||||
echo -n " KEY_8"
|
||||
;;
|
||||
'9')
|
||||
echo -n " KEY_9"
|
||||
;;
|
||||
'0')
|
||||
echo -n " KEY_0"
|
||||
;;
|
||||
'!')
|
||||
echo -n " KEY_LEFTSHIFT KEY_1"
|
||||
;;
|
||||
'@')
|
||||
echo -n " KEY_LEFTSHIFT KEY_2"
|
||||
;;
|
||||
'#')
|
||||
echo -n " KEY_LEFTSHIFT KEY_3"
|
||||
;;
|
||||
'$')
|
||||
echo -n " KEY_LEFTSHIFT KEY_4"
|
||||
;;
|
||||
'%')
|
||||
echo -n " KEY_LEFTSHIFT KEY_5"
|
||||
;;
|
||||
'^')
|
||||
echo -n " KEY_LEFTSHIFT KEY_6"
|
||||
;;
|
||||
'&')
|
||||
echo -n " KEY_LEFTSHIFT KEY_7"
|
||||
;;
|
||||
'*')
|
||||
echo -n " KEY_LEFTSHIFT KEY_8"
|
||||
;;
|
||||
'(')
|
||||
echo -n " KEY_LEFTSHIFT KEY_9"
|
||||
;;
|
||||
')')
|
||||
echo -n " KEY_LEFTSHIFT KEY_0"
|
||||
;;
|
||||
'-')
|
||||
echo -n " KEY_MINUS"
|
||||
;;
|
||||
'_')
|
||||
echo -n " KEY_LEFTSHIFT KEY_MINUS"
|
||||
;;
|
||||
'=')
|
||||
echo -n " KEY_EQUAL"
|
||||
;;
|
||||
'+')
|
||||
echo -n " KEY_LEFTSHIFT KEY_EQUAL"
|
||||
;;
|
||||
' ')
|
||||
echo -n " KEY_SPACE"
|
||||
;;
|
||||
'[')
|
||||
echo -n " KEY_LEFTBRACE"
|
||||
;;
|
||||
']')
|
||||
echo -n " KEY_RIGHTBRACE"
|
||||
;;
|
||||
'{')
|
||||
echo -n " KEY_LEFTSHIFT KEY_LEFTBRACE"
|
||||
;;
|
||||
'}')
|
||||
echo -n " KEY_LEFTSHIFT KEY_RIGHTBRACE"
|
||||
;;
|
||||
';')
|
||||
echo -n " KEY_SEMICOLON"
|
||||
;;
|
||||
':')
|
||||
echo -n " KEY_LEFTSHIFT KEY_SEMICOLON"
|
||||
;;
|
||||
',')
|
||||
echo -n " KEY_COMMA"
|
||||
;;
|
||||
'.')
|
||||
echo -n " KEY_DOT"
|
||||
;;
|
||||
'/')
|
||||
echo -n " KEY_SLASH"
|
||||
;;
|
||||
'\')
|
||||
echo -n " KEY_BACKSLASH"
|
||||
;;
|
||||
'|')
|
||||
echo -n " KEY_LEFTSHIFT KEY_BACKSLASH"
|
||||
;;
|
||||
'?')
|
||||
echo -n " KEY_LEFTSHIFT KEY_SLASH"
|
||||
;;
|
||||
'"')
|
||||
echo -n " KEY_LEFTSHIFT KEY_APOSTROPHE"
|
||||
;;
|
||||
"'")
|
||||
echo -n " KEY_APOSTROPHE"
|
||||
;;
|
||||
">")
|
||||
echo -n " KEY_LEFTSHIFT KEY_DOT"
|
||||
;;
|
||||
"<")
|
||||
echo -n " KEY_LEFTSHIFT KEY_COMMA"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function esc2scancode {
|
||||
echo -n " KEY_ESC"
|
||||
}
|
||||
|
||||
function enter2scancode {
|
||||
echo -n " KEY_ENTER"
|
||||
}
|
||||
|
||||
function backspace2scancode {
|
||||
echo -n " KEY_BACKSPACE"
|
||||
}
|
||||
|
||||
function f6_2scancode {
|
||||
echo -n " KEY_F6"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,54 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Colors and decorations
|
||||
|
||||
function colorizer {
|
||||
|
||||
# Text Reset
|
||||
local Reset_Color='\x1b[0m'
|
||||
|
||||
# Regular
|
||||
local Black='\x1b[0;30m'
|
||||
local Red='\x1b[0;31m'
|
||||
local Green='\x1b[0;32m'
|
||||
local Yellow='\x1b[0;33m'
|
||||
local Blue='\x1b[0;34m'
|
||||
local Purple='\x1b[0;35m'
|
||||
local Cyan='\x1b[0;36m'
|
||||
local White='\x1b[0;37m'
|
||||
|
||||
# Bold
|
||||
local Bold_Black='\x1b[1;30m'
|
||||
local Bold_Red='\x1b[1;31m'
|
||||
local Bold_Green='\x1b[1;32m'
|
||||
local Bold_Yellow='\x1b[1;33m'
|
||||
local Bold_Blue='\x1b[1;34m'
|
||||
local Bold_Purple='\x1b[1;35m'
|
||||
local Bold_Cyan='\x1b[1;36m'
|
||||
local Bold_White='\x1b[1;37m'
|
||||
|
||||
# Underline
|
||||
local Underline_Black='\x1b[4;30m'
|
||||
local Underline_Red='\x1b[4;31m'
|
||||
local Underline_Green='\x1b[4;32m'
|
||||
local Underline_Yellow='\x1b[4;33m'
|
||||
local Underline_Blue='\x1b[4;34m'
|
||||
local Underline_Purple='\x1b[1;35m'
|
||||
local Underline_Cyan='\x1b[4;36m'
|
||||
local Underline_White='\x1b[4;37m'
|
||||
|
||||
# Background
|
||||
local On_Black='\x1b[40m'
|
||||
local On_Blue='\x1b[44m'
|
||||
local On_White='\x1b[47m'
|
||||
|
||||
# Color codes
|
||||
export CError=$Red
|
||||
export CStatus=$Bold_Purple
|
||||
export CInfo=$Bold_Yellow
|
||||
export CProcess=$Bold_Blue
|
||||
export CData=$Bold_Cyan
|
||||
export CMissing=$Bold_Red
|
||||
export CReset=$Reset_Color
|
||||
}
|
||||
colorizer
|
||||
unset colorizer
|
@ -1,43 +0,0 @@
|
||||
# CentOS 7 x86_64
|
||||
|
||||
# Default scripts for all Fedora base disks
|
||||
: ${BASE_INSTALL_SCRIPTS:=scripts.centos_base}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Booting the operating system installer
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
readonly ISO_URL=https://buildlogs.centos.org/rolling/7/isos/x86_64/CentOS-7-x86_64-DVD-1511.iso
|
||||
readonly ISO_MD5=c875b0f1dabda14f00a3e261d241f63e
|
||||
|
||||
readonly _KS_ssh=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/ks-ssh-v2.cfg
|
||||
readonly _KS_vbadd=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/ks-vbadd.cfg
|
||||
readonly _KS_all=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/ks-all-v2.cfg
|
||||
|
||||
readonly _BOOT_ARGS="linux ks=%s"
|
||||
|
||||
# ostype used by VirtualBox to choose icon and flags (64-bit, IOAPIC)
|
||||
VBOX_OSTYPE=RedHat_64
|
||||
|
||||
function distro_start_installer {
|
||||
local vm_name=$1
|
||||
|
||||
# pick a _KS_* file
|
||||
local kickstart=_KS_$VM_ACCESS
|
||||
|
||||
echo "Using $kickstart ${!kickstart}"
|
||||
|
||||
local boot_args=$(printf "$_BOOT_ARGS" "${!kickstart}")
|
||||
|
||||
keyboard_send_escape "$vm_name"
|
||||
|
||||
conditional_sleep 1
|
||||
|
||||
echo -e "${CStatus:-}Pushing boot command line${CReset:-}"
|
||||
keyboard_send_string "$vm_name" "$boot_args"
|
||||
|
||||
echo "Initiating boot sequence"
|
||||
keyboard_send_enter "$vm_name"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,56 +0,0 @@
|
||||
# Ubuntu 12.04.4 LTS amd64 server
|
||||
|
||||
# Default scripts for all Ubuntu installs
|
||||
: ${BASE_INSTALL_SCRIPTS:=scripts.ubuntu_base}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Booting the operating system installer
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
readonly ISO_URL=http://releases.ubuntu.com/12.04/ubuntu-12.04.4-server-amd64.iso
|
||||
|
||||
# Note: Ubuntu 12.04 LTS cannot pull a preseed file over HTTPS
|
||||
readonly _PS_ssh=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-ssh-v2.cfg
|
||||
readonly _PS_vbadd=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-vbadd.cfg
|
||||
readonly _PS_all=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-all-v2.cfg
|
||||
|
||||
readonly _BOOT_ARGS="/install/vmlinuz
|
||||
noapic
|
||||
preseed/url=%s
|
||||
debian-installer=en_US
|
||||
auto=true
|
||||
locale=en_US
|
||||
hostname=osbash
|
||||
fb=false
|
||||
debconf/frontend=noninteractive
|
||||
keyboard-configuration/modelcode=SKIP
|
||||
initrd=/install/initrd.gz
|
||||
console-setup/ask_detect=false"
|
||||
|
||||
# ostype used by VirtualBox to choose icon and flags (64-bit, IOAPIC)
|
||||
VBOX_OSTYPE=Ubuntu_64
|
||||
|
||||
function distro_start_installer {
|
||||
local vm_name=$1
|
||||
|
||||
# pick a _PS_* file
|
||||
local preseed=_PS_$VM_ACCESS
|
||||
|
||||
echo "Using $preseed ${!preseed}"
|
||||
|
||||
local boot_args=$(printf "$_BOOT_ARGS" "${!preseed}")
|
||||
|
||||
keyboard_send_escape "$vm_name"
|
||||
keyboard_send_escape "$vm_name"
|
||||
keyboard_send_enter "$vm_name"
|
||||
|
||||
conditional_sleep 1
|
||||
|
||||
echo -e "${CStatus:-}Pushing boot command line${CReset:-}"
|
||||
keyboard_send_string "$vm_name" "$boot_args"
|
||||
|
||||
echo "Initiating boot sequence"
|
||||
keyboard_send_enter "$vm_name"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,86 +0,0 @@
|
||||
# Ubuntu 14.04 LTS amd64 server
|
||||
|
||||
# Default scripts for all Ubuntu installs
|
||||
: ${BASE_INSTALL_SCRIPTS:=scripts.ubuntu_base}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Installation from ISO image
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
readonly ISO_URL_BASE=http://releases.ubuntu.com/14.04
|
||||
|
||||
ISO_URL=$ISO_URL_BASE/ubuntu-14.04.5-server-amd64.iso
|
||||
ISO_MD5=dd54dc8cfc2a655053d19813c2f9aa9f
|
||||
|
||||
readonly _PS_ssh=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-ssh-v4.cfg
|
||||
readonly _PS_vbadd=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-vbadd.cfg
|
||||
readonly _PS_all=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-all-v2.cfg
|
||||
|
||||
# Arguments for ISO image installer
|
||||
readonly _BOOT_ARGS="/install/vmlinuz
|
||||
noapic
|
||||
preseed/url=%s
|
||||
debian-installer=en_US
|
||||
auto=true
|
||||
locale=en_US
|
||||
hostname=osbash
|
||||
fb=false
|
||||
debconf/frontend=noninteractive
|
||||
keyboard-configuration/modelcode=SKIP
|
||||
initrd=/install/initrd.gz
|
||||
console-setup/ask_detect=false"
|
||||
|
||||
# Fallback function to find current ISO image in case the file in ISO_URL is
|
||||
# neither on the disk nor at the configured URL.
|
||||
# This mechanism was added because old Ubuntu ISOs are removed from the server
|
||||
# as soon as a new ISO appears.
|
||||
function update_iso_variables {
|
||||
# Get matching line from distro repo's MD5SUMS file, e.g.
|
||||
# "9e5fecc94b3925bededed0fdca1bd417 *ubuntu-14.04.3-server-amd64.iso"
|
||||
local distro_info=$(wget -O - "$ISO_URL_BASE/MD5SUMS" | \
|
||||
grep "server-amd64.*\.iso" | tail -n1)
|
||||
|
||||
# First part (removing everything after first space) is the md5sum
|
||||
ISO_MD5=${distro_info%% *}
|
||||
|
||||
# Second part (keeping everything after ' *') is the ISO file name
|
||||
local iso_file=${distro_info#* \*}
|
||||
|
||||
ISO_URL=$ISO_URL_BASE/$iso_file
|
||||
|
||||
echo -e >&2 "${CStatus:-}New ISO_URL: ${CData:-}$ISO_URL${CReset:-}"
|
||||
}
|
||||
|
||||
# ostype used by VirtualBox to choose icon and flags (64-bit, IOAPIC)
|
||||
VBOX_OSTYPE=Ubuntu_64
|
||||
|
||||
# Boot the ISO image operating system installer
|
||||
function distro_start_installer {
|
||||
local vm_name=$1
|
||||
|
||||
# pick a _PS_* file
|
||||
local preseed=_PS_$VM_ACCESS
|
||||
|
||||
echo "Using $preseed ${!preseed}"
|
||||
|
||||
local boot_args=$(printf "$_BOOT_ARGS" "${!preseed}")
|
||||
|
||||
if [ -n "${VM_PROXY:-""}" ]; then
|
||||
echo >&2 "Using proxy $VM_PROXY."
|
||||
boot_args="$boot_args mirror/http/proxy=$VM_PROXY http_proxy=$VM_PROXY"
|
||||
fi
|
||||
|
||||
keyboard_send_escape "$vm_name"
|
||||
keyboard_send_escape "$vm_name"
|
||||
keyboard_send_enter "$vm_name"
|
||||
|
||||
conditional_sleep 1
|
||||
|
||||
echo -e "${CStatus:-}Pushing boot command line${CReset:-}"
|
||||
keyboard_send_string "$vm_name" "$boot_args"
|
||||
|
||||
echo "Initiating boot sequence"
|
||||
keyboard_send_enter "$vm_name"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,80 +0,0 @@
|
||||
# Ubuntu 14.04 LTS i386 server
|
||||
|
||||
# Default scripts for all Ubuntu installs
|
||||
: ${BASE_INSTALL_SCRIPTS:=scripts.ubuntu_base}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Installation from ISO image
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
readonly ISO_URL_BASE=http://releases.ubuntu.com/14.04
|
||||
|
||||
ISO_URL=$ISO_URL_BASE/ubuntu-14.04.5-server-i386.iso
|
||||
ISO_MD5=812ac191b8898b33aed4aef9ab066b5a
|
||||
|
||||
readonly _PS_ssh=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-ssh-v4.cfg
|
||||
readonly _PS_vbadd=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-vbadd.cfg
|
||||
readonly _PS_all=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-all-v2.cfg
|
||||
|
||||
# Arguments for ISO image installer
|
||||
readonly _BOOT_ARGS="/install/vmlinuz
|
||||
noapic
|
||||
preseed/url=%s
|
||||
debian-installer=en_US
|
||||
auto=true
|
||||
locale=en_US
|
||||
hostname=osbash
|
||||
fb=false
|
||||
debconf/frontend=noninteractive
|
||||
keyboard-configuration/modelcode=SKIP
|
||||
initrd=/install/initrd.gz
|
||||
console-setup/ask_detect=false"
|
||||
|
||||
# Fallback function to find current ISO image in case the file in ISO_URL is
|
||||
# neither on the disk nor at the configured URL.
|
||||
# This mechanism was added because old Ubuntu ISOs are removed from the server
|
||||
# as soon as a new ISO appears.
|
||||
function update_iso_variables {
|
||||
# Get matching line from distro repo's MD5SUMS file, e.g.
|
||||
# "9e5fecc94b3925bededed0fdca1bd417 *ubuntu-14.04.5-server-i386.iso"
|
||||
local distro_info=$(wget -O - "$ISO_URL_BASE/MD5SUMS" | \
|
||||
grep "server-i386.*\.iso" | tail -n1)
|
||||
|
||||
# First part (removing everything after first space) is the md5sum
|
||||
ISO_MD5=${distro_info%% *}
|
||||
|
||||
# Second part (keeping everything after ' *') is the ISO file name
|
||||
local iso_file=${distro_info#* \*}
|
||||
|
||||
ISO_URL=$ISO_URL_BASE/$iso_file
|
||||
|
||||
echo -e >&2 "${CStatus:-}New ISO_URL: ${CData:-}$ISO_URL${CReset:-}"
|
||||
}
|
||||
|
||||
VBOX_OSTYPE=Ubuntu
|
||||
|
||||
# Boot the ISO image operating system installer
|
||||
function distro_start_installer {
|
||||
local vm_name=$1
|
||||
|
||||
# pick a _PS_* file
|
||||
local preseed=_PS_$VM_ACCESS
|
||||
|
||||
echo "Using $preseed ${!preseed}"
|
||||
|
||||
local boot_args=$(printf "$_BOOT_ARGS" "${!preseed}")
|
||||
|
||||
keyboard_send_escape "$vm_name"
|
||||
keyboard_send_escape "$vm_name"
|
||||
keyboard_send_enter "$vm_name"
|
||||
|
||||
conditional_sleep 1
|
||||
|
||||
echo -e "${CStatus:-}Pushing boot command line${CReset:-}"
|
||||
keyboard_send_string "$vm_name" "$boot_args"
|
||||
|
||||
echo "Initiating boot sequence"
|
||||
keyboard_send_enter "$vm_name"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,89 +0,0 @@
|
||||
# Ubuntu 16.04 LTS amd64 server
|
||||
|
||||
# Default scripts for all Ubuntu installs
|
||||
: ${BASE_INSTALL_SCRIPTS:=scripts.ubuntu_base}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Installation from ISO image
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
readonly ISO_URL_BASE=http://releases.ubuntu.com/16.04
|
||||
|
||||
ISO_URL=$ISO_URL_BASE/ubuntu-16.04.5-server-amd64.iso
|
||||
ISO_MD5=24636fd103a2a43c95659f1c3c63718e
|
||||
|
||||
readonly _PS_ssh=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-ssh-v6.cfg
|
||||
readonly _PS_vbadd=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-vbadd-v6.cfg
|
||||
readonly _PS_all=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-all-v6.cfg
|
||||
|
||||
# Arguments for ISO image installer
|
||||
readonly _BOOT_ARGS="/install/vmlinuz
|
||||
noapic
|
||||
preseed/url=%s
|
||||
debian-installer=en_US
|
||||
auto=true
|
||||
locale=en_US
|
||||
hostname=osbash
|
||||
fb=false
|
||||
debconf/frontend=noninteractive
|
||||
keyboard-configuration/modelcode=SKIP
|
||||
initrd=/install/initrd.gz
|
||||
console-setup/ask_detect=false"
|
||||
|
||||
# file=/bin/cdrom-checker-menu vga=788 initrd=/install/initrd.gz quiet ---
|
||||
|
||||
# Fallback function to find current ISO image in case the file in ISO_URL is
|
||||
# neither on the disk nor at the configured URL.
|
||||
# This mechanism was added because old Ubuntu ISOs are removed from the server
|
||||
# as soon as a new ISO appears.
|
||||
function update_iso_variables {
|
||||
# Get matching line from distro repo's MD5SUMS file, e.g.
|
||||
# "9e5fecc94b3925bededed0fdca1bd417 *ubuntu-14.04.3-server-amd64.iso"
|
||||
local distro_info=$(wget -O - "$ISO_URL_BASE/MD5SUMS" | \
|
||||
grep "server-amd64.*\.iso" | tail -n1)
|
||||
|
||||
# First part (removing everything after first space) is the md5sum
|
||||
ISO_MD5=${distro_info%% *}
|
||||
|
||||
# Second part (keeping everything after ' *') is the ISO file name
|
||||
local iso_file=${distro_info#* \*}
|
||||
|
||||
ISO_URL=$ISO_URL_BASE/$iso_file
|
||||
|
||||
echo -e >&2 "${CStatus:-}New ISO_URL: ${CData:-}$ISO_URL${CReset:-}"
|
||||
}
|
||||
|
||||
# ostype used by VirtualBox to choose icon and flags (64-bit, IOAPIC)
|
||||
VBOX_OSTYPE=Ubuntu_64
|
||||
|
||||
# Boot the ISO image operating system installer
|
||||
function distro_start_installer {
|
||||
local vm_name=$1
|
||||
|
||||
# pick a _PS_* file
|
||||
local preseed=_PS_$VM_ACCESS
|
||||
|
||||
echo "Using $preseed ${!preseed}"
|
||||
|
||||
local boot_args=$(printf "$_BOOT_ARGS" "${!preseed}")
|
||||
|
||||
if [ -n "${VM_PROXY:-""}" ]; then
|
||||
echo >&2 "Using proxy $VM_PROXY."
|
||||
boot_args="$boot_args mirror/http/proxy=$VM_PROXY http_proxy=$VM_PROXY"
|
||||
fi
|
||||
|
||||
keyboard_send_enter "$vm_name"
|
||||
keyboard_send_f6 "$vm_name"
|
||||
keyboard_send_escape "$vm_name"
|
||||
for i in $(seq 1 83); do
|
||||
keyboard_send_backspace "$vm_name"
|
||||
done
|
||||
|
||||
echo -e "${CStatus:-}Pushing boot command line${CReset:-}"
|
||||
keyboard_send_string "$vm_name" "$boot_args"
|
||||
|
||||
echo "Initiating boot sequence"
|
||||
keyboard_send_enter "$vm_name"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,87 +0,0 @@
|
||||
# Ubuntu 16.04 LTS i386 server
|
||||
|
||||
# Default scripts for all Ubuntu installs
|
||||
: ${BASE_INSTALL_SCRIPTS:=scripts.ubuntu_base}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Installation from ISO image
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
readonly ISO_URL_BASE=http://releases.ubuntu.com/16.04
|
||||
|
||||
ISO_URL=$ISO_URL_BASE/ubuntu-16.04.5-server-i386.iso
|
||||
ISO_MD5=9ba5fefe27685ae69f991c45396080af
|
||||
|
||||
readonly _PS_ssh=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-ssh-v6.cfg
|
||||
readonly _PS_vbadd=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-vbadd-v6.cfg
|
||||
readonly _PS_all=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-all-v6.cfg
|
||||
|
||||
# Arguments for ISO image installer
|
||||
readonly _BOOT_ARGS="/install/vmlinuz
|
||||
noapic
|
||||
preseed/url=%s
|
||||
debian-installer=en_US
|
||||
auto=true
|
||||
locale=en_US
|
||||
hostname=osbash
|
||||
fb=false
|
||||
debconf/frontend=noninteractive
|
||||
keyboard-configuration/modelcode=SKIP
|
||||
initrd=/install/initrd.gz
|
||||
console-setup/ask_detect=false"
|
||||
|
||||
# Fallback function to find current ISO image in case the file in ISO_URL is
|
||||
# neither on the disk nor at the configured URL.
|
||||
# This mechanism was added because old Ubuntu ISOs are removed from the server
|
||||
# as soon as a new ISO appears.
|
||||
function update_iso_variables {
|
||||
# Get matching line from distro repo's MD5SUMS file, e.g.
|
||||
# "9e5fecc94b3925bededed0fdca1bd417 *ubuntu-14.04.3-server-i386.iso"
|
||||
local distro_info=$(wget -O - "$ISO_URL_BASE/MD5SUMS" | \
|
||||
grep "server-i386.*\.iso" | tail -n1)
|
||||
|
||||
# First part (removing everything after first space) is the md5sum
|
||||
ISO_MD5=${distro_info%% *}
|
||||
|
||||
# Second part (keeping everything after ' *') is the ISO file name
|
||||
local iso_file=${distro_info#* \*}
|
||||
|
||||
ISO_URL=$ISO_URL_BASE/$iso_file
|
||||
|
||||
echo -e >&2 "${CStatus:-}New ISO_URL: ${CData:-}$ISO_URL${CReset:-}"
|
||||
}
|
||||
|
||||
# ostype used by VirtualBox to choose icon and flags (64-bit, IOAPIC)
|
||||
VBOX_OSTYPE=Ubuntu
|
||||
|
||||
# Boot the ISO image operating system installer
|
||||
function distro_start_installer {
|
||||
local vm_name=$1
|
||||
|
||||
# pick a _PS_* file
|
||||
local preseed=_PS_$VM_ACCESS
|
||||
|
||||
echo "Using $preseed ${!preseed}"
|
||||
|
||||
local boot_args=$(printf "$_BOOT_ARGS" "${!preseed}")
|
||||
|
||||
if [ -n "${VM_PROXY:-""}" ]; then
|
||||
echo >&2 "Using proxy $VM_PROXY."
|
||||
boot_args="$boot_args mirror/http/proxy=$VM_PROXY http_proxy=$VM_PROXY"
|
||||
fi
|
||||
|
||||
keyboard_send_enter "$vm_name"
|
||||
keyboard_send_f6 "$vm_name"
|
||||
keyboard_send_escape "$vm_name"
|
||||
for i in $(seq 1 83); do
|
||||
keyboard_send_backspace "$vm_name"
|
||||
done
|
||||
|
||||
echo -e "${CStatus:-}Pushing boot command line${CReset:-}"
|
||||
keyboard_send_string "$vm_name" "$boot_args"
|
||||
|
||||
echo "Initiating boot sequence"
|
||||
keyboard_send_enter "$vm_name"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,75 +0,0 @@
|
||||
#platform=x86, AMD64, or Intel EM64T
|
||||
#version=DEVEL
|
||||
# Install OS instead of upgrade
|
||||
install
|
||||
# Keyboard layouts
|
||||
keyboard 'us'
|
||||
# Reboot after installation
|
||||
reboot --eject
|
||||
# Root password
|
||||
rootpw --plaintext osbash
|
||||
# User
|
||||
user --name=osbash --password=osbash --plaintext
|
||||
# System timezone
|
||||
timezone Etc/UTC --isUtc
|
||||
# System language
|
||||
lang en_US
|
||||
# Firewall configuration
|
||||
firewall --disabled
|
||||
# System authorization information
|
||||
auth --useshadow --passalgo=sha512
|
||||
# Use CDROM installation media
|
||||
cdrom
|
||||
# Use text mode install
|
||||
text
|
||||
# SELinux configuration
|
||||
selinux --permissive
|
||||
# Do not configure the X Window System
|
||||
skipx
|
||||
|
||||
# System bootloader configuration
|
||||
bootloader --location=mbr
|
||||
# Partition clearing information
|
||||
clearpart --all
|
||||
|
||||
part /boot --fstype=ext4 --size=1024
|
||||
part pv.0 --grow --size=1
|
||||
volgroup ROOTDISK --pesize=4096 pv.0
|
||||
logvol swap --name=swap --vgname=ROOTDISK --recommended
|
||||
logvol / --fstype=ext4 --name=root --vgname=ROOTDISK --size=1 --grow
|
||||
|
||||
%pre --interpreter=bash
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# Enable ssh login with insecure osbash key and password-less sudo for osbash
|
||||
# Install VirtualBox guest additions, bootstrap osbashauto
|
||||
%post --interpreter=/bin/bash
|
||||
DIR=/home/osbash/.ssh
|
||||
mkdir $DIR
|
||||
wget -O $DIR/authorized_keys https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash-ssh-keys/osbash_key.pub
|
||||
chmod 700 $DIR
|
||||
chmod 400 $DIR/authorized_keys
|
||||
chown -R osbash:osbash $DIR
|
||||
echo "osbash ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
echo "Defaults:osbash !requiretty" >> /etc/sudoers
|
||||
|
||||
yum -y install dkms
|
||||
|
||||
mount /dev/sr1 /mnt
|
||||
/mnt/VBoxLinuxAdditions.run
|
||||
umount /mnt
|
||||
|
||||
echo -e '#!/bin/bash\nbash /media/sf_*/autostart/*activate_autostart.sh\nrm /media/*/autostart/*activate_autostart.sh' > /etc/init.d/osbash
|
||||
chmod 755 /etc/init.d/osbash
|
||||
ln -s ../init.d/osbash /etc/rc2.d/S40osbash
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# tar, bzip2, kernel-{devel,headers}: needed for VirtualBox guest additions
|
||||
# (but not in @core)
|
||||
%packages
|
||||
wget
|
||||
tar
|
||||
bzip2
|
||||
kernel-devel
|
||||
kernel-headers
|
||||
%end
|
@ -1,75 +0,0 @@
|
||||
#platform=x86, AMD64, or Intel EM64T
|
||||
#version=DEVEL
|
||||
# Install OS instead of upgrade
|
||||
install
|
||||
# Keyboard layouts
|
||||
keyboard 'us'
|
||||
# Reboot after installation
|
||||
reboot --eject
|
||||
# Root password
|
||||
rootpw --plaintext osbash
|
||||
# User
|
||||
user --name=osbash --password=osbash --plaintext
|
||||
# System timezone
|
||||
timezone Etc/UTC --isUtc
|
||||
# System language
|
||||
lang en_US
|
||||
# Firewall configuration
|
||||
firewall --disabled
|
||||
# System authorization information
|
||||
auth --useshadow --passalgo=sha512
|
||||
# Use CDROM installation media
|
||||
cdrom
|
||||
# Use text mode install
|
||||
text
|
||||
# SELinux configuration
|
||||
selinux --permissive
|
||||
# Do not configure the X Window System
|
||||
skipx
|
||||
|
||||
# System bootloader configuration
|
||||
bootloader --location=mbr
|
||||
# Partition clearing information
|
||||
clearpart --all
|
||||
|
||||
part /boot --fstype=ext4 --size=1024
|
||||
part pv.0 --grow --size=1
|
||||
volgroup ROOTDISK --pesize=4096 pv.0
|
||||
logvol swap --name=swap --vgname=ROOTDISK --recommended
|
||||
logvol / --fstype=ext4 --name=root --vgname=ROOTDISK --size=1 --grow
|
||||
|
||||
%pre --interpreter=bash
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# Enable ssh login with insecure Vagrant key and password-less sudo for osbash
|
||||
# Install VirtualBox guest additions, bootstrap osbashauto
|
||||
%post --interpreter=/bin/bash
|
||||
DIR=/home/osbash/.ssh
|
||||
mkdir $DIR
|
||||
wget -O $DIR/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
|
||||
chmod 700 $DIR
|
||||
chmod 400 $DIR/authorized_keys
|
||||
chown -R osbash:osbash $DIR
|
||||
echo "osbash ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
echo "Defaults:osbash !requiretty" >> /etc/sudoers
|
||||
|
||||
yum -y install dkms
|
||||
|
||||
mount /dev/sr1 /mnt
|
||||
/mnt/VBoxLinuxAdditions.run
|
||||
umount /mnt
|
||||
|
||||
echo -e '#!/bin/bash\nbash /media/sf_*/autostart/*activate_autostart.sh\nrm /media/*/autostart/*activate_autostart.sh' > /etc/init.d/osbash
|
||||
chmod 755 /etc/init.d/osbash
|
||||
ln -s ../init.d/osbash /etc/rc2.d/S40osbash
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# tar, bzip2, kernel-{devel,headers}: needed for VirtualBox guest additions
|
||||
# (but not in @core)
|
||||
%packages
|
||||
wget
|
||||
tar
|
||||
bzip2
|
||||
kernel-devel
|
||||
kernel-headers
|
||||
%end
|
@ -1,58 +0,0 @@
|
||||
#platform=x86, AMD64, or Intel EM64T
|
||||
#version=DEVEL
|
||||
# Install OS instead of upgrade
|
||||
install
|
||||
# Keyboard layouts
|
||||
keyboard 'us'
|
||||
# Reboot after installation
|
||||
reboot --eject
|
||||
# Root password
|
||||
rootpw --plaintext osbash
|
||||
# User
|
||||
user --name=osbash --password=osbash --plaintext
|
||||
# System timezone
|
||||
timezone Etc/UTC --isUtc
|
||||
# System language
|
||||
lang en_US
|
||||
# Firewall configuration
|
||||
firewall --disabled
|
||||
# System authorization information
|
||||
auth --useshadow --passalgo=sha512
|
||||
# Use CDROM installation media
|
||||
cdrom
|
||||
# Use text mode install
|
||||
text
|
||||
# SELinux configuration
|
||||
selinux --permissive
|
||||
# Do not configure the X Window System
|
||||
skipx
|
||||
|
||||
# System bootloader configuration
|
||||
bootloader --location=mbr
|
||||
# Partition clearing information
|
||||
clearpart --all
|
||||
|
||||
part /boot --fstype=ext4 --size=1024
|
||||
part pv.0 --grow --size=1
|
||||
volgroup ROOTDISK --pesize=4096 pv.0
|
||||
logvol swap --name=swap --vgname=ROOTDISK --recommended
|
||||
logvol / --fstype=ext4 --name=root --vgname=ROOTDISK --size=1 --grow
|
||||
|
||||
%pre --interpreter=bash
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# Enable ssh login with insecure osbash key and password-less sudo for osbash
|
||||
%post --interpreter=/bin/bash
|
||||
DIR=/home/osbash/.ssh
|
||||
mkdir $DIR
|
||||
wget -O $DIR/authorized_keys https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash-ssh-keys/osbash_key.pub
|
||||
chmod 700 $DIR
|
||||
chmod 400 $DIR/authorized_keys
|
||||
chown -R osbash:osbash $DIR
|
||||
echo "osbash ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
echo "Defaults:osbash !requiretty" >> /etc/sudoers
|
||||
%end
|
||||
|
||||
%packages
|
||||
wget
|
||||
%end
|
@ -1,58 +0,0 @@
|
||||
#platform=x86, AMD64, or Intel EM64T
|
||||
#version=DEVEL
|
||||
# Install OS instead of upgrade
|
||||
install
|
||||
# Keyboard layouts
|
||||
keyboard 'us'
|
||||
# Reboot after installation
|
||||
reboot --eject
|
||||
# Root password
|
||||
rootpw --plaintext osbash
|
||||
# User
|
||||
user --name=osbash --password=osbash --plaintext
|
||||
# System timezone
|
||||
timezone Etc/UTC --isUtc
|
||||
# System language
|
||||
lang en_US
|
||||
# Firewall configuration
|
||||
firewall --disabled
|
||||
# System authorization information
|
||||
auth --useshadow --passalgo=sha512
|
||||
# Use CDROM installation media
|
||||
cdrom
|
||||
# Use text mode install
|
||||
text
|
||||
# SELinux configuration
|
||||
selinux --permissive
|
||||
# Do not configure the X Window System
|
||||
skipx
|
||||
|
||||
# System bootloader configuration
|
||||
bootloader --location=mbr
|
||||
# Partition clearing information
|
||||
clearpart --all
|
||||
|
||||
part /boot --fstype=ext4 --size=1024
|
||||
part pv.0 --grow --size=1
|
||||
volgroup ROOTDISK --pesize=4096 pv.0
|
||||
logvol swap --name=swap --vgname=ROOTDISK --recommended
|
||||
logvol / --fstype=ext4 --name=root --vgname=ROOTDISK --size=1 --grow
|
||||
|
||||
%pre --interpreter=bash
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# Enable ssh login with insecure Vagrant key and password-less sudo for osbash
|
||||
%post --interpreter=/bin/bash
|
||||
DIR=/home/osbash/.ssh
|
||||
mkdir $DIR
|
||||
wget -O $DIR/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
|
||||
chmod 700 $DIR
|
||||
chmod 400 $DIR/authorized_keys
|
||||
chown -R osbash:osbash $DIR
|
||||
echo "osbash ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
echo "Defaults:osbash !requiretty" >> /etc/sudoers
|
||||
%end
|
||||
|
||||
%packages
|
||||
wget
|
||||
%end
|
@ -1,64 +0,0 @@
|
||||
#platform=x86, AMD64, or Intel EM64T
|
||||
#version=DEVEL
|
||||
# Install OS instead of upgrade
|
||||
install
|
||||
# Keyboard layouts
|
||||
keyboard 'us'
|
||||
# Reboot after installation
|
||||
reboot --eject
|
||||
# Root password
|
||||
rootpw --plaintext osbash
|
||||
# System timezone
|
||||
timezone Etc/UTC --isUtc
|
||||
# System language
|
||||
lang en_US
|
||||
# Firewall configuration
|
||||
firewall --disabled
|
||||
# System authorization information
|
||||
auth --useshadow --passalgo=sha512
|
||||
# Use CDROM installation media
|
||||
cdrom
|
||||
# Use text mode install
|
||||
text
|
||||
# SELinux configuration
|
||||
selinux --permissive
|
||||
# Do not configure the X Window System
|
||||
skipx
|
||||
|
||||
# System bootloader configuration
|
||||
bootloader --location=mbr
|
||||
# Partition clearing information
|
||||
clearpart --all
|
||||
|
||||
part /boot --fstype=ext4 --size=1024
|
||||
part pv.0 --grow --size=1
|
||||
volgroup ROOTDISK --pesize=4096 pv.0
|
||||
logvol swap --name=swap --vgname=ROOTDISK --recommended
|
||||
logvol / --fstype=ext4 --name=root --vgname=ROOTDISK --size=1 --grow
|
||||
|
||||
%pre --interpreter=bash
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# Install VirtualBox guest additions, bootstrap osbashauto
|
||||
%post --interpreter=/bin/bash
|
||||
|
||||
yum -y install dkms
|
||||
|
||||
mount /dev/sr1 /mnt
|
||||
/mnt/VBoxLinuxAdditions.run
|
||||
umount /mnt
|
||||
|
||||
echo -e '#!/bin/bash\nbash /media/sf_*/autostart/*activate_autostart.sh\nrm /media/*/autostart/*activate_autostart.sh' > /etc/init.d/osbash
|
||||
chmod 755 /etc/init.d/osbash
|
||||
ln -s ../init.d/osbash /etc/rc2.d/S40osbash
|
||||
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# tar, bzip2, kernel-{devel,headers}: needed for VirtualBox guest additions
|
||||
# (but not in @core)
|
||||
%packages
|
||||
tar
|
||||
bzip2
|
||||
kernel-devel
|
||||
kernel-headers
|
||||
%end
|
@ -1,120 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
tasksel tasksel/first minimal
|
||||
|
||||
# Individual additional packages to install
|
||||
d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string echo "DIR=/home/osbash/.ssh; mkdir \$DIR; wget -O \$DIR/authorized_keys https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash-ssh-keys/osbash_key.pub ; chmod 700 \$DIR; chmod 400 \$DIR/authorized_keys; chown -R osbash:osbash \$DIR; echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; echo 'Defaults:osbash !requiretty' >> /etc/sudoers; apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils; mount /dev/sr1 /mnt; /mnt/VBoxLinuxAdditions.run; umount /mnt; echo -e '#!/bin/bash\nexec > /root/bootstrap.log 2>&1\nset -x\nSCR=/media/sf_bootstrap/autostart/*activate_autostart.sh\nwhile [ ! -f \$SCR ];do sleep 1;done\nbash \$SCR\nrm -v \$SCR' > /etc/rc2.d/S40osbash; chmod 755 /etc/rc2.d/S40osbash;" | chroot /target /bin/bash;
|
@ -1,146 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
d-i partman-auto/disk string /dev/sda
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
# (standard system utilities, OpenSSH server, Basic Ubuntu server)
|
||||
tasksel tasksel/first standard system utilities
|
||||
|
||||
# Individual additional packages to install
|
||||
# pkgsel/include disabled because it seems to cause non-deterministic installer
|
||||
# errors with Ubuntu LTS 16.04.2; installing in late_command instead
|
||||
#d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
|
||||
# Halt after installation
|
||||
#d-i debian-installer/exit/poweroff boolean true
|
||||
#ubiquity ubiquity/poweroff boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string DIR=/target/home/osbash/.ssh; \
|
||||
mkdir -v $DIR; \
|
||||
chmod 700 $DIR; \
|
||||
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key' >> $DIR/authorized_keys; \
|
||||
in-target chown -Rv osbash:osbash /home/osbash/.ssh; \
|
||||
echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers; \
|
||||
echo 'Defaults:osbash !requiretty' >> /target/etc/sudoers; \
|
||||
in-target apt-get -y install openssh-server; \
|
||||
echo "installed openssh" >> /target/root/preseed.log; \
|
||||
in-target apt-get -y install localepurge; \
|
||||
echo "installed localepurge" >> /target/root/preseed.log; \
|
||||
in-target apt-get -y install dkms; \
|
||||
echo "installed dkms" >> /target/root/preseed.log; \
|
||||
chroot /target/ apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils >/target/root/01_vbox_purge 2>&1; \
|
||||
mount /dev/sr1 /target/mnt; \
|
||||
chroot /target /mnt/VBoxLinuxAdditions.run >/target/root/02_vbox_guestadd 2>&1; \
|
||||
umount /target/mnt; \
|
||||
sed -i 's/exit 0/# exit 0/' /target/etc/rc.local; \
|
||||
echo 'exec > /root/bootstrap.log 2>&1;set -x;SCR=/media/sf_bootstrap/autostart/*activate_autostart.sh;while [ ! -f $SCR ];do sleep 1;done;bash $SCR;rm -v $SCR' >> /target/etc/rc.local;
|
@ -1,149 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
d-i partman-auto/disk string /dev/sda
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
# (standard system utilities, OpenSSH server, Basic Ubuntu server)
|
||||
tasksel tasksel/first standard system utilities
|
||||
|
||||
# Individual additional packages to install
|
||||
# pkgsel/include disabled because it seems to cause non-deterministic installer
|
||||
# errors with Ubuntu LTS 16.04.2; installing in late_command instead
|
||||
#d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
|
||||
# Halt after installation
|
||||
#d-i debian-installer/exit/poweroff boolean true
|
||||
#ubiquity ubiquity/poweroff boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string DIR=/target/home/osbash/.ssh; \
|
||||
mkdir -v $DIR; \
|
||||
chmod 700 $DIR; \
|
||||
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key' >> $DIR/authorized_keys; \
|
||||
in-target chown -Rv osbash:osbash /home/osbash/.ssh; \
|
||||
echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers; \
|
||||
echo 'Defaults:osbash !requiretty' >> /target/etc/sudoers; \
|
||||
in-target apt-get -y install openssh-server; \
|
||||
echo "installed openssh" >> /target/root/preseed.log; \
|
||||
in-target apt-get -y install localepurge; \
|
||||
echo "installed localepurge" >> /target/root/preseed.log; \
|
||||
in-target apt-get -y install dkms; \
|
||||
echo "installed dkms" >> /target/root/preseed.log; \
|
||||
chroot /target/ apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils >/target/root/01_vbox_purge 2>&1; \
|
||||
mount /dev/sr1 /target/mnt; \
|
||||
chroot /target /mnt/VBoxLinuxAdditions.run >/target/root/02_vbox_guestadd 2>&1; \
|
||||
umount /target/mnt; \
|
||||
sed -i 's/exit 0/# exit 0/' /target/etc/rc.local; \
|
||||
echo '#!/bin/bash' > /target/etc/rc.local; \
|
||||
echo 'exec > /root/bootstrap.log 2>&1;set -x;SCR=/media/sf_bootstrap/autostart/*activate_autostart.sh;while [ ! -f $SCR ];do sleep 2;done;bash $SCR;rm -v $SCR' >> /target/etc/rc.local; \
|
||||
chmod a+x /target/etc/rc.local; \
|
||||
echo "created /etc/rc.local" >> /target/root/preseed.log;
|
@ -1,120 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
tasksel tasksel/first minimal
|
||||
|
||||
# Individual additional packages to install
|
||||
d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string echo "DIR=/home/osbash/.ssh; mkdir \$DIR; wget -O \$DIR/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub ; chmod 700 \$DIR; chmod 400 \$DIR/authorized_keys; chown -R osbash:osbash \$DIR; echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; echo 'Defaults:osbash !requiretty' >> /etc/sudoers; apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils; mount /dev/sr1 /mnt; /mnt/VBoxLinuxAdditions.run; umount /mnt; echo -e '#!/bin/bash\nexec > /root/bootstrap.log 2>&1\nset -x\nSCR=/media/sf_bootstrap/autostart/*activate_autostart.sh\nwhile [ ! -f \$SCR ];do sleep 1;done\nbash \$SCR\nrm -v \$SCR' > /etc/rc2.d/S40osbash; chmod 755 /etc/rc2.d/S40osbash;" | chroot /target /bin/bash;
|
@ -1,120 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
tasksel tasksel/first minimal
|
||||
|
||||
# Individual additional packages to install
|
||||
d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string echo "DIR=/home/osbash/.ssh; mkdir \$DIR; wget -O \$DIR/authorized_keys https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash-ssh-keys/osbash_key.pub ; chmod 700 \$DIR; chmod 400 \$DIR/authorized_keys; chown -R osbash:osbash \$DIR; echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; echo 'Defaults:osbash !requiretty' >> /etc/sudoers;" | chroot /target /bin/bash;
|
@ -1,125 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
d-i partman-auto/disk string /dev/sda
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
tasksel tasksel/first minimal
|
||||
|
||||
# Individual additional packages to install
|
||||
d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
|
||||
# Halt after installation
|
||||
#d-i debian-installer/exit/poweroff boolean true
|
||||
#ubiquity ubiquity/poweroff boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string echo "DIR=/home/osbash/.ssh; mkdir \$DIR; wget -O \$DIR/authorized_keys https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash-ssh-keys/osbash_key.pub ; chmod 700 \$DIR; chmod 400 \$DIR/authorized_keys; chown -R osbash:osbash \$DIR; echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; echo 'Defaults:osbash !requiretty' >> /etc/sudoers;" | chroot /target /bin/bash;
|
@ -1,131 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
d-i partman-auto/disk string /dev/sda
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
tasksel tasksel/first minimal
|
||||
|
||||
# Individual additional packages to install
|
||||
d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
|
||||
# Halt after installation
|
||||
#d-i debian-installer/exit/poweroff boolean true
|
||||
#ubiquity ubiquity/poweroff boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string DIR=/target/home/osbash/.ssh; \
|
||||
mkdir -v $DIR; \
|
||||
chmod 700 $DIR; \
|
||||
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key' >> $DIR/authorized_keys; \
|
||||
in-target chown -Rv osbash:osbash /home/osbash/.ssh; \
|
||||
echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers; \
|
||||
echo 'Defaults:osbash !requiretty' >> /target/etc/sudoers
|
@ -1,132 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
d-i partman-auto/disk string /dev/sda
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
tasksel tasksel/first minimal
|
||||
|
||||
# Individual additional packages to install
|
||||
d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
d-i grub-installer/bootdev string /dev/sda
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
|
||||
# Halt after installation
|
||||
#d-i debian-installer/exit/poweroff boolean true
|
||||
#ubiquity ubiquity/poweroff boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string DIR=/target/home/osbash/.ssh; \
|
||||
mkdir -v $DIR; \
|
||||
chmod 700 $DIR; \
|
||||
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key' >> $DIR/authorized_keys; \
|
||||
in-target chown -Rv osbash:osbash /home/osbash/.ssh; \
|
||||
echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers; \
|
||||
echo 'Defaults:osbash !requiretty' >> /target/etc/sudoers
|
@ -1,140 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/16.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/16.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
d-i partman-auto/disk string /dev/sda
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
# (standard system utilities, OpenSSH server, Basic Ubuntu server)
|
||||
tasksel tasksel/first standard system utilities
|
||||
|
||||
# Individual additional packages to install
|
||||
# pkgsel/include disabled because it seems to cause non-deterministic installer
|
||||
# errors with Ubuntu LTS 16.04.2; installing in late_command instead
|
||||
#d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
|
||||
# Halt after installation
|
||||
#d-i debian-installer/exit/poweroff boolean true
|
||||
#ubiquity ubiquity/poweroff boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string DIR=/target/home/osbash/.ssh; \
|
||||
mkdir -v $DIR; \
|
||||
chmod 700 $DIR; \
|
||||
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key' >> $DIR/authorized_keys; \
|
||||
in-target chown -Rv osbash:osbash /home/osbash/.ssh; \
|
||||
echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers; \
|
||||
echo 'Defaults:osbash !requiretty' >> /target/etc/sudoers; \
|
||||
in-target apt-get -y install openssh-server; \
|
||||
echo "installed openssh" >> /target/root/preseed.log; \
|
||||
in-target apt-get -y install localepurge; \
|
||||
echo "installed localepurge" >> /target/root/preseed.log; \
|
||||
in-target apt-get -y install dkms; \
|
||||
echo "installed dkms" >> /target/root/preseed.log
|
@ -1,120 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
tasksel tasksel/first minimal
|
||||
|
||||
# Individual additional packages to install
|
||||
d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string echo "DIR=/home/osbash/.ssh; mkdir \$DIR; wget -O \$DIR/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub ; chmod 700 \$DIR; chmod 400 \$DIR/authorized_keys; chown -R osbash:osbash \$DIR; echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; echo 'Defaults:osbash !requiretty' >> /etc/sudoers;" | chroot /target /bin/bash;
|
@ -1,130 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
d-i partman-auto/disk string /dev/sda
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
tasksel tasksel/first minimal
|
||||
|
||||
# Individual additional packages to install
|
||||
d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
|
||||
# Halt after installation
|
||||
#d-i debian-installer/exit/poweroff boolean true
|
||||
#ubiquity ubiquity/poweroff boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string chroot /target/ apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils >/target/root/01_vbox_purge 2>&1; \
|
||||
mount /dev/sr1 /target/mnt; \
|
||||
chroot /target /mnt/VBoxLinuxAdditions.run >/target/root/02_vbox_guestadd 2>&1; \
|
||||
umount /target/mnt; \
|
||||
sed -i 's/exit 0/# exit 0/' /target/etc/rc.local; \
|
||||
echo 'exec > /root/bootstrap.log 2>&1;set -x;SCR=/media/sf_bootstrap/autostart/*activate_autostart.sh;while [ ! -f $SCR ];do sleep 1;done;bash $SCR;rm -v $SCR' >> /target/etc/rc.local;
|
@ -1,146 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
d-i partman-auto/disk string /dev/sda
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
# (standard system utilities, OpenSSH server, Basic Ubuntu server)
|
||||
tasksel tasksel/first standard system utilities
|
||||
|
||||
# Individual additional packages to install
|
||||
# pkgsel/include disabled because it seems to cause non-deterministic installer
|
||||
# errors with Ubuntu LTS 16.04.2; installing in late_command instead
|
||||
#d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
|
||||
# Halt after installation
|
||||
#d-i debian-installer/exit/poweroff boolean true
|
||||
#ubiquity ubiquity/poweroff boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string DIR=/target/home/osbash/.ssh; \
|
||||
mkdir -v $DIR; \
|
||||
chmod 700 $DIR; \
|
||||
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key' >> $DIR/authorized_keys; \
|
||||
in-target chown -Rv osbash:osbash /home/osbash/.ssh; \
|
||||
echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers; \
|
||||
echo 'Defaults:osbash !requiretty' >> /target/etc/sudoers; \
|
||||
in-target apt-get -y install openssh-server; \
|
||||
echo "installed openssh" >> /target/root/preseed.log; \
|
||||
in-target apt-get -y install localepurge; \
|
||||
echo "installed localepurge" >> /target/root/preseed.log; \
|
||||
in-target apt-get -y install dkms; \
|
||||
echo "installed dkms" >> /target/root/preseed.log; \
|
||||
chroot /target/ apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils >/target/root/01_vbox_purge 2>&1; \
|
||||
mount /dev/sr1 /target/mnt; \
|
||||
chroot /target /mnt/VBoxLinuxAdditions.run >/target/root/02_vbox_guestadd 2>&1; \
|
||||
umount /target/mnt; \
|
||||
sed -i 's/exit 0/# exit 0/' /target/etc/rc.local; \
|
||||
echo 'exec > /root/bootstrap.log 2>&1;set -x;SCR=/media/sf_bootstrap/autostart/*activate_autostart.sh;while [ ! -f $SCR ];do sleep 1;done;bash $SCR;rm -v $SCR' >> /target/etc/rc.local;
|
@ -1,149 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
d-i partman-auto/disk string /dev/sda
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
# (standard system utilities, OpenSSH server, Basic Ubuntu server)
|
||||
tasksel tasksel/first standard system utilities
|
||||
|
||||
# Individual additional packages to install
|
||||
# pkgsel/include disabled because it seems to cause non-deterministic installer
|
||||
# errors with Ubuntu LTS 16.04.2; installing in late_command instead
|
||||
#d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
|
||||
# Halt after installation
|
||||
#d-i debian-installer/exit/poweroff boolean true
|
||||
#ubiquity ubiquity/poweroff boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string DIR=/target/home/osbash/.ssh; \
|
||||
mkdir -v $DIR; \
|
||||
chmod 700 $DIR; \
|
||||
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key' >> $DIR/authorized_keys; \
|
||||
in-target chown -Rv osbash:osbash /home/osbash/.ssh; \
|
||||
echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers; \
|
||||
echo 'Defaults:osbash !requiretty' >> /target/etc/sudoers; \
|
||||
in-target apt-get -y install openssh-server; \
|
||||
echo "installed openssh" >> /target/root/preseed.log; \
|
||||
in-target apt-get -y install localepurge; \
|
||||
echo "installed localepurge" >> /target/root/preseed.log; \
|
||||
in-target apt-get -y install dkms; \
|
||||
echo "installed dkms" >> /target/root/preseed.log; \
|
||||
chroot /target/ apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils >/target/root/01_vbox_purge 2>&1; \
|
||||
mount /dev/sr1 /target/mnt; \
|
||||
chroot /target /mnt/VBoxLinuxAdditions.run >/target/root/02_vbox_guestadd 2>&1; \
|
||||
umount /target/mnt; \
|
||||
sed -i 's/exit 0/# exit 0/' /target/etc/rc.local; \
|
||||
echo '#!/bin/bash' > /target/etc/rc.local; \
|
||||
echo 'exec > /root/bootstrap.log 2>&1;set -x;SCR=/media/sf_bootstrap/autostart/*activate_autostart.sh;while [ ! -f $SCR ];do sleep 2;done;bash $SCR;rm -v $SCR' >> /target/etc/rc.local; \
|
||||
chmod a+x /target/etc/rc.local; \
|
||||
echo "created /etc/rc.local" >> /target/root/preseed.log;
|
@ -1,120 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
tasksel tasksel/first minimal
|
||||
|
||||
# Individual additional packages to install
|
||||
d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string echo "apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils; mount /dev/sr1 /mnt; /mnt/VBoxLinuxAdditions.run; umount /mnt; echo -e '#!/bin/bash\nexec > /root/bootstrap.log 2>&1\nset -x\nSCR=/media/sf_bootstrap/autostart/*activate_autostart.sh\nwhile [ ! -f \$SCR ];do sleep 1;done\nbash \$SCR\nrm -v \$SCR' > /etc/rc2.d/S40osbash; chmod 755 /etc/rc2.d/S40osbash;" | chroot /target /bin/bash;
|
@ -1,4 +0,0 @@
|
||||
# VirtualBox NAT -- for Internet access to VM
|
||||
DEVICE=%IF_NAME%
|
||||
ONBOOT=yes
|
||||
BOOTPROTO=dhcp
|
@ -1,5 +0,0 @@
|
||||
DEVICE=%IF_NAME%
|
||||
ONBOOT=yes
|
||||
BOOTPROTO=none
|
||||
IPADDR=%IP_ADDRESS%
|
||||
NETMASK=255.255.255.0
|
@ -1,3 +0,0 @@
|
||||
# VirtualBox NAT -- for Internet access to VM
|
||||
auto %IF_NAME%
|
||||
iface %IF_NAME% inet dhcp
|
@ -1,3 +0,0 @@
|
||||
# The loopback network interface
|
||||
auto lo
|
||||
iface lo inet loopback
|
@ -1,4 +0,0 @@
|
||||
auto %IF_NAME%
|
||||
iface %IF_NAME% inet manual
|
||||
up ip link set dev $IFACE up
|
||||
down ip link set dev $IFACE down
|
@ -1,4 +0,0 @@
|
||||
auto %IF_NAME%
|
||||
iface %IF_NAME% inet static
|
||||
address %IP_ADDRESS%
|
||||
netmask 255.255.255.0
|
@ -1,857 +0,0 @@
|
||||
source "$CONFIG_DIR/provider.$PROVIDER"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# VirtualBoxManage
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
VBM=vbm
|
||||
: ${VBM_LOG:=$LOG_DIR/vbm.log}
|
||||
|
||||
# vbm is a wrapper around the VirtualBox VBoxManage executable; it handles
|
||||
# logging and conditional execution (set OSBASH= to prevent the actual call to
|
||||
# VBoxManage, or WBATCH= to keep a call from being recorded for Windows batch
|
||||
# files)
|
||||
function vbm {
|
||||
${WBATCH:-:} wbatch_log_vbm "$@"
|
||||
|
||||
mkdir -p "$(dirname "$VBM_LOG")"
|
||||
|
||||
if [[ -n "${OSBASH:-}" ]]; then
|
||||
echo "$@" >> "$VBM_LOG"
|
||||
local rc=0
|
||||
"$VBM_EXE" "$@" || rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo -e >&2 "${CError:-}FAILURE: VBoxManage: ${*}${CReset:-}"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
echo "(not executed) $@" >> "$VBM_LOG"
|
||||
fi
|
||||
}
|
||||
|
||||
# Return VirtualBox version string (without distro extensions)
|
||||
function get_vb_version {
|
||||
local version=""
|
||||
# e.g. 4.1.32r92798 4.3.10_RPMFusionr93012 4.3.10_Debianr93012
|
||||
local raw=$(WBATCH= $VBM --version)
|
||||
# Sanitize version string
|
||||
local re='([0-9]+\.[0-9]+\.[0-9]+).*'
|
||||
if [[ $raw =~ $re ]]; then
|
||||
version=${BASH_REMATCH[1]}
|
||||
fi
|
||||
echo "$version"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# VM status
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function vm_exists {
|
||||
local vm_name=$1
|
||||
return $(WBATCH= $VBM list vms | grep -q "\"$vm_name\"")
|
||||
}
|
||||
|
||||
function vm_is_running {
|
||||
local vm_name=$1
|
||||
return $(WBATCH= $VBM showvminfo --machinereadable "$vm_name" | \
|
||||
grep -q 'VMState="running"')
|
||||
}
|
||||
|
||||
function vm_wait_for_shutdown {
|
||||
local vm_name=$1
|
||||
|
||||
${WBATCH:-:} wbatch_wait_poweroff "$vm_name"
|
||||
# Return if we are just faking it for wbatch
|
||||
${OSBASH:+:} return 0
|
||||
|
||||
echo -e >&2 -n "${CStatus:-}Machine shutting down${CReset:-}"
|
||||
until WBATCH= $VBM showvminfo --machinereadable "$vm_name" 2>/dev/null | \
|
||||
grep -q '="poweroff"'; do
|
||||
echo -n .
|
||||
sleep 1
|
||||
done
|
||||
echo >&2 -e "${CStatus:-}\nMachine powered off.${CReset:-}"
|
||||
}
|
||||
|
||||
function vm_power_off {
|
||||
local vm_name=$1
|
||||
if vm_is_running "$vm_name"; then
|
||||
echo -e >&2 "${CStatus:-}Powering off VM ${CData:-}\"$vm_name\"${CReset:-}"
|
||||
$VBM controlvm "$vm_name" poweroff
|
||||
fi
|
||||
# VirtualBox VM needs a break before taking new commands
|
||||
conditional_sleep 1
|
||||
}
|
||||
|
||||
function vm_acpi_shutdown {
|
||||
local vm_name=$1
|
||||
echo -e >&2 "${CStatus:-}ACPI shutdown for VM ${CData:-}\"$vm_name\"${CReset:-}"
|
||||
$VBM controlvm "$vm_name" acpipowerbutton
|
||||
|
||||
# VirtualBox VM needs a break before taking new commands
|
||||
conditional_sleep 1
|
||||
}
|
||||
|
||||
# Shut down all VMs in group VM_GROUP
|
||||
function stop_running_cluster_vms {
|
||||
local vm_id
|
||||
|
||||
# Get VM ID from a line looking like this:
|
||||
# "My VM" {0a13e26d-9543-460d-82d6-625fa657b7c4}
|
||||
$VBM list runningvms | sed 's/.* {\(.*\)}/\1/' | while read vm_id; do
|
||||
if $VBM showvminfo --machinereadable "$vm_id" |
|
||||
grep -qe '^groups="/'$VM_GROUP; then
|
||||
# vm_id instead of vm_name works just as well
|
||||
vm_acpi_shutdown "$vm_id"
|
||||
vm_wait_for_shutdown "$vm_id"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Snapshots
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function vm_snapshot_list_tree {
|
||||
local vm_name=$1
|
||||
|
||||
local rc
|
||||
# Hide VBM error message on stderr if no snapshots exist and proceed even
|
||||
# if exit status indicates error
|
||||
$VBM snapshot "$vm_name" list 2>/dev/null || rc=$?
|
||||
}
|
||||
|
||||
function vm_snapshot_list {
|
||||
local vm_name=$1
|
||||
|
||||
# Hide VBM error on stderr if no snapshots exist
|
||||
$VBM snapshot "$vm_name" list --machinereadable 2>/dev/null
|
||||
}
|
||||
|
||||
function vm_snapshot_exists {
|
||||
local vm_name=$1
|
||||
local shot_name=$2
|
||||
|
||||
vm_snapshot_list "$vm_name" | grep -q "SnapshotName.*=\"$shot_name\""
|
||||
}
|
||||
|
||||
function vm_snapshot {
|
||||
local vm_name=$1
|
||||
local shot_name=$2
|
||||
|
||||
$VBM snapshot "$vm_name" take "$shot_name"
|
||||
# VirtualBox VM needs a break before taking new commands
|
||||
conditional_sleep 1
|
||||
}
|
||||
|
||||
function vm_snapshot_restore {
|
||||
local vm_name=$1
|
||||
local shot_name=$2
|
||||
|
||||
$VBM snapshot "$vm_name" restore "$shot_name"
|
||||
# VirtualBox VM needs a break before taking new commands
|
||||
conditional_sleep 1
|
||||
}
|
||||
|
||||
function vm_snapshot_restore_current {
|
||||
local vm_name=$1
|
||||
|
||||
$VBM snapshot "$vm_name" restorecurrent
|
||||
# VirtualBox VM needs a break before taking new commands
|
||||
conditional_sleep 1
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Host-only network functions
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Get ssh port from node name and wait for node to respond
|
||||
function ssh_env_for_node {
|
||||
local node=$1
|
||||
|
||||
VM_SSH_PORT=$(source "$CONFIG_DIR/config.$node"; echo "$VM_SSH_PORT")
|
||||
SSH_IP=127.0.0.1
|
||||
if [ -n "${PXE_TMP_NODE_IP:-""}" ]; then
|
||||
SSH_IP=$PXE_TMP_NODE_IP
|
||||
SSH_PORT=22
|
||||
echo >&2 "PXE_TMP_NODE_IP is set -> SSH_IP=$SSH_IP, SSH_PORT=$SSH_PORT."
|
||||
fi
|
||||
}
|
||||
|
||||
function hostonlyif_in_use {
|
||||
local if_name=$1
|
||||
return $(WBATCH= $VBM list -l runningvms | \
|
||||
grep -q "Host-only Interface '$if_name'")
|
||||
}
|
||||
|
||||
function ip_to_hostonlyif {
|
||||
local ip=$1
|
||||
local prevline=""
|
||||
WBATCH= $VBM list hostonlyifs | grep -e "^Name:" -e "^IPAddress:" | \
|
||||
while read line; do
|
||||
if [[ "$line" == *$ip* ]]; then
|
||||
# match longest string that ends with a space
|
||||
echo ${prevline##Name:* }
|
||||
break
|
||||
fi
|
||||
prevline=$line
|
||||
done
|
||||
}
|
||||
|
||||
function create_hostonlyif {
|
||||
local out=$(WBATCH= $VBM hostonlyif create 2> /dev/null | grep "^Interface")
|
||||
# out is something like "Interface 'vboxnet3' was successfully created"
|
||||
local re="Interface '(.*)' was successfully created"
|
||||
if [[ $out =~ $re ]]; then
|
||||
echo "${BASH_REMATCH[1]}"
|
||||
else
|
||||
echo -e >&2 "${CError:-}Host-only interface creation failed${CReset:-}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function fake_hostif {
|
||||
local numifs
|
||||
if [ "${NET_IFNAME[0]:-""}" = "" ]; then
|
||||
numifs=0
|
||||
else
|
||||
numifs=${#NET_IFNAME[@]}
|
||||
fi
|
||||
NET_IFNAME[index]="vboxnet${numifs}"
|
||||
}
|
||||
|
||||
function create_network {
|
||||
local index=$1
|
||||
# The host-side interface is the default gateway of the network
|
||||
local if_ip=${NET_GW[index]}
|
||||
|
||||
# If we are here only for wbatch, ignore actual network interfaces; just
|
||||
# return a vboxnetX identifier (so it can be replaced with the interface
|
||||
# name used by Windows).
|
||||
${OSBASH:+:} fake_hostif
|
||||
${OSBASH:+:} return 0
|
||||
|
||||
local if_name=$(ip_to_hostonlyif "$if_ip")
|
||||
if [ -n "$if_name" ]; then
|
||||
if hostonlyif_in_use "$if_name"; then
|
||||
echo >&2 "Host-only interface $if_name ($if_ip) is in use." \
|
||||
"Using it, too."
|
||||
fi
|
||||
else
|
||||
echo -e >&2 "${CStatus:-}Creating host-only interface${CReset:-}"
|
||||
if_name=$(create_hostonlyif)
|
||||
fi
|
||||
|
||||
echo -e >&2 "${CStatus:-}Configuring host-only network ${CData:-}$if_ip ($if_name)${CReset:-}"
|
||||
$VBM hostonlyif ipconfig "$if_name" \
|
||||
--ip "$if_ip" \
|
||||
--netmask 255.255.255.0 >/dev/null
|
||||
NET_IFNAME[index]=$if_name
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Disk functions
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function get_base_disk_path {
|
||||
echo "$DISK_DIR/$(get_base_disk_name).vdi"
|
||||
}
|
||||
|
||||
function base_disk_exists {
|
||||
local base_disk_path=$(get_base_disk_path)
|
||||
|
||||
test -f "$base_disk_path"
|
||||
}
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Creating, registering and unregistering disk images with VirtualBox
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
# disk can be either a path or a disk UUID
|
||||
function disk_registered {
|
||||
local disk=$1
|
||||
return $(WBATCH= $VBM list hdds | grep -q "$disk")
|
||||
}
|
||||
|
||||
# disk can be either a path or a disk UUID
|
||||
function disk_unregister {
|
||||
local disk=$1
|
||||
echo >&2 -e "${CStatus:-}Unregistering disk\n\t${CData:-}$disk${CReset:-}"
|
||||
$VBM closemedium disk "$disk"
|
||||
}
|
||||
|
||||
function create_vdi {
|
||||
local hd_path=$1
|
||||
local size=$2
|
||||
echo >&2 -e "${CStatus:-}Creating disk:\n\t${CData:-}$hd_path${CReset:-}"
|
||||
$VBM createhd --format VDI --filename "$hd_path" --size "$size"
|
||||
}
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Attaching and detaching disks from VMs
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
# disk can be either a path or a disk UUID
|
||||
function get_next_child_uuid {
|
||||
local disk=$1
|
||||
local child_uuid=""
|
||||
local line=""
|
||||
if disk_registered "$disk"; then
|
||||
line=$(WBATCH= $VBM showhdinfo "$disk" | grep -e "^Child UUIDs:")
|
||||
child_uuid=${line##Child UUIDs:* }
|
||||
fi
|
||||
echo -e "next_child_uuid $disk:\n\t$line\n\t$child_uuid" >> "$VBM_LOG"
|
||||
echo "$child_uuid"
|
||||
}
|
||||
|
||||
# disk can be either a path or a disk UUID
|
||||
function path_to_disk_uuid {
|
||||
local disk=$1
|
||||
local uuid=""
|
||||
local line=$(WBATCH= $VBM showhdinfo "$disk" | grep -e "^UUID:")
|
||||
local re='UUID:[ ]+([^ ]+)'
|
||||
if [[ $line =~ $re ]]; then
|
||||
uuid=${BASH_REMATCH[1]}
|
||||
fi
|
||||
echo -e "path_to_disk_uuid $disk:\n\t$line\n\t$uuid" >> "$VBM_LOG"
|
||||
echo "$uuid"
|
||||
}
|
||||
|
||||
# disk can be either a path or a disk UUID
|
||||
function disk_to_path {
|
||||
local disk=$1
|
||||
local fpath=""
|
||||
local line=$(WBATCH= $VBM showhdinfo "$disk" | grep -e "^Location:")
|
||||
local re='Location:[ ]+([^ ]+)'
|
||||
if [[ $line =~ $re ]]; then
|
||||
fpath=${BASH_REMATCH[1]}
|
||||
fi
|
||||
echo -e "disk_to_path $disk:\n\t$line\n\t$fpath" >> "$VBM_LOG"
|
||||
echo "$fpath"
|
||||
}
|
||||
|
||||
# disk can be either a path or a disk UUID
|
||||
function disk_to_vm {
|
||||
local disk=$1
|
||||
local vm_name=""
|
||||
local line=$(WBATCH= $VBM showhdinfo "$disk" | grep -e "^In use by VMs:")
|
||||
local re='In use by VMs:[ ]+([^ ]+) '
|
||||
if [[ $line =~ $re ]]; then
|
||||
vm_name=${BASH_REMATCH[1]}
|
||||
fi
|
||||
echo -e "disk_to_vm $disk:\n\t$line\n\t$vm_name" >> "$VBM_LOG"
|
||||
echo "$vm_name"
|
||||
}
|
||||
|
||||
function vm_get_disk_path {
|
||||
local vm_name=$1
|
||||
local line=$(WBATCH= $VBM showvminfo --machinereadable "$vm_name" | \
|
||||
grep '^"SATA-0-0"=.*vdi"$')
|
||||
local hd_path=${line##\"SATA-0-0\"=\"}
|
||||
hd_path=${hd_path%\"}
|
||||
echo "$hd_path"
|
||||
}
|
||||
|
||||
function vm_detach_disk {
|
||||
local vm_name=$1
|
||||
local port=${2:-0}
|
||||
echo >&2 "Detaching disk from VM \"$vm_name\""
|
||||
$VBM storageattach "$vm_name" \
|
||||
--storagectl SATA \
|
||||
--port "$port" \
|
||||
--device 0 \
|
||||
--type hdd \
|
||||
--medium none
|
||||
# VirtualBox VM needs a break before taking new commands
|
||||
conditional_sleep 1
|
||||
}
|
||||
|
||||
# disk can be either a path or a disk UUID
|
||||
function vm_attach_disk {
|
||||
local vm_name=$1
|
||||
local disk=$2
|
||||
local port=${3:-0}
|
||||
echo >&2 -e "Attaching to VM \"$vm_name\":\n\t$disk"
|
||||
$VBM storageattach "$vm_name" \
|
||||
--storagectl SATA \
|
||||
--port "$port" \
|
||||
--device 0 \
|
||||
--type hdd \
|
||||
--medium "$disk"
|
||||
}
|
||||
|
||||
# disk can be either a path or a disk UUID
|
||||
function vm_attach_disk_multi {
|
||||
local vm_name=$1
|
||||
local disk=$2
|
||||
local port=${3:-0}
|
||||
|
||||
$VBM modifyhd --type multiattach "$disk"
|
||||
|
||||
echo >&2 -e "Attaching to VM \"$vm_name\":\n\t$disk"
|
||||
$VBM storageattach "$vm_name" \
|
||||
--storagectl SATA \
|
||||
--port "$port" \
|
||||
--device 0 \
|
||||
--type hdd \
|
||||
--medium "$disk"
|
||||
}
|
||||
|
||||
function base_disk_delete {
|
||||
local base_disk_path=$(get_base_disk_path)
|
||||
|
||||
if disk_registered "$base_disk_path"; then
|
||||
# Remove users of base disk
|
||||
echo >&2 "Unregistering and removing all disks attached to" \
|
||||
"base disk path."
|
||||
disk_delete_child_vms "$base_disk_path"
|
||||
echo >&2 "Unregistering old base disk."
|
||||
disk_unregister "$base_disk_path"
|
||||
fi
|
||||
echo -e >&2 "${CStatus:-}Removing old base disk.${CReset:-}"
|
||||
rm -f "$base_disk_path"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# VM create and configure
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function vm_mem {
|
||||
local vm_name="$1"
|
||||
local mem="$2"
|
||||
$VBM modifyvm "$vm_name" --memory "$mem"
|
||||
}
|
||||
|
||||
function vm_cpus {
|
||||
local vm_name="$1"
|
||||
local cpus="$2"
|
||||
$VBM modifyvm "$vm_name" --cpus "$cpus"
|
||||
}
|
||||
|
||||
# Port forwarding from host to VM (binding to host's 127.0.0.1)
|
||||
function vm_port {
|
||||
local vm_name="$1"
|
||||
local desc="$2"
|
||||
local hostport="$3"
|
||||
local guestport="$4"
|
||||
$VBM modifyvm "$vm_name" \
|
||||
--natpf1 "$desc,tcp,127.0.0.1,$hostport,,$guestport"
|
||||
}
|
||||
|
||||
function netname_to_hostif {
|
||||
local netname=$1
|
||||
|
||||
for index in "${!NET_NAME[@]}"; do
|
||||
if [ "$netname" = "${NET_NAME[index]}" ]; then
|
||||
echo "${NET_IFNAME[index]}"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
echo >&2 "ERROR: No host interface for network $netname. Exiting."
|
||||
exit 1
|
||||
}
|
||||
|
||||
function vm_nic_base {
|
||||
local vm_name=$1
|
||||
# We start counting interfaces at 0, but VirtualBox starts NICs at 1
|
||||
local nic=$(($2 + 1))
|
||||
$VBM modifyvm "$vm_name" "--nictype$nic" "$NICTYPE" "--nic$nic" nat
|
||||
}
|
||||
|
||||
function vm_nic_std {
|
||||
local vm_name=$1
|
||||
local index=$2
|
||||
# We start counting interfaces at 0, but VirtualBox starts NICs at 1
|
||||
local nic=$((index + 1))
|
||||
local netname=$(ip_to_netname "${NODE_IF_IP[index]}")
|
||||
local hostif=$(netname_to_hostif "$netname")
|
||||
$VBM modifyvm "$vm_name" \
|
||||
"--nictype$nic" "$NICTYPE" \
|
||||
"--nic$nic" hostonly \
|
||||
"--hostonlyadapter$nic" "$hostif" \
|
||||
"--nicpromisc$nic" allow-all
|
||||
}
|
||||
|
||||
function vm_nic_set_boot_prio {
|
||||
local vm_name=$1
|
||||
local index=$2
|
||||
local prip=$3
|
||||
# We start counting interfaces at 0, but VirtualBox starts NICs at 1
|
||||
local nic=$((index + 1))
|
||||
|
||||
$VBM modifyvm "$vm_name" "--nicbootprio$nic" "$3"
|
||||
}
|
||||
|
||||
function vm_create {
|
||||
# NOTE: We assume that a VM with a matching name is ours.
|
||||
# Remove and recreate just in case someone messed with it.
|
||||
local vm_name=$1
|
||||
|
||||
${WBATCH:-:} wbatch_abort_if_vm_exists "$vm_name"
|
||||
|
||||
# Don't write to wbatch scripts, and don't execute when we are faking it
|
||||
# it for wbatch
|
||||
WBATCH= ${OSBASH:-:} vm_delete "$vm_name"
|
||||
|
||||
# XXX ostype is distro-specific; moving it to modifyvm disables networking
|
||||
|
||||
# Note: The VirtualBox GUI may not notice group changes after VM creation
|
||||
# until GUI is restarted. Moving a VM with group membership will
|
||||
# fail in cases (lingering files from old VM) where creating a
|
||||
# VM in that location succeeds.
|
||||
#
|
||||
# XXX temporary hack
|
||||
# --groups not supported in VirtualBox 4.1 (Mac OS X 10.5)
|
||||
echo -e >&2 "${CStatus:-}Creating VM ${CData:-}\"$vm_name\"${CReset:-}"
|
||||
local ver=$(get_vb_version)
|
||||
if [[ $ver = 4.1* ]]; then
|
||||
$VBM createvm \
|
||||
--name "$vm_name" \
|
||||
--register \
|
||||
--ostype "$VBOX_OSTYPE" >/dev/null
|
||||
else
|
||||
$VBM createvm \
|
||||
--name "$vm_name" \
|
||||
--register \
|
||||
--ostype "$VBOX_OSTYPE" \
|
||||
--groups "/$VM_GROUP" >/dev/null
|
||||
fi
|
||||
|
||||
if WBATCH= $VBM showvminfo --machinereadable "$vm_name" | \
|
||||
grep -q 'longmode="off"'; then
|
||||
echo -e >&2 "${CStatus:-}Nodes run 32-bit OS, enabling PAE.${CReset:-}"
|
||||
# Ubuntu 14.04 LTS i386 needs PAE
|
||||
$VBM modifyvm "$vm_name" --pae on
|
||||
fi
|
||||
|
||||
$VBM modifyvm "$vm_name" --rtcuseutc on
|
||||
$VBM modifyvm "$vm_name" --biosbootmenu disabled
|
||||
$VBM modifyvm "$vm_name" --largepages on
|
||||
$VBM modifyvm "$vm_name" --boot1 disk
|
||||
$VBM modifyvm "$vm_name" --boot3 net
|
||||
|
||||
# XXX temporary hack
|
||||
# --portcount not supported in VirtualBox 4.1 (Mac OS X 10.5)
|
||||
if [[ $ver == 4.1* ]]; then
|
||||
$VBM storagectl "$vm_name" --name SATA --add sata
|
||||
else
|
||||
# Enough ports for three disks
|
||||
$VBM storagectl "$vm_name" --name SATA --add sata --portcount 3
|
||||
fi
|
||||
$VBM storagectl "$vm_name" --name SATA --hostiocache on
|
||||
|
||||
$VBM storagectl "$vm_name" --name IDE --add ide
|
||||
echo -e >&2 "${CStatus:-}Created VM ${CData:-}\"$vm_name\"${CReset:-}"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# VM export
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Export node VMs to OVA package file
|
||||
function vm_export_ova {
|
||||
local ova_file=$1
|
||||
local nodes=$2
|
||||
echo >&2 "Removing shared folders for export"
|
||||
local -a share_paths
|
||||
local node
|
||||
for node in $nodes; do
|
||||
local share_path=$(vm_get_share_path "$node")
|
||||
share_paths+=("$share_path")
|
||||
if [ -n "$share_path" ]; then
|
||||
vm_rm_share "$node" "$SHARE_NAME"
|
||||
fi
|
||||
done
|
||||
rm -f "$ova_file"
|
||||
mkdir -pv "$IMG_DIR"
|
||||
$VBM export $nodes --output "$ova_file"
|
||||
echo >&2 "Appliance exported"
|
||||
echo >&2 "Reattaching shared folders"
|
||||
local ii=0
|
||||
for node in $nodes; do
|
||||
if [ -n "${share_paths[$ii]}" ]; then
|
||||
vm_add_share "$node" "${share_paths[$ii]}" "$SHARE_NAME"
|
||||
fi
|
||||
ii=$((ii + 1))
|
||||
done
|
||||
}
|
||||
|
||||
# Export node VMs by cloning VMs to directory
|
||||
function vm_export_dir {
|
||||
local export_dir=$1
|
||||
local nodes=$2
|
||||
|
||||
rm -rvf "$export_dir"
|
||||
|
||||
for node in $nodes; do
|
||||
if vm_is_running "$node"; then
|
||||
echo "Powering off node VM $node."
|
||||
echo "$VBM controlvm $node poweroff"
|
||||
$VBM controlvm "$node" poweroff
|
||||
fi
|
||||
sleep 1
|
||||
local share_path=$(vm_get_share_path "$node")
|
||||
if [ -n "$share_path" ]; then
|
||||
echo >&2 "Removing shared folder for export"
|
||||
vm_rm_share "$node" "$SHARE_NAME"
|
||||
fi
|
||||
sleep 1
|
||||
echo "Exporting VM $node to $export_dir"
|
||||
# Use all: machineandchildren works only if --snapshot is given as UUID
|
||||
$VBM clonevm "$node" \
|
||||
--mode all \
|
||||
--options keepallmacs,keepdisknames \
|
||||
--name "$node-e" \
|
||||
--groups "/$VM_GROUP" \
|
||||
--basefolder "$export_dir" \
|
||||
--register
|
||||
# VirtualBox registers disks and snapshots of the clone VM even if we
|
||||
# don't register the VM above. Unregistering the registered VM takes
|
||||
# care of the snapshots, but we still have to unregister the clone
|
||||
# basedisk.
|
||||
local snapshot_path=$(vm_get_disk_path "$node-e")
|
||||
local hd_dir=${snapshot_path%Snapshots/*}
|
||||
local hd_path=$hd_dir$(get_base_disk_name).vdi
|
||||
$VBM unregistervm "$node-e"
|
||||
if [ -n "$hd_path" ]; then
|
||||
disk_unregister "$hd_path"
|
||||
fi
|
||||
if [ -n "$share_path" ]; then
|
||||
echo >&2 "Reattaching shared folder"
|
||||
vm_add_share "$node" "$share_path" "$SHARE_NAME"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# VM unregister, remove, delete
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function vm_unregister_del {
|
||||
local vm_name=$1
|
||||
echo -e >&2 "${CStatus:-}Unregistering and deleting VM ${CData:-}\"$vm_name\"${CReset:-}"
|
||||
$VBM unregistervm "$vm_name" --delete
|
||||
}
|
||||
|
||||
function vm_delete {
|
||||
local vm_name=$1
|
||||
echo >&2 -n "Asked to delete VM \"$vm_name\" "
|
||||
if vm_exists "$vm_name"; then
|
||||
echo >&2 "(found)"
|
||||
vm_power_off "$vm_name"
|
||||
local hd_path=$(vm_get_disk_path "$vm_name")
|
||||
if [ -n "$hd_path" ]; then
|
||||
echo >&2 -e "${CInfo:-}Disk attached: ${CData:-}$hd_path${CReset:-}"
|
||||
vm_detach_disk "$vm_name"
|
||||
disk_unregister "$hd_path"
|
||||
echo >&2 -e "Deleting: $hd_path"
|
||||
rm -f "$hd_path"
|
||||
fi
|
||||
vm_unregister_del "$vm_name"
|
||||
else
|
||||
echo >&2 "(not found)"
|
||||
fi
|
||||
}
|
||||
|
||||
# Remove VMs using disk and its children disks
|
||||
# disk can be either a path or a disk UUID
|
||||
function disk_delete_child_vms {
|
||||
local disk=$1
|
||||
if ! disk_registered "$disk"; then
|
||||
# VirtualBox doesn't know this disk; we are done
|
||||
echo >&2 -e "${CError:-}Disk not registered with VirtualBox:\n\t${CData:-}$disk${CReset:-}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# XXX temporary hack
|
||||
# No Child UUIDs through showhdinfo in VirtualBox 4.1 (Mac OS X 10.5)
|
||||
local ver=$(get_vb_version)
|
||||
if [[ $ver == 4.1* ]]; then
|
||||
local vm_name=""
|
||||
for vm_name in controller network compute base; do
|
||||
vm_delete "$vm_name"
|
||||
done
|
||||
return 0
|
||||
fi
|
||||
|
||||
while : ; do
|
||||
local child_uuid=$(get_next_child_uuid "$disk")
|
||||
if [ -n "$child_uuid" ]; then
|
||||
local child_disk=$(disk_to_path "$child_uuid")
|
||||
echo >&2 -e "\nChild disk UUID: $child_uuid\n\t$child_disk"
|
||||
|
||||
local vm_name=$(disk_to_vm "$child_uuid")
|
||||
if [ -n "$vm_name" ]; then
|
||||
echo 2>&1 -e "\tstill attached to VM \"$vm_name\""
|
||||
vm_delete "$vm_name"
|
||||
else
|
||||
echo -e >&2 "${CStatus:-}Unregistering and deleting: ${CData:-}$child_uuid${CReset:-}"
|
||||
disk_unregister "$child_uuid"
|
||||
echo >&2 -e "\t$child_disk"
|
||||
rm -f "$child_disk"
|
||||
fi
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# VM shared folders
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Return the host path for a VM's shared directory; assumes there is only one.
|
||||
function vm_get_share_path {
|
||||
local vm_name=$1
|
||||
local line=$(WBATCH= $VBM showvminfo --machinereadable "$vm_name" | \
|
||||
grep '^SharedFolderPathMachineMapping1=')
|
||||
local share_path=${line##SharedFolderPathMachineMapping1=\"}
|
||||
share_path=${share_path%\"}
|
||||
echo "$share_path"
|
||||
}
|
||||
|
||||
function vm_add_share_automount {
|
||||
local vm_name=$1
|
||||
local share_dir=$2
|
||||
local share_name=$3
|
||||
$VBM sharedfolder add "$vm_name" \
|
||||
--name "$share_name" \
|
||||
--hostpath "$share_dir" \
|
||||
--automount
|
||||
}
|
||||
|
||||
function vm_add_share {
|
||||
local vm_name=$1
|
||||
local share_dir=$2
|
||||
local share_name=$3
|
||||
$VBM sharedfolder add "$vm_name" \
|
||||
--name "$share_name" \
|
||||
--hostpath "$share_dir"
|
||||
}
|
||||
|
||||
function vm_rm_share {
|
||||
local vm_name=$1
|
||||
local share_name=$2
|
||||
$VBM sharedfolder remove "$vm_name" --name "$share_name"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# VirtualBox guest add-ons
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Download VirtualBox guest-additions. Returns local path of ISO image.
|
||||
function _download_guestadd-iso {
|
||||
local iso=VBoxGuestAdditions.iso
|
||||
local ver=$(get_vb_version)
|
||||
if [[ -n "$ver" ]]; then
|
||||
local url="http://download.virtualbox.org/virtualbox/$ver/VBoxGuestAdditions_$ver.iso"
|
||||
download "$url" "$ISO_DIR" $iso
|
||||
fi
|
||||
echo "$ISO_DIR/$iso"
|
||||
}
|
||||
|
||||
function _get_guestadd-iso {
|
||||
local iso=VBoxGuestAdditions.iso
|
||||
|
||||
local add_iso="$IMG_DIR/$iso"
|
||||
if [ -f "$add_iso" ]; then
|
||||
echo "$add_iso"
|
||||
return 0
|
||||
fi
|
||||
|
||||
add_iso="/Applications/VirtualBox.app/Contents/MacOS/$iso"
|
||||
if [ -f "$add_iso" ]; then
|
||||
echo "$add_iso"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo >&2 "Searching filesystem for VBoxGuestAdditions. This may take a while..."
|
||||
add_iso=$(find / -name "$iso" 2>/dev/null) || true
|
||||
if [ -n "$add_iso" ]; then
|
||||
echo "$add_iso"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo >&2 "Looking on the Internet"
|
||||
add_iso=$(_download_guestadd-iso)
|
||||
if [ -f "$add_iso" ]; then
|
||||
echo "$add_iso"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
function _vm_attach_guestadd-iso {
|
||||
local vm_name=$1
|
||||
local guestadd_iso=$2
|
||||
local rc=0
|
||||
$VBM storageattach "$vm_name" --storagectl IDE --port 1 --device 0 --type dvddrive --medium "$guestadd_iso" 2>/dev/null || rc=$?
|
||||
return $rc
|
||||
}
|
||||
|
||||
function vm_attach_guestadd-iso {
|
||||
local vm_name=$1
|
||||
|
||||
OSBASH= ${WBATCH:-:} _vm_attach_guestadd-iso "$vm_name" emptydrive
|
||||
OSBASH= ${WBATCH:-:} _vm_attach_guestadd-iso "$vm_name" additions
|
||||
# Return if we are just faking it for wbatch
|
||||
${OSBASH:+:} return 0
|
||||
|
||||
if [ -z "${GUESTADD_ISO-}" ]; then
|
||||
|
||||
# No location provided, asking VirtualBox for one
|
||||
|
||||
# An existing drive is needed to make additions shortcut work
|
||||
# (at least VirtualBox 4.3.12 and below)
|
||||
WBATCH= _vm_attach_guestadd-iso "$vm_name" emptydrive
|
||||
|
||||
if WBATCH= _vm_attach_guestadd-iso "$vm_name" additions; then
|
||||
echo >&2 "Using VBoxGuestAdditions provided by VirtualBox"
|
||||
return 0
|
||||
fi
|
||||
# Neither user nor VirtualBox are helping, let's go guessing
|
||||
GUESTADD_ISO=$(_get_guestadd-iso)
|
||||
if [ -z "GUESTADD_ISO" ]; then
|
||||
# No ISO found
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
if WBATCH= _vm_attach_guestadd-iso "$vm_name" "$GUESTADD_ISO"; then
|
||||
echo >&2 "Attached $GUESTADD_ISO"
|
||||
return 0
|
||||
else
|
||||
echo -e >&2 "${CError:-}Failed to attach ${CData:-}$GUESTADD_ISO${CReset:-}"
|
||||
return 3
|
||||
fi
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Booting a VM and passing boot parameters
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
source "$OSBASH_LIB_DIR/virtualbox-keycodes.sh"
|
||||
|
||||
function _keyboard_push_scancode {
|
||||
local vm_name=$1
|
||||
shift
|
||||
# Split string (e.g. '01 81') into arguments (works also if we
|
||||
# get each hexbyte as a separate argument)
|
||||
# Not quoting $@ is intentional -- we want to split on blanks
|
||||
local scan_code=( $@ )
|
||||
$VBM controlvm "$vm_name" keyboardputscancode "${scan_code[@]}"
|
||||
}
|
||||
|
||||
function vm_boot {
|
||||
local vm_name=$1
|
||||
|
||||
echo -e >&2 "${CStatus:-}Starting VM ${CData:-}\"$vm_name\"${CReset:-}"
|
||||
if [ -n "${VM_UI:-}" ]; then
|
||||
$VBM startvm "$vm_name" --type "$VM_UI"
|
||||
else
|
||||
$VBM startvm "$vm_name"
|
||||
fi
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,134 +0,0 @@
|
||||
# This bash library contains the main function that creates the base disk.
|
||||
|
||||
function vm_install_base {
|
||||
local base_disk_path=$(get_base_disk_path)
|
||||
local base_build_disk=$DISK_DIR/tmp-disk.vdi
|
||||
local vm_name=base
|
||||
|
||||
echo >&2 "$(date) osbash vm_install starts."
|
||||
|
||||
${WBATCH:-:} wbatch_begin_base
|
||||
|
||||
# Don't remove base_build_disk if we are just faking it for wbatch
|
||||
${OSBASH:-:} rm -f "$base_build_disk"
|
||||
${WBATCH:-:} wbatch_delete_disk "$base_build_disk"
|
||||
|
||||
vm_create "$vm_name"
|
||||
(
|
||||
source "$CONFIG_DIR/config.$vm_name"
|
||||
|
||||
vm_mem "$vm_name" "${VM_MEM}"
|
||||
)
|
||||
|
||||
if [ -z "${INSTALL_ISO-}" ]; then
|
||||
|
||||
if [ -z "$ISO_URL" ]; then
|
||||
echo -e >&2 "${CMissing:-}Either ISO URL or name needed (ISO_URL, INSTALL_ISO).${CReset:-}"
|
||||
exit 1
|
||||
fi
|
||||
# Don't look for ISO image if we are only doing wbatch
|
||||
${OSBASH:-:} find_install-iso
|
||||
|
||||
INSTALL_ISO=$ISO_DIR/$(get_iso_name)
|
||||
fi
|
||||
|
||||
echo >&2 -e "${CInfo:-}Install ISO:\n\t${CData:-}$INSTALL_ISO${CReset:-}"
|
||||
|
||||
${OSBASH:-:} check_md5 "$INSTALL_ISO" "$ISO_MD5"
|
||||
|
||||
$VBM storageattach "$vm_name" \
|
||||
--storagectl IDE \
|
||||
--port 0 \
|
||||
--device 0 \
|
||||
--type dvddrive \
|
||||
--medium "$INSTALL_ISO"
|
||||
|
||||
${WBATCH:-:} vm_attach_guestadd-iso "$vm_name"
|
||||
|
||||
${OSBASH:-:} mkdir -pv "$DISK_DIR"
|
||||
create_vdi "$base_build_disk" "${BASE_DISK_SIZE:=10000}"
|
||||
vm_attach_disk "$vm_name" "$base_build_disk"
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Set up communication with base VM: ssh port forwarding by default,
|
||||
# VirtualBox shared folders for wbatch
|
||||
|
||||
(
|
||||
# Get the VM_SSH_PORT for the base disk
|
||||
source "$CONFIG_DIR/config.$vm_name"
|
||||
|
||||
# wbatch runs cannot use ssh, so skip port forwarding in that case
|
||||
${WBATCH:+:} vm_port "$vm_name" ssh "$VM_SSH_PORT" 22
|
||||
)
|
||||
|
||||
# Automounted on /media/sf_bootstrap for first boot
|
||||
${WBATCH:-:} vm_add_share_automount "$vm_name" "$SHARE_DIR" bootstrap
|
||||
# Mounted on /$SHARE_NAME after first boot
|
||||
${WBATCH:-:} vm_add_share "$vm_name" "$SHARE_DIR" "$SHARE_NAME"
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
$VBM modifyvm "$vm_name" --boot1 dvd
|
||||
$VBM modifyvm "$vm_name" --boot2 disk
|
||||
|
||||
# Configure autostart
|
||||
autostart_reset
|
||||
|
||||
# For wbatch, install osbashauto as a boot service
|
||||
${WBATCH:-:} autostart osbash/activate_autostart.sh
|
||||
|
||||
autostart osbash/base_fixups.sh
|
||||
|
||||
# By default, set by lib/osbash/lib.* to something like scripts.ubuntu_base
|
||||
autostart_from_config "$BASE_INSTALL_SCRIPTS"
|
||||
|
||||
autostart zero_empty.sh shutdown.sh
|
||||
|
||||
# Boot VM into distribution installer
|
||||
vm_boot "$vm_name"
|
||||
|
||||
# Note: It takes about 5 seconds for the installer in the VM to be ready
|
||||
# on a fairly typical laptop. If we don't wait long enough, the
|
||||
# installation will fail. Ideally, we would have a different method
|
||||
# of making sure the installer is ready. For now, we just have to
|
||||
# try and err on the side of caution.
|
||||
local delay=10
|
||||
echo >&2 "Waiting $delay seconds for VM \"$vm_name\" to come up"
|
||||
conditional_sleep "$delay"
|
||||
|
||||
distro_start_installer "$vm_name"
|
||||
|
||||
echo -e >&2 "${CStatus:-}Installing operating system; waiting for reboot${CReset:-}"
|
||||
|
||||
# Wait for ssh connection and execute scripts in autostart directory
|
||||
# (for wbatch, osbashauto does the processing instead)
|
||||
${WBATCH:+:} ssh_process_autostart "$vm_name" &
|
||||
# After reboot
|
||||
wait_for_autofiles
|
||||
echo -e >&2 "${CStatus:-}Installation done for VM ${CData:-}$vm_name${CReset:-}"
|
||||
|
||||
vm_wait_for_shutdown "$vm_name"
|
||||
|
||||
# Detach disk from VM now or it will be deleted by vm_unregister_del
|
||||
vm_detach_disk "$vm_name"
|
||||
|
||||
vm_unregister_del "$vm_name"
|
||||
|
||||
echo >&2 "Compacting $base_build_disk"
|
||||
$VBM modifyhd "$base_build_disk" --compact
|
||||
|
||||
# This disk will be moved to a new name, and this name will be used for
|
||||
# a new disk next time the script runs.
|
||||
disk_unregister "$base_build_disk"
|
||||
|
||||
echo -e >&2 "${CStatus:-}Base disk created${CReset:-}"
|
||||
|
||||
echo >&2 "Moving base disk to $base_disk_path"
|
||||
${OSBASH:-:} mv -vf "$base_build_disk" "$base_disk_path"
|
||||
${WBATCH:-:} wbatch_rename_disk "$base_build_disk" "$base_disk_path"
|
||||
|
||||
${WBATCH:-:} wbatch_end_file
|
||||
|
||||
echo >&2 -e "${CData:-}$(date) ${CStatus:-}osbash vm_install ends\n${CReset:-}"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,78 +0,0 @@
|
||||
# This bash library contains the main function that creates a node VM.
|
||||
|
||||
# Boot node VM; wait until autostart files are processed
|
||||
function _vm_boot_with_autostart {
|
||||
local vm_name=$1
|
||||
|
||||
vm_boot "$vm_name"
|
||||
|
||||
# Wait for ssh connection and execute scripts in autostart directory
|
||||
# (for wbatch, osbashauto does the processing instead)
|
||||
${WBATCH:+:} ssh_process_autostart "$vm_name" &
|
||||
|
||||
wait_for_autofiles
|
||||
echo >&2 "VM \"$vm_name\": autostart files executed"
|
||||
}
|
||||
|
||||
# Create a new node VM
|
||||
function vm_create_node {
|
||||
# XXX Run this function in sub-shell to protect our caller's environment
|
||||
# (which might be _our_ environment if we get called again)
|
||||
(
|
||||
source "$CONFIG_DIR/config.$vm_name"
|
||||
|
||||
vm_name=$1
|
||||
|
||||
vm_create "$vm_name"
|
||||
|
||||
# Set VM_MEM in config/config.NODE_NAME to override
|
||||
vm_mem "$vm_name" "${VM_MEM:-512}"
|
||||
|
||||
# Set VM_CPUS in config/config.NODE_NAME to override
|
||||
vm_cpus "$vm_name" "${VM_CPUS:-1}"
|
||||
|
||||
configure_node_netifs "$vm_name"
|
||||
|
||||
# Port forwarding
|
||||
if [ -n "${VM_SSH_PORT:-}" ]; then
|
||||
vm_port "$vm_name" ssh "$VM_SSH_PORT" 22
|
||||
fi
|
||||
if [ -n "${VM_WWW_PORT:-}" ]; then
|
||||
vm_port "$vm_name" http "$VM_WWW_PORT" 80
|
||||
fi
|
||||
|
||||
vm_add_share "$vm_name" "$SHARE_DIR" "$SHARE_NAME"
|
||||
|
||||
if [ "${FIRST_DISK_SIZE:-0}" -gt 0 ]; then
|
||||
# Used for PXE build (does not use basedisk)
|
||||
local first_disk_path=$DISK_DIR/$vm_name-sda.vdi
|
||||
create_vdi "$first_disk_path" "${FIRST_DISK_SIZE}"
|
||||
# Port 0 is default
|
||||
vm_attach_disk "$vm_name" "$first_disk_path"
|
||||
else
|
||||
# Use copy-on-write disk over basedisk
|
||||
vm_attach_disk_multi "$vm_name" "$(get_base_disk_path)"
|
||||
fi
|
||||
|
||||
if [ "${SECOND_DISK_SIZE:-0}" -gt 0 ]; then
|
||||
local second_disk_path=$DISK_DIR/$vm_name-sdb.vdi
|
||||
create_vdi "$second_disk_path" "${SECOND_DISK_SIZE}"
|
||||
# Use port 1
|
||||
vm_attach_disk "$vm_name" "$second_disk_path" 1
|
||||
fi
|
||||
)
|
||||
}
|
||||
|
||||
function vm_build_nodes {
|
||||
CONFIG_NAME=$(get_distro_name "$DISTRO")_$1
|
||||
echo -e "${CInfo:-}Configuration file: ${CData:-}$CONFIG_NAME${CReset:-}"
|
||||
|
||||
${WBATCH:-:} wbatch_begin_node "$CONFIG_NAME"
|
||||
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
autostart_reset
|
||||
autostart_from_config "scripts.$CONFIG_NAME"
|
||||
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
${WBATCH:-:} wbatch_end_file
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,310 +0,0 @@
|
||||
# The functions in this library are used to get scancode strings for VirtualBox
|
||||
# keyboard input (keyboardputscancode).
|
||||
#
|
||||
# It was generated mostly from output of Cameron Kerr's scancodes.l:
|
||||
# http://humbledown.org/keyboard-scancodes.xhtml
|
||||
#
|
||||
# The library works with bash 3.2 (shipped with Mac OS X as of 2014).
|
||||
|
||||
function char2scancode {
|
||||
local key=$1
|
||||
case "$key" in
|
||||
'a')
|
||||
echo -n " 1e 9e"
|
||||
;;
|
||||
'b')
|
||||
echo -n " 30 b0"
|
||||
;;
|
||||
'c')
|
||||
echo -n " 2e ae"
|
||||
;;
|
||||
'd')
|
||||
echo -n " 20 a0"
|
||||
;;
|
||||
'e')
|
||||
echo -n " 12 92"
|
||||
;;
|
||||
'f')
|
||||
echo -n " 21 a1"
|
||||
;;
|
||||
'g')
|
||||
echo -n " 22 a2"
|
||||
;;
|
||||
'h')
|
||||
echo -n " 23 a3"
|
||||
;;
|
||||
'i')
|
||||
echo -n " 17 97"
|
||||
;;
|
||||
'j')
|
||||
echo -n " 24 a4"
|
||||
;;
|
||||
'k')
|
||||
echo -n " 25 a5"
|
||||
;;
|
||||
'l')
|
||||
echo -n " 26 a6"
|
||||
;;
|
||||
'm')
|
||||
echo -n " 32 b2"
|
||||
;;
|
||||
'n')
|
||||
echo -n " 31 b1"
|
||||
;;
|
||||
'o')
|
||||
echo -n " 18 98"
|
||||
;;
|
||||
'p')
|
||||
echo -n " 19 99"
|
||||
;;
|
||||
'q')
|
||||
echo -n " 10 90"
|
||||
;;
|
||||
'r')
|
||||
echo -n " 13 93"
|
||||
;;
|
||||
's')
|
||||
echo -n " 1f 9f"
|
||||
;;
|
||||
't')
|
||||
echo -n " 14 94"
|
||||
;;
|
||||
'u')
|
||||
echo -n " 16 96"
|
||||
;;
|
||||
'v')
|
||||
echo -n " 2f af"
|
||||
;;
|
||||
'w')
|
||||
echo -n " 11 91"
|
||||
;;
|
||||
'x')
|
||||
echo -n " 2d ad"
|
||||
;;
|
||||
'y')
|
||||
echo -n " 15 95"
|
||||
;;
|
||||
'z')
|
||||
echo -n " 2c ac"
|
||||
;;
|
||||
'A')
|
||||
echo -n " 2a 1e 9e aa"
|
||||
;;
|
||||
'B')
|
||||
echo -n " 2a 30 b0 aa"
|
||||
;;
|
||||
'C')
|
||||
echo -n " 2a 2e ae aa"
|
||||
;;
|
||||
'D')
|
||||
echo -n " 2a 20 a0 aa"
|
||||
;;
|
||||
'E')
|
||||
echo -n " 2a 12 92 aa"
|
||||
;;
|
||||
'F')
|
||||
echo -n " 2a 21 a1 aa"
|
||||
;;
|
||||
'G')
|
||||
echo -n " 2a 22 a2 aa"
|
||||
;;
|
||||
'H')
|
||||
echo -n " 2a 23 a3 aa"
|
||||
;;
|
||||
'I')
|
||||
echo -n " 2a 17 97 aa"
|
||||
;;
|
||||
'J')
|
||||
echo -n " 2a 24 a4 aa"
|
||||
;;
|
||||
'K')
|
||||
echo -n " 2a 25 a5 aa"
|
||||
;;
|
||||
'L')
|
||||
echo -n " 2a 26 a6 aa"
|
||||
;;
|
||||
'M')
|
||||
echo -n " 2a 32 b2 aa"
|
||||
;;
|
||||
'N')
|
||||
echo -n " 2a 31 b1 aa"
|
||||
;;
|
||||
'O')
|
||||
echo -n " 2a 18 98 aa"
|
||||
;;
|
||||
'P')
|
||||
echo -n " 2a 19 99 aa"
|
||||
;;
|
||||
'Q')
|
||||
echo -n " 2a 10 90 aa"
|
||||
;;
|
||||
'R')
|
||||
echo -n " 2a 13 93 aa"
|
||||
;;
|
||||
'S')
|
||||
echo -n " 2a 1f 9f aa"
|
||||
;;
|
||||
'T')
|
||||
echo -n " 2a 14 94 aa"
|
||||
;;
|
||||
'U')
|
||||
echo -n " 2a 16 96 aa"
|
||||
;;
|
||||
'V')
|
||||
echo -n " 2a 2f af aa"
|
||||
;;
|
||||
'W')
|
||||
echo -n " 2a 11 91 aa"
|
||||
;;
|
||||
'X')
|
||||
echo -n " 2a 2d ad aa"
|
||||
;;
|
||||
'Z')
|
||||
echo -n " 2a 2c ac aa"
|
||||
;;
|
||||
'Y')
|
||||
echo -n " 2a 15 95 aa"
|
||||
;;
|
||||
'1')
|
||||
echo -n " 02 82"
|
||||
;;
|
||||
'2')
|
||||
echo -n " 03 83"
|
||||
;;
|
||||
'3')
|
||||
echo -n " 04 84"
|
||||
;;
|
||||
'4')
|
||||
echo -n " 05 85"
|
||||
;;
|
||||
'5')
|
||||
echo -n " 06 86"
|
||||
;;
|
||||
'6')
|
||||
echo -n " 07 87"
|
||||
;;
|
||||
'7')
|
||||
echo -n " 08 88"
|
||||
;;
|
||||
'8')
|
||||
echo -n " 09 89"
|
||||
;;
|
||||
'9')
|
||||
echo -n " 0a 8a"
|
||||
;;
|
||||
'0')
|
||||
echo -n " 0b 8b"
|
||||
;;
|
||||
'!')
|
||||
echo -n " 2a 02 82 aa"
|
||||
;;
|
||||
'@')
|
||||
echo -n " 2a 03 83 aa"
|
||||
;;
|
||||
'#')
|
||||
echo -n " 2a 04 84 aa"
|
||||
;;
|
||||
'$')
|
||||
echo -n " 2a 05 85 aa"
|
||||
;;
|
||||
'%')
|
||||
echo -n " 2a 06 86 aa"
|
||||
;;
|
||||
'^')
|
||||
echo -n " 2a 07 87 aa"
|
||||
;;
|
||||
'&')
|
||||
echo -n " 2a 08 88 aa"
|
||||
;;
|
||||
'*')
|
||||
echo -n " 2a 09 89 aa"
|
||||
;;
|
||||
'(')
|
||||
echo -n " 2a 0a 8a aa"
|
||||
;;
|
||||
')')
|
||||
echo -n " 2a 0b 8b aa"
|
||||
;;
|
||||
'-')
|
||||
echo -n " 0c 8c"
|
||||
;;
|
||||
'_')
|
||||
echo -n " 2a 0c 8c aa"
|
||||
;;
|
||||
'=')
|
||||
echo -n " 0d 8d"
|
||||
;;
|
||||
'+')
|
||||
echo -n " 2a 0d 8d aa"
|
||||
;;
|
||||
' ')
|
||||
echo -n " 39 b9"
|
||||
;;
|
||||
'[')
|
||||
echo -n " 1a 9a"
|
||||
;;
|
||||
']')
|
||||
echo -n " 1b 9b"
|
||||
;;
|
||||
'{')
|
||||
echo -n " 2a 1a 9a aa"
|
||||
;;
|
||||
'}')
|
||||
echo -n " 2a 1b 9b aa"
|
||||
;;
|
||||
';')
|
||||
echo -n " 27 a7"
|
||||
;;
|
||||
':')
|
||||
echo -n " 2a 27 a7 aa"
|
||||
;;
|
||||
',')
|
||||
echo -n " 33 b3"
|
||||
;;
|
||||
'.')
|
||||
echo -n " 34 b4"
|
||||
;;
|
||||
'/')
|
||||
echo -n " 35 b5"
|
||||
;;
|
||||
'\')
|
||||
echo -n " 2b ab"
|
||||
;;
|
||||
'|')
|
||||
echo -n " 2a 2b ab aa"
|
||||
;;
|
||||
'?')
|
||||
echo -n " 2a 35 b5 aa"
|
||||
;;
|
||||
'"')
|
||||
echo -n " 2a 28 a8 aa"
|
||||
;;
|
||||
"'")
|
||||
echo -n " 28 a8"
|
||||
;;
|
||||
">")
|
||||
echo -n " 2a 34 b4 aa"
|
||||
;;
|
||||
"<")
|
||||
echo -n " 2a 33 b3 aa"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function esc2scancode {
|
||||
echo -n " 01 81"
|
||||
}
|
||||
|
||||
function enter2scancode {
|
||||
echo -n " 1c 9c"
|
||||
}
|
||||
|
||||
function backspace2scancode {
|
||||
echo -n " 0e 8e"
|
||||
}
|
||||
|
||||
function f6_2scancode {
|
||||
echo -n " 40 c0"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,2 +0,0 @@
|
||||
The files in this directory are used to create Windows batch scripts that
|
||||
can build base disks and VM clusters.
|
@ -1,297 +0,0 @@
|
||||
# This bash library contains the functions that allow osbash to produce
|
||||
# Windows batch files.
|
||||
|
||||
: ${WBATCH_DIR:="$TOP_DIR/wbatch"}
|
||||
|
||||
# By default, Windows batch file templates are in the same directory as this
|
||||
# file
|
||||
: ${WBATCH_TEMPLATE_DIR:=$(dirname "$BASH_SOURCE")}
|
||||
|
||||
# wbatch cannot use ssh for talking to the VM; install VirtualBox guest
|
||||
# additions
|
||||
VM_ACCESS=vbadd
|
||||
|
||||
# With VirtualBox 5.1.6, console type "headless" often gives no access to the
|
||||
# VM console which on Windows is the main method for interacting with the
|
||||
# cluster. Use "separate" which works at least on 5.0.26 and 5.1.6.
|
||||
VM_UI=separate
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Helper functions
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# See functions.host for definition and explanation of exec_cmd
|
||||
WBATCH=exec_cmd
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
function wbatch_reset {
|
||||
clean_dir "$WBATCH_DIR"
|
||||
cp -v "$WBATCH_TEMPLATE_DIR/config_bat" "$WBATCH_DIR/config.bat"
|
||||
}
|
||||
|
||||
function wbatch_new_file {
|
||||
local file_name=$1
|
||||
mkdir -p "$WBATCH_DIR"
|
||||
WBATCH_OUT="$WBATCH_DIR/$file_name"
|
||||
echo -n > "$WBATCH_OUT"
|
||||
}
|
||||
|
||||
function wbatch_close_file {
|
||||
unset WBATCH_OUT
|
||||
}
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
function wbatch_write_line {
|
||||
if [ -n "${WBATCH_OUT:-}" ]; then
|
||||
# Don't expand backslash escapes except for ending the line with CRLF
|
||||
#
|
||||
# Note: Windows batch scripts with LF may seem to work, but (for
|
||||
# instance) jump labels don't work properly
|
||||
echo -n "$@" >> "$WBATCH_OUT"
|
||||
echo -e "\r" >> "$WBATCH_OUT"
|
||||
fi
|
||||
}
|
||||
|
||||
function wbatch_write_stdin {
|
||||
local line=""
|
||||
|
||||
# Set IFS to preserve leading whitespace
|
||||
while IFS= read -r line; do
|
||||
wbatch_write_line "$line"
|
||||
done
|
||||
}
|
||||
|
||||
function wbatch_echo {
|
||||
wbatch_write_line "ECHO %time% $@"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Batch function calls
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function wbatch_abort_if_vm_exists {
|
||||
local vm_name=$1
|
||||
wbatch_write_line "CALL :vm_exists $vm_name"
|
||||
}
|
||||
|
||||
function wbatch_wait_poweroff {
|
||||
local vm_name=$1
|
||||
cat << WBAT | wbatch_write_stdin
|
||||
ECHO %time% Waiting for VM $vm_name to power off.
|
||||
CALL :wait_poweroff $vm_name
|
||||
ECHO %time% VM $vm_name powered off.
|
||||
WBAT
|
||||
}
|
||||
|
||||
function wbatch_wait_auto {
|
||||
cat << WBAT | wbatch_write_stdin
|
||||
ECHO %time% Waiting for autostart files to execute.
|
||||
CALL :wait_auto
|
||||
ECHO %time% All autostart files executed.
|
||||
WBAT
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Batch commands
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function wbatch_delete_disk {
|
||||
local disk=$(basename "$1")
|
||||
wbatch_write_line "IF EXIST %IMGDIR%\\$disk DEL %IMGDIR%\\$disk"
|
||||
}
|
||||
|
||||
function wbatch_rename_disk {
|
||||
local src=$(basename "$1")
|
||||
local target=$(basename "$2")
|
||||
|
||||
wbatch_write_line "MOVE /y %IMGDIR%\\$src %IMGDIR%\\$target"
|
||||
}
|
||||
|
||||
function wbatch_cp_auto {
|
||||
local src=$(wbatch_path_to_windows "$1")
|
||||
local target=$(basename "$2")
|
||||
src=${src//\//\\}
|
||||
wbatch_write_line "COPY %TOPDIR%\\$src %AUTODIR%\\$target"
|
||||
}
|
||||
|
||||
function wbatch_sleep {
|
||||
local sec=$1
|
||||
wbatch_write_line "TIMEOUT /T $sec /NOBREAK"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Templated parts
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Note: BSD and GNU sed behavior is different. Don't try anything fancy
|
||||
# like inserting \r or in-place editing (-i).
|
||||
|
||||
function wbatch_file_header {
|
||||
local product=$1
|
||||
|
||||
sed -e "
|
||||
s,%PRODUCT%,$product,g;
|
||||
" "$WBATCH_TEMPLATE_DIR/template-file_header_bat" | wbatch_write_stdin
|
||||
}
|
||||
|
||||
function wbatch_end_file {
|
||||
cat "$WBATCH_TEMPLATE_DIR/template-end_file_bat" | wbatch_write_stdin
|
||||
wbatch_close_file
|
||||
}
|
||||
|
||||
function wbatch_elevate_privileges {
|
||||
cat "$WBATCH_TEMPLATE_DIR/template-elevate_privs_bat" | wbatch_write_stdin
|
||||
}
|
||||
|
||||
function wbatch_find_vbm {
|
||||
cat "$WBATCH_TEMPLATE_DIR/template-find_vbm_bat" | wbatch_write_stdin
|
||||
}
|
||||
|
||||
function wbatch_mkdirs {
|
||||
local autodir=$(wbatch_path_to_windows "$AUTOSTART_DIR")
|
||||
local imgdir=$(wbatch_path_to_windows "$IMG_DIR")
|
||||
local logdir=$(wbatch_path_to_windows "$LOG_DIR")
|
||||
local statusdir=$(wbatch_path_to_windows "$STATUS_DIR")
|
||||
|
||||
autodir=$(wbatch_escape_backslash "$autodir")
|
||||
imgdir=$(wbatch_escape_backslash "$imgdir")
|
||||
logdir=$(wbatch_escape_backslash "$logdir")
|
||||
statusdir=$(wbatch_escape_backslash "$statusdir")
|
||||
|
||||
sed -e "
|
||||
s,%P_AUTODIR%,$autodir,g;
|
||||
s,%P_IMGDIR%,$imgdir,g;
|
||||
s,%P_LOGDIR%,$logdir,g;
|
||||
s,%P_STATUSDIR%,$statusdir,g;
|
||||
" "$WBATCH_TEMPLATE_DIR/template-mkdirs_bat" | wbatch_write_stdin
|
||||
}
|
||||
|
||||
function wbatch_create_hostnet {
|
||||
wbatch_new_file "create_hostnet.bat"
|
||||
wbatch_file_header "host-only networks"
|
||||
cat "$WBATCH_TEMPLATE_DIR/template-begin_hostnet_bat" | wbatch_write_stdin
|
||||
# Creating networks requires elevated privileges
|
||||
wbatch_elevate_privileges
|
||||
wbatch_find_vbm
|
||||
|
||||
local index
|
||||
local if_name
|
||||
local win_adapter
|
||||
for index in "${!NET_NAME[@]}"; do
|
||||
if_name=${NET_IFNAME[index]}
|
||||
# The host-side interface is the default gateway of the network
|
||||
if_ip=${NET_GW[index]}
|
||||
# Translate if_name to Windows-type interface name
|
||||
win_adapter=$if_name
|
||||
sed -e "
|
||||
s,%IFNAME%,${win_adapter},g;
|
||||
s,%IFIP%,${if_ip},g;
|
||||
" "$WBATCH_TEMPLATE_DIR/template-create_hostnet_bat" | wbatch_write_stdin
|
||||
echo | wbatch_write_stdin
|
||||
done
|
||||
|
||||
wbatch_end_file
|
||||
}
|
||||
|
||||
function wbatch_begin_base {
|
||||
local iso_name=$(get_iso_name)
|
||||
|
||||
if [ -z "$iso_name" ]; then
|
||||
echo >&2 "Windows batch file needs install ISO URL (ISO_URL)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wbatch_new_file "create_base.bat"
|
||||
wbatch_file_header "base disk"
|
||||
wbatch_find_vbm
|
||||
wbatch_mkdirs
|
||||
|
||||
sed -e "
|
||||
s,%INSTALLFILE%,$iso_name,g;
|
||||
s,%ISOURL%,$ISO_URL,g;
|
||||
" "$WBATCH_TEMPLATE_DIR/template-begin_base_bat" | wbatch_write_stdin
|
||||
}
|
||||
|
||||
function wbatch_begin_node {
|
||||
local node_name=$1
|
||||
wbatch_new_file "create_${node_name}_node.bat"
|
||||
wbatch_file_header "$node_name VM"
|
||||
wbatch_find_vbm
|
||||
wbatch_mkdirs
|
||||
|
||||
local basedisk=$(get_base_disk_name).vdi
|
||||
|
||||
sed -e "
|
||||
s,%BASEDISK%,$basedisk,g;
|
||||
" "$WBATCH_TEMPLATE_DIR/template-begin_node_bat" | wbatch_write_stdin
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# VBoxManage call handling
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function wbatch_log_vbm {
|
||||
ARGS=( "$@" )
|
||||
for i in "${!ARGS[@]}"; do
|
||||
case "${ARGS[i]}" in
|
||||
--hostonlyadapter*)
|
||||
# The next arg is the host-only interface name -> change it
|
||||
ARGS[i+1]=\"%${ARGS[i+1]}%\"
|
||||
;;
|
||||
--hostpath)
|
||||
# The next arg is the shared dir -> change it
|
||||
ARGS[i+1]='%SHAREDIR%'
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
# On Windows, ISO and base disk images must be in IMGDIR
|
||||
re='\.(iso|vdi)$'
|
||||
if [[ "${ARGS[i]}" =~ $re ]]; then
|
||||
local img_name=$(basename "${ARGS[i]}")
|
||||
ARGS[i]="%IMGDIR%\\$img_name"
|
||||
continue
|
||||
fi
|
||||
done
|
||||
|
||||
# Echo what we are about to do
|
||||
wbatch_write_line "ECHO VBoxManage ${ARGS[@]}"
|
||||
|
||||
wbatch_write_line "\"%VBM%\" ${ARGS[@]}"
|
||||
|
||||
# Abort if VBoxManage call raised errorlevel
|
||||
wbatch_write_line "IF %errorlevel% NEQ 0 GOTO :vbm_error"
|
||||
|
||||
# Blank line for readability
|
||||
wbatch_write_line ""
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Windows path name helpers
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# On Windows, all paths are relative to TOP_DIR
|
||||
function wbatch_path_to_windows {
|
||||
local full_path=$1
|
||||
# strip off ${TOP_DIR}/
|
||||
full_path="${full_path/$TOP_DIR\//}"
|
||||
full_path=$(wbatch_slash_to_backslash "$full_path")
|
||||
echo "$full_path"
|
||||
}
|
||||
|
||||
# Escape backslashes in (path) variables that are given to sed
|
||||
function wbatch_escape_backslash {
|
||||
local string=$1
|
||||
string="${string//\\/\\\\}"
|
||||
echo "$string"
|
||||
}
|
||||
|
||||
function wbatch_slash_to_backslash {
|
||||
local some_path=$1
|
||||
some_path="${some_path//\//\\}"
|
||||
echo "$some_path"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1,6 +0,0 @@
|
||||
REM Default path for VBoxManage
|
||||
REM Example setting:
|
||||
REM SET VBM=C:\Program Files\Oracle\VirtualBox\VBoxManage.exe
|
||||
SET VBM=%ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe
|
||||
|
||||
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
|
@ -1,37 +0,0 @@
|
||||
ECHO %time% Cleaning up autostart and log directories
|
||||
DEL /S /Q %AUTODIR%
|
||||
DEL /S /Q %LOGDIR%
|
||||
|
||||
ECHO %time% Looking for %IMGDIR%\%INSTALLFILE%
|
||||
IF EXIST %IMGDIR%\%INSTALLFILE% goto got_install_iso
|
||||
|
||||
ECHO.
|
||||
ECHO %INSTALLFILE% not found in %IMGDIR%.
|
||||
ECHO.
|
||||
ECHO Trying to download the install ISO from
|
||||
ECHO %ISOURL%
|
||||
ECHO.
|
||||
ECHO Expect this to take several minutes or longer, depending on your
|
||||
ECHO Internet connection.
|
||||
ECHO.
|
||||
cscript /nologo %TOOLSDIR%\downloader.js %ISOURL%
|
||||
RENAME downloaded.bin %INSTALLFILE%
|
||||
MOVE %INSTALLFILE% %IMGDIR%
|
||||
IF EXIST %IMGDIR%\%INSTALLFILE% goto got_install_iso
|
||||
ECHO.
|
||||
ECHO %INSTALLFILE% still not found in %IMGDIR%.
|
||||
ECHO Aborting.
|
||||
ECHO.
|
||||
|
||||
goto :terminate
|
||||
|
||||
:got_install_iso
|
||||
ECHO.
|
||||
ECHO %time% Found %IMGDIR%\%INSTALLFILE%
|
||||
ECHO.
|
||||
ECHO %time% Initialization done. Hit any key to continue.
|
||||
ECHO.
|
||||
PAUSE
|
||||
|
||||
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
|
||||
|
@ -1,6 +0,0 @@
|
||||
ECHO %time% Deleting old iface_config.bat
|
||||
IF EXIST "%~dp0\iface_config.bat" DEL "%~dp0\iface_config.bat"
|
||||
ECHO.
|
||||
|
||||
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
|
||||
|
@ -1,26 +0,0 @@
|
||||
ECHO %time% Loading network interface names
|
||||
CALL "%~dp0\iface_config.bat"
|
||||
|
||||
ECHO %time% Cleaning up autostart and log directories
|
||||
DEL /S /Q %AUTODIR%
|
||||
DEL /S /Q %LOGDIR%
|
||||
|
||||
ECHO %time% Looking for %IMGDIR%\%BASEDISK%
|
||||
IF EXIST %IMGDIR%\%BASEDISK% goto got_base_disk
|
||||
ECHO.
|
||||
ECHO %BASEDISK% not found in %IMGDIR%.
|
||||
ECHO.
|
||||
ECHO You need to build a base disk before you can create node VMs.
|
||||
ECHO.
|
||||
goto :terminate
|
||||
|
||||
:got_base_disk
|
||||
ECHO.
|
||||
ECHO %time% Found %IMGDIR%\%BASEDISK%
|
||||
ECHO.
|
||||
ECHO %time% Initialization done. Hit any key to continue.
|
||||
ECHO.
|
||||
PAUSE
|
||||
|
||||
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user