Remove dependency on bash (#839)

* Remove dependency on bash

Bash is not always the default shell, and `source` only works in Bash. With Ubuntu 23 and 24 for example, the default shell is now Dash. Using `.` ensures wide compatibility.

* Apply suggestions from code review

* Apply suggestions from code review

---------

Co-authored-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
This commit is contained in:
Kevin Reeuwijk 2024-05-02 14:54:48 +02:00 committed by GitHub
parent 718aaa27e4
commit 2b6a96b28f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 6 deletions

View File

@ -37,7 +37,7 @@ set -e
SCRIPT_DIR="$(dirname $(readlink -f "${0}"))" SCRIPT_DIR="$(dirname $(readlink -f "${0}"))"
SCRIPT_NAME="$(basename "${0}")" SCRIPT_NAME="$(basename "${0}")"
source "${SCRIPT_DIR}/nvcommon_build.sh" . "${SCRIPT_DIR}/nvcommon_build.sh"
function usage { function usage {
cat <<EOM cat <<EOM

View File

@ -96,8 +96,8 @@ stages:
name: "add custom bind and ephemeral mounts to /run/cos/cos-layout.env" name: "add custom bind and ephemeral mounts to /run/cos/cos-layout.env"
commands: commands:
- | - |
source /run/cos/cos-layout.env . /run/cos/cos-layout.env
source /run/cos/custom-layout.env . /run/cos/custom-layout.env
PERSISTENT_STATE_PATHS="${PERSISTENT_STATE_PATHS} ${CUSTOM_BIND_MOUNTS} " PERSISTENT_STATE_PATHS="${PERSISTENT_STATE_PATHS} ${CUSTOM_BIND_MOUNTS} "
RW_PATHS="${RW_PATHS} ${CUSTOM_EPHEMERAL_MOUNTS}" RW_PATHS="${RW_PATHS} ${CUSTOM_EPHEMERAL_MOUNTS}"
# Remove the existing lines that we are gonna rewrite # Remove the existing lines that we are gonna rewrite

View File

@ -54,7 +54,7 @@ stages:
pidfile="/run/cos-setup-reconcile.pid" pidfile="/run/cos-setup-reconcile.pid"
respawn_delay=360 respawn_delay=360
set -o allexport set -o allexport
if [ -f /etc/environment ]; then source /etc/environment; fi if [ -f /etc/environment ]; then . /etc/environment; fi
set +o allexport set +o allexport
- path: /etc/init.d/kairos-agent - path: /etc/init.d/kairos-agent
content: | content: |
@ -94,7 +94,7 @@ stages:
pidfile="/run/${RC_SVCNAME}.pid" pidfile="/run/${RC_SVCNAME}.pid"
respawn_delay=5 respawn_delay=5
set -o allexport set -o allexport
if [ -f /etc/environment ]; then source /etc/environment; fi if [ -f /etc/environment ]; then . /etc/environment; fi
set +o allexport set +o allexport
permissions: 0755 permissions: 0755
owner: 0 owner: 0

View File

@ -21,7 +21,7 @@ stages:
hostname: "cos-recovery" hostname: "cos-recovery"
commands: commands:
- | - |
source /etc/os-release . /etc/os-release
echo >> /etc/issue echo >> /etc/issue
echo "You are booting from recovery mode. Run 'kairos-agent reset' to reset the system to $VERSION" >> /etc/issue echo "You are booting from recovery mode. Run 'kairos-agent reset' to reset the system to $VERSION" >> /etc/issue
echo " or 'kairos-agent upgrade' to upgrade the active partition" >> /etc/issue echo " or 'kairos-agent upgrade' to upgrade the active partition" >> /etc/issue