diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2019-08-10 23:36:25 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2019-08-10 23:38:58 +0300 |
commit | 3ea86cef862d7034ee0d540cea5050a72505952c (patch) | |
tree | 640fb3e6bf48c96e26a78ea315ee9c4317d3d66d /src/os.sh | |
parent | refactor db.sh (diff) | |
download | config-links-3ea86cef862d7034ee0d540cea5050a72505952c.tar.gz config-links-3ea86cef862d7034ee0d540cea5050a72505952c.zip |
add os.sh & fix a couple of bugs
Diffstat (limited to 'src/os.sh')
-rw-r--r-- | src/os.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/os.sh b/src/os.sh new file mode 100644 index 0000000..2a532cd --- /dev/null +++ b/src/os.sh @@ -0,0 +1,33 @@ +# Copyright (c) 2016 Egor Tensin <Egor.Tensin@gmail.com> +# This file is part of the "Configuration file sharing" project. +# For details, see https://github.com/egor-tensin/config-links. +# Distributed under the MIT License. + +# Mostly Cygwin-related stuff + +os="$( uname -o )" +readonly os + +is_cygwin() { + test "$os" == 'Cygwin' +} + +check_symlinks_enabled_cygwin() { + case "${CYGWIN-}" in + *winsymlinks:native*) ;; + *winsymlinks:nativestrict*) ;; + + *) + dump "native Windows symlinks aren't enabled in Cygwin" >&2 + return 1 + ;; + esac +} + +check_symlinks_enabled() { + if is_cygwin; then + check_symlinks_enabled_cygwin + else + return 0 + fi +} |