diff --git a/precise/host/hooks/install.d/70-0k.sh b/precise/host/hooks/install.d/70-0k.sh index 3f02fd08..80931f44 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 )