Merge "Symlink correct element install type"

This commit is contained in:
Jenkins 2014-01-16 11:56:23 +00:00 committed by Gerrit Code Review
commit 016fc76d84
2 changed files with 40 additions and 2 deletions

View File

@ -45,6 +45,31 @@ it will be renamed to \<destination\>
The package type indicates the element should install from packages onto the The package type indicates the element should install from packages onto the
root filesystem of the image build during the install.d phase. root filesystem of the image build during the install.d phase.
Git and Tarballs are treated as source installs. If the element provides an
<element-name>-source-install directory under it's install.d hook directory,
symlinks to the scripts in that directory will be created under install.d for
the image build. Alternatively for the package install type, if the element
provides an <element-name>-package-install directory, symlinks will be created
for those scripts instead.
For example, the nova element would provide:
nova/install.d/nova-package-install/74-nova
nova/install.d/nova-source-install/74-nova
source-repositories will create the following symlink for the package install
type:
install.d/74-nova -> nova-package-install/74-nova
Or, for the source install type:
install.d/74-nova -> nova-source-install/74-nova
All other scripts that exist under install.d for an element will be executed as
normal. This allows common install code to live in a script outside of
<element-name>-package-install or <element-name>-source-install.
If multiple elements register a source location with the same <destination> If multiple elements register a source location with the same <destination>
then source-repositories will exit with an error. Care should therefore be taken then source-repositories will exit with an error. Care should therefore be taken
to only use elements together that download source to different locations. to only use elements together that download source to different locations.

View File

@ -108,12 +108,25 @@ function get_repos_for_element(){
return 1 return 1
;; ;;
esac esac
# Capture the in-instance repository path for later review / other # Capture the in-instance repository path for later review / other
# elements (like a pypi dependency cache). # elements (like a pypi dependency cache).
echo "$REPOPATH" | sudo dd of=$TMP_MOUNT_PATH/etc/dib-source-repositories oflag=append conv=notrunc echo "$REPOPATH" | sudo dd of=$TMP_MOUNT_PATH/etc/dib-source-repositories oflag=append conv=notrunc
# Save the $REPOTYPE used so that it can be used later by install.d # Save the $REPOTYPE used so that it can be used later by install.d
mkdir -p $TMP_HOOKS_PATH/environment.d if [ "$REPOTYPE" = "package" ]; then
echo "export DIB_REPOTYPE_${REPONAME//-/_}=$REPOTYPE" >> $TMP_HOOKS_PATH/environment.d/01-source-repositories-environment REPOINSTALLTYPE="package"
else
REPOINSTALLTYPE="source"
fi
# Create symlink for correct install type
pushd $TMP_HOOKS_PATH/install.d
if [ -e $REPONAME-$REPOINSTALLTYPE-install ]; then
ln -sf $REPONAME-$REPOINSTALLTYPE-install/* .
fi
popd
else else
echo "Couldn't parse '$line' as a source repository" echo "Couldn't parse '$line' as a source repository"
return 1 return 1