Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bash script sourcing with symbolic links #686

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions swbundle/add_coastlines.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
# Madison, WI 53706
# [email protected]

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
export POLAR2GRID_HOME="$( cd -P "$( dirname "$SOURCE" )" && cd .. && pwd )"
export POLAR2GRID_HOME="$( cd -P "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && cd .. && pwd )"

# Setup necessary environments
# __SWBUNDLE_ENVIRONMENT_INJECTION__
Expand Down
4 changes: 1 addition & 3 deletions swbundle/add_colormap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
# Madison, WI 53706
# [email protected]

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
export POLAR2GRID_HOME="$( cd -P "$( dirname "$SOURCE" )" && cd .. && pwd )"
export POLAR2GRID_HOME="$( cd -P "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && cd .. && pwd )"

# Setup necessary environments
# __SWBUNDLE_ENVIRONMENT_INJECTION__
Expand Down
4 changes: 1 addition & 3 deletions swbundle/convert_grids_conf_to_yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
# input into another program.
# Documentation: http://www.ssec.wisc.edu/software/polar2grid/

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
export POLAR2GRID_HOME="$( cd -P "$( dirname "$SOURCE" )" && cd .. && pwd )"
export POLAR2GRID_HOME="$( cd -P "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && cd .. && pwd )"

# Setup necessary environments
# __SWBUNDLE_ENVIRONMENT_INJECTION__
Expand Down
4 changes: 1 addition & 3 deletions swbundle/download_pyspectral_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
# Madison, WI 53706
# [email protected]

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
export POLAR2GRID_HOME="$( cd -P "$( dirname "$SOURCE" )" && cd .. && pwd )"
export POLAR2GRID_HOME="$( cd -P "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && cd .. && pwd )"

# Setup necessary environments
# __SWBUNDLE_ENVIRONMENT_INJECTION__
Expand Down
11 changes: 1 addition & 10 deletions swbundle/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,7 @@
# [email protected]

# where are we?
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
NEWSRC="$(readlink "$SOURCE")"
if [ ! -e "$NEWSRC" ]; then
# probably a relative link
NEWSRC="$(cd $(dirname "$SOURCE"); pwd)/$NEWSRC"
fi
SOURCE=$NEWSRC
done
THIS_SCRIPT_HOME="$( cd -P "$( dirname "$SOURCE" )" && cd .. && pwd )"
THIS_SCRIPT_HOME="$( cd -P "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && cd .. && pwd )"
P2G_CONDA_BASE="${THIS_SCRIPT_HOME}/libexec/python_runtime"
P2G_METADATA="${P2G_CONDA_BASE}/lib/python*/site-packages/polar2grid-*.dist-info/METADATA"
METADATA_CHECKSUM=$(${P2G_CONDA_BASE}/bin/openssl sha256 $P2G_METADATA)
Expand Down
4 changes: 1 addition & 3 deletions swbundle/geo2grid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
# Madison, WI 53706
# [email protected]

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
export POLAR2GRID_HOME="$( cd -P "$( dirname "$SOURCE" )" && cd .. && pwd )"
export POLAR2GRID_HOME="$( cd -P "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && cd .. && pwd )"

# Setup necessary environments
# __SWBUNDLE_ENVIRONMENT_INJECTION__
Expand Down
4 changes: 1 addition & 3 deletions swbundle/gtiff2kmz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
# Madison, WI 53706
# [email protected]

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
export POLAR2GRID_HOME="$( cd -P "$( dirname "$SOURCE" )" && cd .. && pwd )"
export POLAR2GRID_HOME="$( cd -P "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && cd .. && pwd )"

# Setup necessary environments
# __SWBUNDLE_ENVIRONMENT_INJECTION__
Expand Down
4 changes: 1 addition & 3 deletions swbundle/gtiff2mp4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
# Madison, WI 53706
# [email protected]

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
export POLAR2GRID_HOME="$( cd -P "$( dirname "$SOURCE" )" && cd .. && pwd )"
export POLAR2GRID_HOME="$( cd -P "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && cd .. && pwd )"

# Setup necessary environments
# __SWBUNDLE_ENVIRONMENT_INJECTION__
Expand Down
39 changes: 0 additions & 39 deletions swbundle/hdf5_backend.sh

This file was deleted.

4 changes: 1 addition & 3 deletions swbundle/overlay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
# Madison, WI 53706
# [email protected]

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
export POLAR2GRID_HOME="$( cd -P "$( dirname "$SOURCE" )" && cd .. && pwd )"
export POLAR2GRID_HOME="$( cd -P "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && cd .. && pwd )"

# Setup necessary environments
# __SWBUNDLE_ENVIRONMENT_INJECTION__
Expand Down
4 changes: 1 addition & 3 deletions swbundle/p2g_compare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
# input into another program.
# Documentation: http://www.ssec.wisc.edu/software/polar2grid/

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
export POLAR2GRID_HOME="$( cd -P "$( dirname "$SOURCE" )" && cd .. && pwd )"
export POLAR2GRID_HOME="$( cd -P "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && cd .. && pwd )"

# Setup necessary environments
# __SWBUNDLE_ENVIRONMENT_INJECTION__
Expand Down
2 changes: 1 addition & 1 deletion swbundle/p2g_grid_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# [email protected]

if [ -z "$POLAR2GRID_HOME" ]; then
export POLAR2GRID_HOME="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
export POLAR2GRID_HOME="$( cd -P "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && cd .. && pwd )"
fi

# Setup necessary environments
Expand Down
4 changes: 1 addition & 3 deletions swbundle/polar2grid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
# Madison, WI 53706
# [email protected]

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
export POLAR2GRID_HOME="$( cd -P "$( dirname "$SOURCE" )" && cd .. && pwd )"
export POLAR2GRID_HOME="$( cd -P "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && cd .. && pwd )"

# Setup necessary environments
# __SWBUNDLE_ENVIRONMENT_INJECTION__
Expand Down
4 changes: 1 addition & 3 deletions swbundle/reproject_goes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
# Madison, WI 53706
# [email protected]

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
export POLAR2GRID_HOME="$( cd -P "$( dirname "$SOURCE" )" && cd .. && pwd )"
export POLAR2GRID_HOME="$( cd -P "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && cd .. && pwd )"

# Setup necessary environments
# __SWBUNDLE_ENVIRONMENT_INJECTION__
Expand Down