99
1010script=$( readlink -f " $0 " )
1111
12+ CONDA_SKIP_ADJUST_PATHS=${CONDA_SKIP_ADJUST_PATHS:- " 1" }
1213ARCH=" ${ARCH:- " $( uname -m) " } "
1314
1415show_usage () {
@@ -23,6 +24,7 @@ show_usage() {
2324 echo " PIP_REQUIREMENTS=\" packageA packageB -r requirements.txt -e git+https://...\" "
2425 echo " PIP_PREFIX=\" AppDir/usr/share/conda\" "
2526 echo " ARCH=\" $ARCH \" (supported values: x86_64, i368, i686)"
27+ echo " CONDA_SKIP_ADJUST_PATHS=\" 1\" (default: skip)"
2628 echo " CONDA_SKIP_CLEANUP=\" [all;][conda-pkgs;][__pycache__;][strip;][.a;][cmake;][doc;][man;][site-packages;]\" "
2729}
2830
@@ -187,6 +189,41 @@ for i in usr/conda/bin/*; do
187189done
188190popd
189191
192+ # adjust absolute paths, by default skipped via $CONDA_SKIP_ADJUST_PATHS
193+ if [ " $CONDA_SKIP_ADJUST_PATHS " != " 1" ]; then
194+ # disable history substitution, b/c we use ! in quoted strings
195+ set +H
196+ APPDIR_FULL=" $( pwd) /$APPDIR "
197+ # replace absolute paths in some scripts
198+ sed -i " s|'$APPDIR_FULL |\"\$ {APPDIR}\" '|g" " $APPDIR " /usr/conda/etc/profile.d/conda.sh
199+ sed -i " s|$APPDIR_FULL |\$ {APPDIR}|g" " $APPDIR " /usr/conda/etc/profile.d/conda.csh
200+ sed -i " s|$APPDIR_FULL |\$ APPDIR|g" " $APPDIR " /usr/conda/etc/fish/conf.d/conda.fish
201+ sed -i " s|^#!$APPDIR_FULL /usr/conda/bin/|#!/usr/bin/env |" " $APPDIR " /usr/conda/condabin/conda
202+ sed -i " s|$APPDIR_FULL |\$ {APPDIR}|g" " $APPDIR " /usr/bin/python3-config
203+ sed -i " s|$APPDIR_FULL |\$ {APPDIR}|g" " $APPDIR " /usr/bin/python3.8-config
204+ sed -i " s|$APPDIR_FULL |\$ {APPDIR}|g" " $APPDIR " /usr/bin/ncursesw6-config
205+ # perl
206+ sed -i " s|^#!$APPDIR_FULL /usr/conda/bin/|#!/usr/bin/env |" " $APPDIR " /usr/bin/c_rehash
207+ sed -i " s|= \" $APPDIR_FULL |= \$ ENV{APPDIR} . \" |g" " $APPDIR " /usr/bin/c_rehash
208+ pushd " $APPDIR "
209+ for i in usr/conda/bin/* ; do
210+ sed -i " s|^#!$APPDIR_FULL /usr/conda/bin/|#!/usr/bin/env |" " $i "
211+ sed -i " s|=\" $APPDIR_FULL |=\"\$ {APPDIR}|g" " $i "
212+ done
213+ popd
214+
215+ # generate linuxdeploy-plugin-conda-hook
216+ mkdir -p " $APPDIR " /apprun-hooks
217+ cat > " $APPDIR " /apprun-hooks/linuxdeploy-plugin-conda-hook.sh << \EOF
218+ # generated by linuxdeploy-plugin-conda
219+
220+ # export APPDIR variable to allow for running from extracted AppDir as well
221+ export APPDIR=${APPDIR:- $(readlink -f $(dirname " $0 " ))}
222+ # export PATH to allow /usr/bin/env shebangs to use the supplied applications
223+ export PATH="$APPDIR "/usr/bin:"$PATH "
224+ EOF
225+
226+ fi
190227
191228# remove bloat, optionally skipped via $CONDA_SKIP_CLEANUP
192229IFS=' ;' read -ra cleanup <<< " $CONDA_SKIP_CLEANUP"
0 commit comments