Change-Id: Ibab1bb95521292ae818bd91f7073c3749a2cc0cbchanges/47/399347/1
commit
7d5afecfd9
@ -1 +0,0 @@
|
||||
include README.rst
|
@ -1,9 +1 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
export DIB_EXTLINUX=1
|
||||
|
@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
rm -rf /tmp/grub
|
@ -1,47 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
# grub2 isn't available on rhel6/centos6; they are setup to use
|
||||
# extlinux. skip this
|
||||
# you would think we could match on $DISTRO or something else; but
|
||||
# we can't because the rhel/centos elements are a bit mixed up;
|
||||
# centos-minimal for example sets distro to "centos". so the best
|
||||
# check is just for the original "grub-install" script
|
||||
if [ -f /sbin/grub-install ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# remove grub2 package. As described in
|
||||
# elements/ubuntu/pre-install.d/00-remove-grub; the grub post-kernel
|
||||
# install hook will barf if the block device can't be found (as
|
||||
# happens in a chroot).
|
||||
#
|
||||
# XXX : it is not clear this is necessary for fedora/centos7 and it's
|
||||
# install hooks. Investigation is required.
|
||||
if rpm -q grub2; then
|
||||
install-packages -e grub-pc
|
||||
fi
|
||||
|
||||
# now configure things to re-install grub at the end. We don't want
|
||||
# to rely on vm/finalise.d/51-bootloader to simply reinstall the
|
||||
# package via the package-manager, because at that point (during
|
||||
# finalise) the build-time yum-cache has been unmounted (hence the
|
||||
# local-cache looks empty) and yum may try to repopulate the
|
||||
# local-cache with all the grub2 dependencies. This is slow, and
|
||||
# potentially fills up the disk.
|
||||
#
|
||||
# XXX : At this point, keepcache=0 *should* probably be set for
|
||||
# yum/dnf. We have not standarised/documented that this will be done,
|
||||
# however. This would *probably* stop dependencies being populated
|
||||
# into the cache. We could investigate this, and possibly remove this
|
||||
# all together if we standardise some of these behaviours.
|
||||
|
||||
# So we download the latest grub2 package and setup the install script
|
||||
# to just install the single-package, which will be called later by
|
||||
# vm/finalise.d/51-bootloader
|
||||
install-packages -d /tmp/grub grub-pc
|
||||
echo "rpm -i /tmp/grub/*.rpm" > /tmp/grub/install
|
@ -1 +1,2 @@
|
||||
dib-init-system
|
||||
install-static
|
||||
|
@ -1,4 +1,4 @@
|
||||
export DISTRO_NAME=ubuntu
|
||||
export DIB_RELEASE=${DIB_RELEASE:-trusty}
|
||||
export DIB_RELEASE=${DIB_RELEASE:-xenial}
|
||||
export DIB_DEBIAN_COMPONENTS=${DIB_DEBIAN_COMPONENTS:-main,restricted,universe}
|
||||
export DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-http://archive.ubuntu.com/ubuntu}
|
||||
|
@ -1,2 +1,2 @@
|
||||
export DISTRO_NAME=ubuntu
|
||||
export DIB_RELEASE=${DIB_RELEASE:-trusty}
|
||||
export DIB_RELEASE=${DIB_RELEASE:-xenial}
|
||||
|
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2016 Red Hat, Inc.
|
||||
#
|
||||
# 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.
|
||||
# dib-lint: disable=dibdebugtrace
|
||||
|
||||
set -exu
|
||||
set -o pipefail
|
||||
|
||||
# We are running into race conditions with glean, which ssh-keygen -A is
|
||||
# not handling properly. So, create a new script to first check if the
|
||||
# file exists, then use 'yes' to disable overwriting of existing files.
|
||||
|
||||
for key in dsa ecdsa ed25519 rsa; do
|
||||
FILE=/etc/ssh/ssh_host_${key}_key
|
||||
if ! [ -e $FILE ]; then
|
||||
/usr/bin/yes n | /usr/bin/ssh-keygen -f $FILE -N '' -t $key
|
||||
fi
|
||||
done
|
@ -0,0 +1,12 @@
|
||||
======
|
||||
sysctl
|
||||
======
|
||||
|
||||
Add a sysctl-set-value command which can be run from within an element.
|
||||
Running this command will cause the sysctl value to be set on boot (by
|
||||
writing the value to /etc/sysctl.d).
|
||||
|
||||
Example usage
|
||||
|
||||
::
|
||||
sysctl-set-value net.ipv4.ip_forward 1
|
@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copied from tripleo-image-element's sysctl element
|
||||
#
|
||||
# Validate and manage setting sysctl settings.
|
||||
#
|
||||
# The script is called with name/value pairs which are stored
|
||||
# in the system default sysctl.d directory. Before adding new
|
||||
# settings a validation is done to ensure that conflicting
|
||||
# sysctl settings have not been requested. Once finished sysctl
|
||||
# is used to activate the changes.
|
||||
|
||||
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
NAME=${1:-}
|
||||
VALUE=${2:-}
|
||||
# Optional comment used to describe the setting
|
||||
COMMENT=${3:-"This file was created by diskimage-builder."}
|
||||
|
||||
if [ -z "$NAME" -o -z "$VALUE" ]; then
|
||||
echo "NAME and VALUE are required."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FILENAME="/etc/sysctl.d/${NAME}.conf"
|
||||
|
||||
if [ -f $FILENAME ]; then
|
||||
# check to make sure the settings match... otherwise fail
|
||||
if ! grep -q "^$NAME = $VALUE" $FILENAME; then
|
||||
echo "Conflicting sysctl.conf setting for $NAME == $VALUE. Found:"
|
||||
grep "^$NAME" $FILENAME
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
|
||||
if ! sysctl -a | grep -q "^$NAME"; then
|
||||
echo "Invalid sysctl key: $NAME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sysctl-write-value $NAME "$VALUE" "$COMMENT"
|
||||
|
||||
sysctl -p $FILENAME
|
||||
|
||||
fi
|
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copied from tripleo-image-element's sysctl element
|
||||
#
|
||||
# Validate and manage setting sysctl settings.
|
||||
#
|
||||
# The script is called with name/value pairs which are stored
|
||||
# in the system default sysctl.d directory. This script performs
|
||||
# no checking, just writing out the file.
|
||||
|
||||
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
NAME=${1:-}
|
||||
VALUE=${2:-}
|
||||
# Optional comment used to describe the setting
|
||||
COMMENT=${3:-"This file was created by diskimage-builder."}
|
||||
|
||||
if [ -z "$NAME" -o -z "$VALUE" ]; then
|
||||
echo "Usage: sysctl-write-value <name> <value> [comment]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FILENAME="/etc/sysctl.d/${NAME}.conf"
|
||||
|
||||
cat > $FILENAME <<EOF_CAT
|
||||
# $COMMENT
|
||||
$NAME = $VALUE
|
||||
EOF_CAT
|
Loading…
Reference in new issue