mirror of
https://github.com/89luca89/distrobox.git
synced 2025-02-25 18:55:25 -06:00
assemble: fix declaration of multiple hooks, fix support for pipes. Fix #853
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
This commit is contained in:
@@ -255,36 +255,48 @@ run_distrobox() (
|
||||
result_command="${result_command} --home $(sanitize_variable "${home}")"
|
||||
fi
|
||||
if [ -n "${init_hooks}" ]; then
|
||||
IFS="|"
|
||||
IFS="¤"
|
||||
args=":"
|
||||
for arg in ${init_hooks}; do
|
||||
args="${args} && ${arg}"
|
||||
if ! echo "${arg}" | grep -q ';$' &&
|
||||
! echo "${arg}" | grep -q "&&$"; then
|
||||
args="${args} && ${arg}"
|
||||
else
|
||||
args="${args} ${arg}"
|
||||
fi
|
||||
done
|
||||
result_command="${result_command} --init-hooks $(sanitize_variable "${args}")"
|
||||
fi
|
||||
# Replicable flags
|
||||
if [ -n "${pre_init_hooks}" ]; then
|
||||
IFS="|"
|
||||
IFS="¤"
|
||||
args=":"
|
||||
for arg in ${pre_init_hooks}; do
|
||||
args="${args} && ${arg}"
|
||||
if ! echo "${arg}" | grep -q ';$' &&
|
||||
! echo "${arg}" | grep -q "&&$"; then
|
||||
args="${args} && ${arg}"
|
||||
else
|
||||
args="${args} ${arg}"
|
||||
fi
|
||||
done
|
||||
result_command="${result_command} --pre-init-hooks $(sanitize_variable "${args}")"
|
||||
fi
|
||||
if [ -n "${additional_packages}" ]; then
|
||||
IFS="|"
|
||||
IFS="¤"
|
||||
args=""
|
||||
for packages in ${additional_packages}; do
|
||||
result_command="${result_command} --additional-packages $(sanitize_variable "${packages}")"
|
||||
args="${args} ${packages}"
|
||||
done
|
||||
result_command="${result_command} --additional-packages $(sanitize_variable "${args}")"
|
||||
fi
|
||||
if [ -n "${volume}" ]; then
|
||||
IFS="|"
|
||||
IFS=" "
|
||||
for vol in ${volume}; do
|
||||
result_command="${result_command} --volume $(sanitize_variable "${vol}")"
|
||||
done
|
||||
fi
|
||||
if [ -n "${additional_flags}" ]; then
|
||||
IFS="|"
|
||||
IFS="¤"
|
||||
for flag in ${additional_flags}; do
|
||||
result_command="${result_command} --additional-flags $(sanitize_variable "${flag}")"
|
||||
done
|
||||
@@ -371,8 +383,8 @@ parse_file() (
|
||||
# Save options to tempfile, to source it later
|
||||
touch "${tmpfile}"
|
||||
if [ -n "${key}" ] && [ -n "${value}" ]; then
|
||||
if grep -q "${key}" "${tmpfile}"; then
|
||||
value="$(echo "${value}" | sed "s|\"|\" \${${key}} |")"
|
||||
if grep -q "${key}=" "${tmpfile}"; then
|
||||
value="$(echo "${value}" | sed "s|\"|\" \${${key}}¤|")"
|
||||
fi
|
||||
echo "${key}=${value}" >> "${tmpfile}"
|
||||
fi
|
||||
|
||||
@@ -1256,7 +1256,7 @@ if [ "${nvidia}" -eq 1 ]; then
|
||||
# In the guest we need to adjust the destination path, so if we're on
|
||||
# debian based containers, we need to target /usr/lib/x86_64-linux-gnu/
|
||||
if [ -e "/usr/lib/x86_64-linux-gnu/" ]; then
|
||||
if [ "${type}" == "link" ]; then
|
||||
if [ "${type}" = "link" ]; then
|
||||
cp -d "${nvidia_lib}" "/usr/lib/x86_64-linux-gnu/${dest_file}"
|
||||
continue
|
||||
fi
|
||||
@@ -1264,7 +1264,7 @@ if [ "${nvidia}" -eq 1 ]; then
|
||||
mount_bind "${nvidia_lib}" "/usr/lib/x86_64-linux-gnu/${dest_file}" ro
|
||||
# /usr/lib64 is common in rpm based distros
|
||||
elif [ -e "/usr/lib64" ]; then
|
||||
if [ "${type}" == "link" ]; then
|
||||
if [ "${type}" = "link" ]; then
|
||||
cp -d "${nvidia_lib}" "/usr/lib64/${dest_file}"
|
||||
continue
|
||||
fi
|
||||
@@ -1272,7 +1272,7 @@ if [ "${nvidia}" -eq 1 ]; then
|
||||
mount_bind "${nvidia_lib}" "/usr/lib64/${dest_file}" ro
|
||||
# fallback to /usr/lib if none of the previous
|
||||
else
|
||||
if [ "${type}" == "link" ]; then
|
||||
if [ "${type}" = "link" ]; then
|
||||
cp -d "${nvidia_lib}" "/usr/lib/${dest_file}"
|
||||
continue
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user