summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fankhauser (@tux-six)2022-07-06 22:24:30 +0200
committerAndreas Fankhauser (@tux-six)2022-07-06 22:24:30 +0200
commit6d4c51fe445b80f56506df7541c8d4fd2488dbd1 (patch)
tree0ce631914071a559441698d3d7a84e104d7b4395
parent0d745cdb688eab40094c434d2564515705ce686b (diff)
parentb627374773e3256fbd08fb204fcced3233b9c97e (diff)
downloadbulk-ln-6d4c51fe445b80f56506df7541c8d4fd2488dbd1.zip
bulk-ln-6d4c51fe445b80f56506df7541c8d4fd2488dbd1.tar.gz
Merge 'contrib Dockerfile for tarball' to master
-rw-r--r--README.md29
-rw-r--r--README.txt24
-rwxr-xr-xconfigure7
-rw-r--r--contrib/build-using-docker/Dockerfile34
-rw-r--r--contrib/build-using-docker/README.md29
5 files changed, 97 insertions, 26 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..5b7bc29
--- /dev/null
+++ b/README.md
@@ -0,0 +1,29 @@
+
+BulkLn
+================
+
+`ln` alternative in case you think `ln` in a shell loop takes too much time to
+create many links.
+
+
+## How to build / install
+
+Minimal way is to do:
+
+```sh
+ curl -sSL http://git.hiddenalpha.ch/bulk-ln.git/snapshot/bulk-ln-master.tar.gz | tar xz
+ cd bulk-ln-master
+ ./configure
+ make
+ make install
+```
+
+As usual, configure provides some help:
+
+```sh
+ ./configure --help
+```
+
+Its worth browsing the "contrib/" directory. It contains potentially useful
+scripts for building.
+
diff --git a/README.txt b/README.txt
deleted file mode 100644
index 1239604..0000000
--- a/README.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-
-BulkLn
-======
-
-'ln' like tool to handle large amount of links.
-
-Usage: bulk-ln --help
-
-
-How to build / install
-**********************
-
-Use the well-known procedure:
-
- curl -sSL http://git.hiddenalpha.ch/bulk-ln.git/snapshot/bulk-ln-master.tar.gz | tar xz
- cd bulk-ln-master
- ./configure
- make
- make install
-
-You can get some help with:
-
- ./configure --help
-
diff --git a/configure b/configure
index 419e9a8..d2f1fe7 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
set -e
-set -o posix
+if test -n "$BASH_VERSION"; then set -o posix; fi
# See https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
prefix=/usr/local
@@ -70,6 +70,9 @@ printMakefile () {
# If fails (eg git not avail), create pseudo version using date.
printf '%s' 'PROJECT_VERSION=$(shell'
printf '%s' ' ret=$$(git describe --tags 2>/dev/null |sed -E "s;^v;;");'
+ printf '%s' ' if test -n "$$ret" -a -n "$$(git status --porcelain 2>/dev/null)"; then'
+ printf '%s' ' ret="$$ret+dirt";'
+ printf '%s' ' fi;'
printf '%s' ' if test -z "$$ret"; then ret=$$(date -u +0.0.0-%Y%m%d.%H%M%S); fi;'
printf '%s\n' ' echo "$$ret")'
@@ -137,7 +140,7 @@ printMakefile () {
printf '%s\n' ' $(MKDIRS) dist'
# Create Executable bundle.
printf '%s\n' ' $(MKDIRS) build/dist-bin && $(COPYTO) build/dist-bin \'
- printf '%s\n' ' README.txt'
+ printf '%s\n' ' README*'
printf '%s\n' ' $(MKDIRS) build/dist-bin/bin && $(COPYTO) build/dist-bin/bin \'
printf '%s\n' ' build/bin/*'
diff --git a/contrib/build-using-docker/Dockerfile b/contrib/build-using-docker/Dockerfile
new file mode 100644
index 0000000..78f1a85
--- /dev/null
+++ b/contrib/build-using-docker/Dockerfile
@@ -0,0 +1,34 @@
+
+ARG PARENT_IMAGE=alpine:3.16.0
+FROM $PARENT_IMAGE
+
+ARG GIT_TAG=
+ARG CONFIGURE_OPTS=
+ARG PKGS_TO_INSTALL="curl gcc git make musl-dev tar"
+ARG PKGINIT=true
+ARG PKGADD="apk add"
+ARG PKGDEL="apk del"
+ARG PKGCLEAN=true
+
+WORKDIR /work
+
+RUN true \
+ && $PKGINIT \
+ && $PKGADD $PKGS_TO_INSTALL \
+ && git clone https://git.hiddenalpha.ch/bulk-ln.git . \
+ && git config advice.detachedHead false \
+ && if test -n "$GIT_TAG"; then git checkout "$GIT_TAG"; fi \
+ && ./configure $CONFIGURE_OPTS \
+ && make clean && make && make install \
+ && find . -not -wholename './dist*' -delete \
+ && find /work -exec chown 1000:1000 {} + \
+ && $PKGDEL $PKGS_TO_INSTALL \
+ && $PKGCLEAN \
+ && true
+
+USER 1000:1000
+
+# run for max 10 hrs. Because this container is not meant to stay running
+# forever.
+CMD ["sleep 36000"]
+
diff --git a/contrib/build-using-docker/README.md b/contrib/build-using-docker/README.md
new file mode 100644
index 0000000..503136e
--- /dev/null
+++ b/contrib/build-using-docker/README.md
@@ -0,0 +1,29 @@
+
+Showcase how to build and install
+=================================
+
+Make and install inside a dockerimage.
+
+```sh
+ curl -sSL http://git.hiddenalpha.ch/bulk-ln.git/plain/contrib/build-using-docker/Dockerfile | sudo docker build . -f -
+```
+
+Afer that we can use the image hash printed in last line to refer to our built
+image (replace IMG_REF in commands below by that hash). Alternatively we could
+add [`--tag`](https://docs.docker.com/engine/reference/commandline/build/)
+option to our build command to give the resulting image a name.
+
+Most probably we wanna get the distribution archive. We can copy it out the
+dockerimage to our host using:
+
+```sh
+ sudo docker run --rm -i IMG_REF sh -c 'true && cd dist && tar c *' | tar x
+```
+
+Or if we wanna browse the image or play around with the built utility we could
+launch a shell. Once in the shell, try `bulk-ln --help`.
+
+```sh
+ sudo docker run --rm -ti IMG_REF sh
+```
+