Skip to content

Commit

Permalink
✨ working on compat with bash 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jcaillon committed Jan 11, 2025
1 parent 605d731 commit 9ea340d
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion commands.d/self-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ function selfUpdate_createShim() {
local valetBin="${binDirectory}/valet"

log::info "Creating a shim ⌜${valetBin}⌝ → ⌜${GLOBAL_VALET_HOME}/valet⌝."
${_SUDO} bash -c "printf '#%s\n%s \"\$@\"' \"!/usr/bin/env bash\" \"'${GLOBAL_VALET_HOME}/valet'\" 1> \"${valetBin}\""
${_SUDO} bash -c "printf '#%s\nsource %s \"\$@\"' \"!/usr/bin/env bash\" \"'${GLOBAL_VALET_HOME}/valet'\" 1> \"${valetBin}\""
${_SUDO} chmod +x "${valetBin}"
}

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/800.roadmap/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ url: /docs/roadmap

This page lists the features that I would like to implement in Valet. They come in addition to new features described in the [issues][valet-issues].

- Refactor the logging functions to be more readable, see if we really need to precalculate them or if we can just compute on the fly.
- Refactor the logging functions to be more readable, see if we really need to precalculate them or if we can just compute on the fly. Remove createPrintFunction on SIGWINCH.
- Finish prompt and interactive functions: prompt user for multiline text. Prompt user for multi select.
- core::checkParseResults typo...
- Add a full screen view with the keyboard shortcuts in edit mode (new interactive::showFullScreenHelp ?).
Expand Down
5 changes: 4 additions & 1 deletion libraries.d/core
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ set -o pipefail -o braceexpand -o errexit -o errtrace -o functrace -o nounset -o
# +dotglob: disable inclusion of hidden files in filename expansion
# +expand_aliases: disable alias expansion
# +nocasematch: disable case-insensitive matching
shopt -s extquote globasciiranges globskipdots huponexit interactive_comments patsub_replacement progcomp
shopt -s extquote globasciiranges huponexit interactive_comments progcomp
shopt -u assoc_expand_once cdable_vars checkhash checkjobs checkwinsize compat31 compat32 compat40 compat41 compat42 compat43 compat44 globstar localvar_inherit localvar_unset nocaseglob nocasematch noexpand_translation progcomp_alias shift_verbose varredir_close xpg_echo nullglob direxpand dirspell dotglob extglob failglob execfail expand_aliases inherit_errexit
if (( ${BASH_VERSINFO[1]} >= 2)); then
shopt -s globskipdots patsub_replacement
fi

# we check for this variable to know if this script has already been included
GLOBAL_CORE_INCLUDED=1
Expand Down
1 change: 1 addition & 0 deletions libraries.d/lib-prompt
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,7 @@ function prompt_filterItems() {
rm -f "${_PROMPT_ITEMS_BOX_ASYNC_FILTERED_ITEMS_FILE}" &>/dev/null || :
prompt_filterItemsAsync 1>&2 &
GLOBAL_BACKGROUND_JOB1_PID="$!"

fi
}

Expand Down
16 changes: 14 additions & 2 deletions tests.d/1106-self-install/docker-valet-test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,23 @@ ARG LOCALE=en_US
ENV LANG=${LOCALE}.UTF-8
RUN \
apt-get update -qq; \
apt-get install -qq -y curl sudo makepasswd uidmap git xonsh fish zsh csh tcsh ksh 1>/dev/null; \
apt-get install -qq -y curl sudo makepasswd uidmap git xonsh fish zsh csh tcsh ksh build-essential wget 1>/dev/null; \
echo 'me' > /tmp/pw; \
useradd -m -u 1000 -U -p "$(makepasswd --crypt-md5 --clearfrom=/tmp/pw)" me; \
echo "me ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/me-sudo; \
chsh -s /bin/bash me; \
curl -fsSL https://github.com/nushell/nushell/releases/download/0.100.0/nu-0.100.0-x86_64-unknown-linux-gnu.tar.gz -o nu.tar.gz; \
tar -xvf nu.tar.gz; \
mv nu-0.100.0-x86_64-unknown-linux-gnu/nu /usr/local/bin/nu;
mv nu-0.100.0-x86_64-unknown-linux-gnu/nu /usr/local/bin/nu;

# now install bash 5.0
SHELL ["/bin/sh", "-o", "errexit", "-o", "nounset", "-x", "-c"]

RUN \
cd /tmp; \
wget http://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz; \
tar xf bash-5.0.tar.gz; \
cd bash-5.0; \
./configure; \
make; \
sudo make install;
2 changes: 1 addition & 1 deletion tests.d/1106-self-install/test
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function main() {
# To build the image:
# - cd tests.d/1106-self-install/docker-valet-test
# - docker build -t valet-test .
docker run --rm -it -v .:/app -w /app -e RUNNING_IN_DOCKER=true --entrypoint /bin/bash valet-test -c -o errexit -o nounset -o pipefail "chmod +x ./tests.d/1106-self-install/test; ./tests.d/1106-self-install/test"
docker run --rm -it -v .:/app -w /app -e RUNNING_IN_DOCKER=true --entrypoint /usr/local/bin/bash valet-test -c -o errexit -o nounset -o pipefail "chmod +x ./tests.d/1106-self-install/test; ./tests.d/1106-self-install/test"
return 0
fi
echo "Need docker to run this test."
Expand Down

0 comments on commit 9ea340d

Please sign in to comment.