kopia lustrzana https://github.com/jupyterhub/repo2docker
fix up nix-shell-wrapper for .binder feature
rodzic
05273abb38
commit
34ad355de6
|
@ -8,16 +8,25 @@ _term() {
|
|||
|
||||
trap _term SIGTERM
|
||||
|
||||
# if there is a binder/ sub-directory it takes precedence
|
||||
# files outside it are ignored
|
||||
# find binder sub-directory (if present)
|
||||
for dir in "./.binder" "./binder"; do
|
||||
binder_dir="./"
|
||||
for dir in "./binder" "./.binder" ; do
|
||||
if [ -e $dir ]; then
|
||||
binder_dir=$dir
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# if there is a binder/ sub-directory it takes precedence
|
||||
# files outside it are ignored
|
||||
if [ -z $binder_dir ]; then
|
||||
# raise error if both binder and .binder are found
|
||||
if [[ -d "./binder" && -d "./.binder" ]]; then
|
||||
echo "Error: Found both binder and .binder directories."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "binder_dir is: $binder_dir"
|
||||
|
||||
nixpath="$binder_dir/default.nix";
|
||||
if [ -f $binder_dir/start ]; then
|
||||
chmod u+x $binder_dir/start
|
||||
|
@ -32,15 +41,6 @@ if [ -z $binder_dir ]; then
|
|||
else
|
||||
nix-shell $nixpath --command "$*" &
|
||||
fi
|
||||
else
|
||||
nixpath="./default.nix";
|
||||
if [ -f ./start ]; then
|
||||
chmod u+x ./start
|
||||
nix-shell $nixpath --command "./start $*" &
|
||||
else
|
||||
nix-shell $nixpath --command "$*" &
|
||||
fi
|
||||
fi
|
||||
|
||||
PID=$!
|
||||
wait "$PID"
|
||||
|
|
Ładowanie…
Reference in New Issue