diff options
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | README.md | 10 | ||||
-rwxr-xr-x | links-chmod | 2 | ||||
-rwxr-xr-x | links-remove | 2 | ||||
-rwxr-xr-x | links-update | 14 | ||||
-rw-r--r-- | test/docker-compose.yml | 13 | ||||
-rw-r--r-- | test/docker/Dockerfile | 8 | ||||
-rw-r--r-- | test/docker/docker-compose.yml | 10 | ||||
-rwxr-xr-x | test/linux-home/test.sh (renamed from test/integration/test.sh) | 6 | ||||
-rw-r--r-- | test/local/dirs/dest/1.txt (renamed from test/unit/dest/1.txt) | 0 | ||||
-rw-r--r-- | test/local/dirs/dest/bar/3.txt (renamed from test/unit/dest/bar/3.txt) | 0 | ||||
-rw-r--r-- | test/local/dirs/src/%DEST%/1.txt (renamed from test/unit/src/%DEST%/1.txt) | 0 | ||||
-rw-r--r-- | test/local/dirs/src/%DEST%/bar/3.txt (renamed from test/unit/src/%DEST%/bar/3.txt) | 0 | ||||
-rw-r--r-- | test/local/dirs/src/%DEST%/bar/baz/4.txt (renamed from test/unit/src/%DEST%/bar/baz/4.txt) | 0 | ||||
-rw-r--r-- | test/local/dirs/src/%DEST%/foo/2.txt (renamed from test/unit/src/%DEST%/foo/2.txt) | 0 | ||||
-rwxr-xr-x | test/local/test.sh (renamed from test/unit/test.sh) | 4 |
16 files changed, 44 insertions, 35 deletions
@@ -34,11 +34,15 @@ test/all: test/local test/docker .PHONY: test/local test/local: - ./test/unit/test.sh + ./test/local/test.sh + +.PHONY: test/linux-home +test/linux-home: + ./test/linux-home/test.sh test/docker/%: DO - cd test && \ - DISTRO='$*' docker-compose build --pull && \ + cd test/docker && \ + DISTRO='$*' docker-compose build --force-rm --progress plain --pull -q && \ docker-compose run --rm test && \ docker-compose down -v @@ -134,6 +134,16 @@ macOS is supported on a basic level. GNU coreutils and findutils are required, which you can install using Homebrew. Don't forget to add them to PATH! +Cygwin +------ + +These scripts rely on the availability of native symlinks. +On Windows/NTFS, they require Administrator privileges. + +Remember that in order to force `ln` to use native NTFS symlinks, your `CYGWIN` +environment variable **must** include either `winsymlinks:native` or +`winsymlinks:nativestrict`. + License ------- diff --git a/links-chmod b/links-chmod index c0cf71e..889a316 100755 --- a/links-chmod +++ b/links-chmod @@ -13,7 +13,7 @@ shopt -s lastpipe script_name="$( basename -- "${BASH_SOURCE[0]}" )" readonly script_name -script_path="$( realpath --canonicalize-existing -- "${BASH_SOURCE[0]}" )" +script_path="$( readlink --canonicalize-existing -- "${BASH_SOURCE[0]}" )" readonly script_path script_dir="$( dirname -- "$script_path" )" readonly script_dir diff --git a/links-remove b/links-remove index 2efc46d..15a33ef 100755 --- a/links-remove +++ b/links-remove @@ -13,7 +13,7 @@ shopt -s lastpipe script_name="$( basename -- "${BASH_SOURCE[0]}" )" readonly script_name -script_path="$( realpath --canonicalize-existing -- "${BASH_SOURCE[0]}" )" +script_path="$( readlink --canonicalize-existing -- "${BASH_SOURCE[0]}" )" readonly script_path script_dir="$( dirname -- "$script_path" )" readonly script_dir diff --git a/links-update b/links-update index 322cd49..c95530d 100755 --- a/links-update +++ b/links-update @@ -5,18 +5,6 @@ # For details, see https://github.com/egor-tensin/config-links. # Distributed under the MIT License. -# This script relies on the availability of native symlinks. -# Those are indeed supported by NTFS, but require Administrator privileges for -# creation. -# It likely won't bother you as long as you don't use the functions defined in -# this file. -# In any case, you will see `ln` complaining about some access being denied in -# case something goes wrong. -# -# Remember that in order to force `ln` to use native NTFS symlinks, your -# `CYGWIN` Windows environment variable value **must** include either -# `winsymlinks:native` or `winsymlinks:nativestrict`! - # usage: ./links-update [-h|--help] [-d|--database PATH] [-s|--shared-dir DIR] [-m|--mode MODE] [-n|--dry-run] set -o errexit -o nounset -o pipefail @@ -25,7 +13,7 @@ shopt -s lastpipe script_name="$( basename -- "${BASH_SOURCE[0]}" )" readonly script_name -script_path="$( realpath --canonicalize-existing -- "${BASH_SOURCE[0]}" )" +script_path="$( readlink --canonicalize-existing -- "${BASH_SOURCE[0]}" )" readonly script_path script_dir="$( dirname -- "$script_path" )" readonly script_dir diff --git a/test/docker-compose.yml b/test/docker-compose.yml deleted file mode 100644 index 76546c4..0000000 --- a/test/docker-compose.yml +++ /dev/null @@ -1,13 +0,0 @@ -version: '3' -services: - test: - build: - context: docker/ - args: - DISTRO: "${DISTRO:-xenial}" - volumes: - - ../:/src - command: - - sh - - -c - - /src/test/unit/test.sh && /src/test/integration/test.sh diff --git a/test/docker/Dockerfile b/test/docker/Dockerfile index 5d4d016..04e66da 100644 --- a/test/docker/Dockerfile +++ b/test/docker/Dockerfile @@ -4,6 +4,12 @@ FROM ubuntu:$DISTRO RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive \ - apt-get install -y --no-install-recommends ca-certificates git + apt-get install -y --no-install-recommends ca-certificates git make RUN git config --global --add safe.directory /src + +COPY [".", "/src"] + +WORKDIR /src + +CMD ["make", "test/local", "test/linux-home"] diff --git a/test/docker/docker-compose.yml b/test/docker/docker-compose.yml new file mode 100644 index 0000000..0689ad3 --- /dev/null +++ b/test/docker/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3' +services: + test: + build: + context: ../.. + dockerfile: test/docker/Dockerfile + args: + DISTRO: "${DISTRO:-xenial}" + environment: + CI: y diff --git a/test/integration/test.sh b/test/linux-home/test.sh index f4b1028..edb2d5b 100755 --- a/test/integration/test.sh +++ b/test/linux-home/test.sh @@ -83,8 +83,12 @@ show_env() { } main() { - show_env + if [ -z "${CI:+x}" ]; then + echo "$script_name: please don't run it outside of CI runs" >&2 + exit 1 + fi + show_env test_my_dotfiles_work } diff --git a/test/unit/dest/1.txt b/test/local/dirs/dest/1.txt index 3a2e3f4..3a2e3f4 100644 --- a/test/unit/dest/1.txt +++ b/test/local/dirs/dest/1.txt diff --git a/test/unit/dest/bar/3.txt b/test/local/dirs/dest/bar/3.txt index a83d1d5..a83d1d5 100644 --- a/test/unit/dest/bar/3.txt +++ b/test/local/dirs/dest/bar/3.txt diff --git a/test/unit/src/%DEST%/1.txt b/test/local/dirs/src/%DEST%/1.txt index d00491f..d00491f 100644 --- a/test/unit/src/%DEST%/1.txt +++ b/test/local/dirs/src/%DEST%/1.txt diff --git a/test/unit/src/%DEST%/bar/3.txt b/test/local/dirs/src/%DEST%/bar/3.txt index 00750ed..00750ed 100644 --- a/test/unit/src/%DEST%/bar/3.txt +++ b/test/local/dirs/src/%DEST%/bar/3.txt diff --git a/test/unit/src/%DEST%/bar/baz/4.txt b/test/local/dirs/src/%DEST%/bar/baz/4.txt index b8626c4..b8626c4 100644 --- a/test/unit/src/%DEST%/bar/baz/4.txt +++ b/test/local/dirs/src/%DEST%/bar/baz/4.txt diff --git a/test/unit/src/%DEST%/foo/2.txt b/test/local/dirs/src/%DEST%/foo/2.txt index 0cfbf08..0cfbf08 100644 --- a/test/unit/src/%DEST%/foo/2.txt +++ b/test/local/dirs/src/%DEST%/foo/2.txt diff --git a/test/unit/test.sh b/test/local/test.sh index f693aa1..99b426f 100755 --- a/test/unit/test.sh +++ b/test/local/test.sh @@ -17,9 +17,9 @@ readonly src_dir_name='src' readonly dest_dir_name='dest' readonly alt_dest_dir_name='alt_dest' -src_dir_path="$script_dir/$src_dir_name" +src_dir_path="$script_dir/dirs/$src_dir_name" readonly src_dir_path -dest_dir_path="$script_dir/$dest_dir_name" +dest_dir_path="$script_dir/dirs/$dest_dir_name" readonly dest_dir_path test_root_dir= |