[installer] Do not follow an existing symbolic link when overwriting

Without `-h` option, `ln` command makes a symbolic link under the existing
link destination like `Toolchains/swift-DEVELOPMENT-SNAPSHOT-XX.xctoolchain/`.

```
$ ln -fs swift-DEVELOPMENT-SNAPSHOT-XX.xctoolchain swift-latest.xctoolchain
$ ln -fs swift-DEVELOPMENT-SNAPSHOT-YY.xctoolchain swift-latest.xctoolchain
$ tree
|-- swift-DEVELOPMENT-SNAPSHOT-XX.xctoolchain
|   |-- swift-DEVELOPMENT-SNAPSHOT-YY.xctoolchain -> swift-DEVELOPMENT-SNAPSHOT-YY.xctoolchain
|-- swift-DEVELOPMENT-SNAPSHOT-YY.xctoolchain
|-- swift-latest.xctoolchain -> swift-DEVELOPMENT-SNAPSHOT-XX.xctoolchain
```

So we should not follow the existing symbolic link even if it already
exists.
This commit is contained in:
Yuta Saito
2020-11-24 13:16:58 +09:00
parent a70b040538
commit 86700b63b1

View File

@@ -13,4 +13,4 @@
INSTALLED_TOOLCHAIN=$2
ln -fs "${INSTALLED_TOOLCHAIN}" "${INSTALLED_TOOLCHAIN%/*}/swift-latest.xctoolchain"
ln -fhs "${INSTALLED_TOOLCHAIN}" "${INSTALLED_TOOLCHAIN%/*}/swift-latest.xctoolchain"