Use sh, not bash
This commit is contained in:
parent
47409db7db
commit
c47daad439
@ -16,16 +16,16 @@ ADD . /ligo
|
||||
# the upcoming scripts
|
||||
WORKDIR /ligo
|
||||
|
||||
# Setup a custom opam repository where ligo is published
|
||||
RUN bash scripts/setup_ligo_opam_repository.sh
|
||||
|
||||
# Install required native dependencies
|
||||
RUN bash scripts/install_native_dependencies.sh
|
||||
RUN sh scripts/install_native_dependencies.sh
|
||||
|
||||
# Setup a custom opam repository where ligo is published
|
||||
RUN sh scripts/setup_ligo_opam_repository.sh
|
||||
|
||||
RUN opam update
|
||||
|
||||
# Install ligo
|
||||
RUN bash scripts/install_ligo_with_dependencies.sh
|
||||
RUN sh scripts/install_ligo_with_dependencies.sh
|
||||
|
||||
# Use the ligo binary as a default command
|
||||
ENTRYPOINT [ "/home/opam/.opam/4.06/bin/ligo" ]
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
set -euET -o pipefail
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
docker build -t ligolang/ligo -f docker/Dockerfile .
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -euET -o pipefail
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
cd src && opam install . --yes
|
||||
cd src
|
||||
opam install . --yes
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -euET -o pipefail
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# TODO: this has many different modes of failure (file temp.opam-2.0.1-x86_64-linux.download-in-progress already exists, /usr/local/bin/opam already exists and is a directory or hard link, …)
|
||||
# Try to improve these aspects.
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -euET -o pipefail
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# You can run this installer like this:
|
||||
# curl https://gitlab.com/ligolang/ligo/blob/master/scripts/installer.sh | bash
|
||||
@ -68,7 +68,7 @@ else
|
||||
&& (umask 0600 > /dev/null 2>&1; UMASK=0600 touch /usr/local/bin/.temp.ligo.before-atomic-move) \
|
||||
&& chmod 0600 /usr/local/bin/.temp.ligo.before-atomic-move \
|
||||
&& cat > /usr/local/bin/.temp.ligo.before-atomic-move \
|
||||
) || rm /usr/local/bin/.temp.ligo.before-atomic-move'
|
||||
) || (rm /usr/local/bin/.temp.ligo.before-atomic-move; exit 1)'
|
||||
|
||||
# sudo become root (sudo) for the rest of the commands
|
||||
# ( subshell (to clean up temporary file if anything goes wrong)
|
||||
@ -88,7 +88,7 @@ else
|
||||
&& if test -d /usr/local/bin/ligo; then printf "/usr/local/bin/ligo already exists and is a directory, cancelling installation"'\\\\'n; rm /usr/local/bin/.temp.ligo.before-atomic-move; \
|
||||
elif test -L /usr/local/bin/ligo; then printf "/usr/local/bin/ligo already exists and is a symbolic link, cancelling installation"'\\\\'n; rm /usr/local/bin/.temp.ligo.before-atomic-move; \
|
||||
else mv -i /usr/local/bin/.temp.ligo.before-atomic-move /usr/local/bin/ligo; fi \
|
||||
) || rm /usr/local/bin/.temp.ligo.before-atomic-move'
|
||||
) || (rm /usr/local/bin/.temp.ligo.before-atomic-move; exit 1)'
|
||||
|
||||
# Installation finished, try running 'ligo' from your CLI
|
||||
printf \\n'Installation successful, try to run '\''ligo --help'\'' now.'\\n
|
||||
|
@ -1,6 +1,9 @@
|
||||
#!/bin/bash
|
||||
if true; then
|
||||
set -euET -o pipefail
|
||||
#!/bin/sh
|
||||
set -e
|
||||
if [ test "x$PWD" = "x" ]; then
|
||||
echo "Cannot detect the current directory, the environment variable PWD is empty."
|
||||
exit 1
|
||||
else
|
||||
docker run -it -v "$PWD":"$PWD" -w "$PWD" ligolang/ligo:latest "$@"
|
||||
fi
|
||||
# Do not remove the next line. It is used as an approximate witness that the download of this file was complete. This string should not appear anywhere else in the file.
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -euET -o pipefail
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
vendors/opam-repository-tools/rewrite-local-opam-repository.sh
|
||||
opam repo add ligo-opam-repository ./vendors/ligo-opam-repository-local-generated
|
||||
|
@ -1,13 +1,55 @@
|
||||
#!/bin/bash
|
||||
set -euET -o pipefail
|
||||
main(){
|
||||
root_dir="$(pwd | sed -e 's/\\/\\\\/' | sed -e 's/&/\\\&/' | sed -e 's/~/\\~/')"
|
||||
#!/bin/sh
|
||||
|
||||
# Stop on error.
|
||||
set -e
|
||||
|
||||
# Defensive checks. We're going to remove an entire folder so this script is somewhat dangerous. Better check in advance what can go wrong in the entire execution of the script.
|
||||
if test -e index.tar.gz && test -e packages && test -e repo && test -e urls.txt; then
|
||||
if test -d vendors/; then
|
||||
if test -d "$PWD"; then
|
||||
if command -v sed >/dev/null 2>&1 \
|
||||
&& command -v rm >/dev/null 2>&1 \
|
||||
&& command -v mkdir >/dev/null 2>&1 \
|
||||
&& command -v cp >/dev/null 2>&1 \
|
||||
&& command -v find >/dev/null 2>&1 \
|
||||
&& command -v xargs >/dev/null 2>&1 \
|
||||
&& command -v opam >/dev/null 2>&1; then
|
||||
|
||||
# Escape the current directory, to be used as the replacement part of the sed regular expression
|
||||
escaped_project_root="$(printf %s "$PWD" | sed -e 's/\\/\\\\/' | sed -e 's/&/\\\&/' | sed -e 's/~/\\~/')"
|
||||
|
||||
# Recreate vendors/ligo-opam-repository-local-generated which contains a copy of the files related to the opam repository
|
||||
rm -fr vendors/ligo-opam-repository-local-generated
|
||||
mkdir vendors/ligo-opam-repository-local-generated
|
||||
cp -a index.tar.gz packages repo urls.txt vendors/ligo-opam-repository-local-generated
|
||||
cp -pR index.tar.gz packages repo urls.txt vendors/ligo-opam-repository-local-generated
|
||||
|
||||
# Rewrite the URLs in the opam repository to point to the project root
|
||||
(
|
||||
cd vendors/ligo-opam-repository-local-generated
|
||||
grep -r --null -l src: | grep -z 'opam$' | xargs -0 \
|
||||
sed -i -e 's~src: *"https://gitlab.com/ligolang/ligo/-/archive/master/ligo\.tar\.gz"~src: "file://'"$root_dir"'"~'
|
||||
# TODO: run the update.sh script adequately to regenerate the index.tar.gz etc. in the local repo
|
||||
}
|
||||
if main; then exit 0; else exit $?; fi
|
||||
find . -type f -name opam -print0 | | xargs -0 sed -i -e 's~src: *"https://gitlab.com/ligolang/ligo/-/archive/master/ligo\.tar\.gz"~src: "file://'"$escaped_project_root"'"~'
|
||||
)
|
||||
|
||||
# Regenerate the index.tar.gz etc. in the local repo
|
||||
(
|
||||
cd vendors/ligo-opam-repository-local-generated
|
||||
opam admin index
|
||||
opam admin cache
|
||||
)
|
||||
else
|
||||
echo "One of the following commands is unavailable: sed rm mkdir cp find xargs opam."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Unable to access the current directory as indicated by PWD. Was the CWD of the current shell removed?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
echo "Cannot find the directory vendors/ in the current directory"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Cannot find some of the following files in the current directory"
|
||||
echo "index.tar.gz packages repo urls.txt"
|
||||
exit 1
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user