From 960677541f152eefae5d50697fdda6225ceed47b Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Fri, 13 Mar 2020 10:18:37 +0100 Subject: [PATCH] fix: support updating to compatible layout in ``/srv/charm-store`` Last ``compose`` will require ``/srv/charm-store`` not to use symbolic links because of bad support in windows support. Signed-off-by: Valentin Lab --- precise/host/hooks/install.d/70-0k.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/precise/host/hooks/install.d/70-0k.sh b/precise/host/hooks/install.d/70-0k.sh index 3f02fd0..80931f4 100755 --- a/precise/host/hooks/install.d/70-0k.sh +++ b/precise/host/hooks/install.d/70-0k.sh @@ -90,10 +90,19 @@ fi git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE/0k/0k-charms.git" fi - if ! [ -d "/srv/charm-store" ]; then - mkdir -p /srv/charm-store + if [ -d "/srv/charm-store" ]; then + if [ -L "/srv/charm-store" ]; then + info "Already have a valid /srv/charm-store" + elif [ -L "/srv/charm-store/0k-charms" ]; then + mv /srv/charm-store{,.old} && + mv /srv/charm-store.old/0k-charms /srv/charm-store && + rmdir /srv/charm-store.old + else + die "Unexpected layout of '/srv/charm-store'. Bailing out." + fi + else + ln -sfn /opt/apps/0k-charms /srv/charm-store fi - ln -sfn /opt/apps/0k-charms /srv/charm-store/0k-charms )