aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-05-21 20:40:16 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-05-21 20:40:16 +0200
commitddd150b7d16d289ed0d0ca8dbbcaa335761ad4f2 (patch)
tree7de243930d1359dca8efc32d317441f677f212ac
parentdebian: 2.0.3-5 (diff)
parentmove comments from links-update to README (diff)
downloadconfig-links-ddd150b7d16d289ed0d0ca8dbbcaa335761ad4f2.tar.gz
config-links-ddd150b7d16d289ed0d0ca8dbbcaa335761ad4f2.zip
Merge tag 'v2.0.4' into debian
-rw-r--r--Makefile10
-rw-r--r--README.md10
-rwxr-xr-xlinks-chmod2
-rwxr-xr-xlinks-remove2
-rwxr-xr-xlinks-update14
-rw-r--r--test/docker-compose.yml13
-rw-r--r--test/docker/Dockerfile8
-rw-r--r--test/docker/docker-compose.yml10
-rwxr-xr-xtest/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-xtest/local/test.sh (renamed from test/unit/test.sh)4
16 files changed, 44 insertions, 35 deletions
diff --git a/Makefile b/Makefile
index 054e75b..23de6d3 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/README.md b/README.md
index 9c04c05..df919a6 100644
--- a/README.md
+++ b/README.md
@@ -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=