Add element to modify /etc/apt/sources.list in dib
Add apt-sources element for Ubuntu OS to override the default /etc/apt/sources.list in cloudimg. Set DIB_APT_SOURCES with a proper sources.list file to replace the default one. If you want to use this element in tripleo project, set NODE_DIST or EXTRA_ELEMENTS / UNDERCLOUD_DIB_EXTRA_ARGS / OVERCLOUD_DIB_EXTRA_ARGS to make it take effect at build time and run time. e.g. before running devtest.sh: export DIB_APT_SOURCES=/etc/apt/sources.list export NODE_DIST="ubuntu apt-sources" Change-Id: I9ce0d03b506c2948b96382e4d6e85f0aff906450
This commit is contained in:
parent
7da1425438
commit
5daa989fb8
15
elements/apt-sources/README.md
Normal file
15
elements/apt-sources/README.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
Override the default sources.list
|
||||||
|
|
||||||
|
For Ubuntu OS, if your network connection is slow for the default sources.list,
|
||||||
|
you can define DIB_APT_SOURCES with your favorite sources.list to override it,
|
||||||
|
before running devtest.sh.
|
||||||
|
|
||||||
|
The new sources.list will take effect at build time and run time.
|
||||||
|
|
||||||
|
If you want to use this element in tripleo project, set NODE_DIST or
|
||||||
|
EXTRA_ELEMENTS / UNDERCLOUD_DIB_EXTRA_ARGS / OVERCLOUD_DIB_EXTRA_ARGS
|
||||||
|
to make it take effect at build time and run time.
|
||||||
|
|
||||||
|
e.g. before running devtest.sh:
|
||||||
|
export DIB_APT_SOURCES=/etc/apt/sources.list
|
||||||
|
export NODE_DIST="ubuntu apt-sources"
|
25
elements/apt-sources/extra-data.d/99-override-default-apt-sources
Executable file
25
elements/apt-sources/extra-data.d/99-override-default-apt-sources
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Override the default /etc/apt/sources.list with $DIB_APT_SOURCES
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# get the cloudimg version
|
||||||
|
source $TMP_MOUNT_PATH/etc/lsb-release
|
||||||
|
echo "Current cloudimg codename is: $DISTRIB_DESCRIPTION $DISTRIB_CODENAME"
|
||||||
|
|
||||||
|
# exit directly if DIB_APT_SOURCES is not defined properly
|
||||||
|
if [ -z "$DIB_APT_SOURCES" ] ; then
|
||||||
|
echo "DIB_APT_SOURCES must be set to the location of a sources.list file you wish to use"
|
||||||
|
exit 1
|
||||||
|
elif [ ! -f "$DIB_APT_SOURCES" -o ! -s "$DIB_APT_SOURCES" ] ; then
|
||||||
|
echo "$DIB_APT_SOURCES is not a valid sources.list file."
|
||||||
|
echo "You should assign proper sources.list file in DIB_APT_SOURCES"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
DIB_APT_SOURCES=`readlink -f $DIB_APT_SOURCES`
|
||||||
|
|
||||||
|
# copy the sources.list to cloudimg
|
||||||
|
pushd $TMP_MOUNT_PATH/etc/apt/
|
||||||
|
sudo cp -f $DIB_APT_SOURCES sources.list
|
||||||
|
popd
|
Loading…
Reference in New Issue
Block a user