Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/cmd-init
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ mkdir -p src
(cd src
if ! test -e config; then
case "${source}" in
/*) ln -s "${source}/${subdir}" config;;
/*) ln -s "${source}" config;;
*) git clone ${BRANCH:+--branch=${BRANCH}} --depth=1 --shallow-submodules --recurse-submodules "${source}" config
# If a commit was specified then we'll fetch and reset
# the specified branch to that commit. This is useful when
Expand All @@ -124,13 +124,13 @@ mkdir -p src
git -C ./config fetch origin "$COMMIT"
git -C ./config reset --hard "$COMMIT"
fi
if [ -n "${subdir}" ]; then
mv config config-git
ln -sr config-git/"${subdir}" config
fi
(set +x; cd config && echo -n "Config commit: " && git describe --tags --always --abbrev=42)
;;
esac
if [ -n "${subdir}" ]; then
mv config config-git
ln -s config-git/"${subdir}" config
fi
manifest=config/manifest.yaml
if ! [ -f "${manifest}" ]; then
echo 1>&2 "Failed to find src/${manifest}"
Expand Down
7 changes: 5 additions & 2 deletions src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ prepare_build() {
echo "Using manifest: ${manifest}"

# backcompat for local setups that initialized with `ln -sr`
if [ -L "${configdir}" ]; then
if [ -L "${configdir}" ] && [ ! -e "${workdir}/src/config-git" ]; then
if [[ $(readlink "${configdir}") != /* ]]; then
ln -sfn "$(realpath "${configdir}")" "${configdir}"
fi
Expand Down Expand Up @@ -673,7 +673,10 @@ EOF

# support local dev cases where src/config is a symlink. Note if you change or extend to this set,
# you also need to update supermin-init-prelude.sh to mount it inside the VM.
if [ -L "${workdir}/src/config" ]; then
if [ -L "${workdir}/src/config-git" ]; then
# qemu follows symlinks
base_qemu_args+=("-virtfs" 'local,id=source,path='"${workdir}"'/src/config-git,security_model=none,mount_tag=source')
elif [ -L "${workdir}/src/config" ]; then
# qemu follows symlinks
base_qemu_args+=("-virtfs" 'local,id=source,path='"${workdir}"'/src/config,security_model=none,mount_tag=source')
fi
Expand Down
7 changes: 5 additions & 2 deletions src/supermin-init-prelude.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ umask 002
# https://github.com/coreos/coreos-assembler/issues/2171
mkdir -p "${workdir:?}"
mount -t 9p -o rw,trans=virtio,version=9p2000.L,msize=10485760 workdir "${workdir}"
# These two invocations pair with virtfs setups for qemu in cmdlib.sh. Keep them in sync.
if [ -L "${workdir}"/src/config ]; then
# These invocations pair with virtfs setups for qemu in cmdlib.sh. Keep them in sync.
if [ -L "${workdir}"/src/config-git ]; then
mkdir -p "$(readlink "${workdir}"/src/config-git)"
mount -t 9p -o rw,trans=virtio,version=9p2000.L,msize=10485760 source "${workdir}"/src/config-git
elif [ -L "${workdir}"/src/config ]; then
mkdir -p "$(readlink "${workdir}"/src/config)"
mount -t 9p -o rw,trans=virtio,version=9p2000.L,msize=10485760 source "${workdir}"/src/config
fi
Expand Down