mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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.
17 lines
649 B
Bash
Executable File
17 lines
649 B
Bash
Executable File
#!/usr/bin/env bash
|
|
#===--- postinstall - Creates symlink after installing xctoolchain ----------===#
|
|
#
|
|
## This source file is part of the Swift.org open source project
|
|
##
|
|
## Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
|
## Licensed under Apache License v2.0 with Runtime Library Exception
|
|
##
|
|
## See https://swift.org/LICENSE.txt for license information
|
|
## See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
#
|
|
#===------------------------------------------------------------------------===#
|
|
|
|
INSTALLED_TOOLCHAIN=$2
|
|
|
|
ln -fhs "${INSTALLED_TOOLCHAIN}" "${INSTALLED_TOOLCHAIN%/*}/swift-latest.xctoolchain"
|