From aaee9e0244f953e8076037c32ed31207dd378f5d Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Tue, 23 Jan 2018 14:17:19 +0100 Subject: Add a local lib directory This allows people to mount their local directory to /opt/clean/lib/Local and import the files from it. This can be extended to allow more mounting in /opt/clean/lib and let the clm command import all directories from there but not with this commit. --- Dockerfile | 1 + README.md | 4 +++- compile.c | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7a48307..62e4d1f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,7 @@ RUN ./make_abc.sh \ && apt-get update -qq \ && apt-get install -qq $PACKAGES --no-install-recommends \ && make -B \ + && mkdir -p /opt/clean/lib/Local \ && rm -rf \ Clean\ System\ Files \ CleanReadLine \ diff --git a/README.md b/README.md index 04c1a8f..b30d4f5 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ Use `docker pull camilstaps/iclean` to pull the latest iClean version. Run iClean with `docker run --rm -it camilstaps/iclean`. +If you want to import local files as well you can bindmount your local directory by adding `-v "$PWD":/opt/clean/lib/Local`. + If you want history, add `-v ~/.iclean_history:/home/.iclean_history` and `touch ~/.iclean_history` on the host. You can add imports by creating a template in `~/.iclean_template`, then adding it to the container with `-v ~/.iclean_template:/home/.iclean_template`. @@ -31,7 +33,7 @@ If you care about hard disk wear, add `--tmpfs /tmp:exec,size=1024k` to have iCl Make all this an alias: ``` -alias iclean="docker run --rm -it --tmpfs /tmp:exec,size=1024k -v ~/.iclean_history:/home/.iclean_history -v ~/.iclean_template:/home/.iclean_template camilstaps/iclean" +alias iclean="docker run --rm -it --tmpfs /tmp:exec,size=1024k -v "$PWD":/opt/clean/lib/Local -v ~/.iclean_history:/home/.iclean_history -v ~/.iclean_template:/home/.iclean_template camilstaps/iclean" ``` ## Without Docker diff --git a/compile.c b/compile.c index 7378343..a991dbf 100644 --- a/compile.c +++ b/compile.c @@ -78,6 +78,7 @@ int64_t compile(CleanString path, CleanString module) { "-I $CLEAN_HOME/lib/Platform/Deprecated/ArgEnv " "-I $CLEAN_HOME/lib/Platform/Deprecated/MersenneTwister " "-I $CLEAN_HOME/lib/Platform/Deprecated/StdLib " + "-I $CLEAN_HOME/lib/Local " "-b -nt -h 20M %s -o %s", pathchars, modulechars, modulechars); -- cgit v1.2.3 From 83043ea651aa9e3a57b790758a5a4eb7145b362d Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Tue, 23 Jan 2018 14:24:29 +0100 Subject: Update alias to a function There is no such thing as delayed variable expansion in aliasses so it has to be a function when you always want to mount the local directory. --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b30d4f5..788076b 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,12 @@ You can add imports by creating a template in `~/.iclean_template`, then adding If you care about hard disk wear, add `--tmpfs /tmp:exec,size=1024k` to have iClean build on a ramdisk. -Make all this an alias: +Make all this a handy bash function: ``` -alias iclean="docker run --rm -it --tmpfs /tmp:exec,size=1024k -v "$PWD":/opt/clean/lib/Local -v ~/.iclean_history:/home/.iclean_history -v ~/.iclean_template:/home/.iclean_template camilstaps/iclean" +iclean(){ + docker run --rm -it --tmpfs /tmp:exec,size=1024k -v "$PWD":/opt/clean/lib/Local -v ~/.iclean_history:/home/.iclean_history -v ~/.iclean_template:/home/.iclean_template camilstaps/iclean +} ``` ## Without Docker -- cgit v1.2.3