better talos and nixos support with wrapper scripts
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
parent
b13184b02a
commit
de242c2d7f
|
|
@ -1,14 +1,30 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
: "${ISCSIADM_HOST_STRATEGY:=chroot}"
|
||||
: "${ISCSIADM_HOST_PATH:=iscsiadm}"
|
||||
|
||||
echoerr() { printf "%s\n" "$*" >&2; }
|
||||
|
||||
P="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin"
|
||||
|
||||
case ${ISCSIADM_HOST_STRATEGY} in
|
||||
chroot)
|
||||
# https://engineering.docker.com/2019/07/road-to-containing-iscsi/
|
||||
chroot /host /usr/bin/env -i PATH="/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin" ${ISCSIADM_HOST_PATH} "${@:1}"
|
||||
# https://www.docker.com/blog/road-to-containing-iscsi/
|
||||
|
||||
if [[ "${ISCSIADM_HOST_PATH}" =~ ^\/ && -f "/host${ISCSIADM_HOST_PATH}" ]]; then
|
||||
chroot /host "${ISCSIADM_HOST_PATH}" "${@:1}"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
for p in $(echo $P | cut -d ":" -f 1- --output-delimiter=" "); do
|
||||
if [[ -f "/host${p}/iscsiadm" ]]; then
|
||||
chroot /host "${p}/iscsiadm" "${@:1}"
|
||||
exit $?
|
||||
fi
|
||||
done
|
||||
|
||||
chroot /host /usr/bin/env -i PATH="${P}" ${ISCSIADM_HOST_PATH} "${@:1}"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
nsenter)
|
||||
|
|
@ -19,6 +35,7 @@ case ${ISCSIADM_HOST_STRATEGY} in
|
|||
exit 1
|
||||
fi
|
||||
nsenter --mount="/proc/${iscsid_pid}/ns/mnt" --net="/proc/${iscsid_pid}/ns/net" -- ${ISCSIADM_HOST_PATH} "${@:1}"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
*)
|
||||
|
|
|
|||
16
docker/mount
16
docker/mount
|
|
@ -1,4 +1,6 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
P="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin"
|
||||
|
||||
container_supported_filesystems=(
|
||||
"ext2"
|
||||
|
|
@ -31,7 +33,15 @@ while getopts "t:" opt; do
|
|||
done
|
||||
|
||||
if [[ ${USE_HOST_MOUNT_TOOLS} -eq 1 ]]; then
|
||||
chroot /host /usr/bin/env -i PATH="/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin" mount "${@:1}"
|
||||
for p in $(echo $P | cut -d ":" -f 1- --output-delimiter=" "); do
|
||||
if [[ -f "/host${p}/mount" ]]; then
|
||||
chroot /host "${p}/mount" "${@:1}"
|
||||
exit $?
|
||||
fi
|
||||
done
|
||||
chroot /host /usr/bin/env -i PATH="${P}" mount "${@:1}"
|
||||
exit $?
|
||||
else
|
||||
/usr/bin/env -i PATH="/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin" mount "${@:1}"
|
||||
/usr/bin/env -i PATH="${P}" mount "${@:1}"
|
||||
exit $?
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
chroot /host /usr/bin/env -i PATH="/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin" multipath "${@:1}"
|
||||
P="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin"
|
||||
|
||||
for p in $(echo $P | cut -d ":" -f 1- --output-delimiter=" "); do
|
||||
if [[ -f "/host${p}/multipath" ]]; then
|
||||
chroot /host "${p}/multipath" "${@:1}"
|
||||
exit $?
|
||||
fi
|
||||
done
|
||||
|
||||
chroot /host /usr/bin/env -i PATH="${P}" multipath "${@:1}"
|
||||
echo $?
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
chroot /host /usr/bin/env -i PATH="/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin" oneclient "${@:1}"
|
||||
P="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin"
|
||||
|
||||
for p in $(echo $P | cut -d ":" -f 1- --output-delimiter=" "); do
|
||||
if [[ -f "/host${p}/oneclient" ]]; then
|
||||
chroot /host "${p}/oneclient" "${@:1}"
|
||||
exit $?
|
||||
fi
|
||||
done
|
||||
|
||||
chroot /host /usr/bin/env -i PATH="${P}" oneclient "${@:1}"
|
||||
exit $?
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
P="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin"
|
||||
|
||||
container_supported_filesystems=(
|
||||
"ext2"
|
||||
|
|
@ -31,7 +33,15 @@ while getopts "t:" opt; do
|
|||
done
|
||||
|
||||
if [[ ${USE_HOST_MOUNT_TOOLS} -eq 1 ]]; then
|
||||
chroot /host /usr/bin/env -i PATH="/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin" umount "${@:1}"
|
||||
for p in $(echo $P | cut -d ":" -f 1- --output-delimiter=" "); do
|
||||
if [[ -f "/host${p}/umount" ]]; then
|
||||
chroot /host "${p}/umount" "${@:1}"
|
||||
exit $?
|
||||
fi
|
||||
done
|
||||
chroot /host /usr/bin/env -i PATH="${P}" umount "${@:1}"
|
||||
exit $?
|
||||
else
|
||||
/usr/bin/env -i PATH="/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin" umount "${@:1}"
|
||||
/usr/bin/env -i PATH="${P}" umount "${@:1}"
|
||||
exit $?
|
||||
fi
|
||||
|
|
|
|||
14
docker/zfs
14
docker/zfs
|
|
@ -1,3 +1,13 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
chroot /host /usr/bin/env -i PATH="/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin" zfs "${@:1}"
|
||||
P="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin"
|
||||
|
||||
for p in $(echo $P | cut -d ":" -f 1- --output-delimiter=" "); do
|
||||
if [[ -f "/host${p}/zfs" ]]; then
|
||||
chroot /host "${p}/zfs" "${@:1}"
|
||||
exit $?
|
||||
fi
|
||||
done
|
||||
|
||||
chroot /host /usr/bin/env -i PATH="${P}" zfs "${@:1}"
|
||||
exit $?
|
||||
|
|
|
|||
14
docker/zpool
14
docker/zpool
|
|
@ -1,3 +1,13 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
chroot /host /usr/bin/env -i PATH="/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin" zpool "${@:1}"
|
||||
P="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/run/current-system/sw/bin"
|
||||
|
||||
for p in $(echo $P | cut -d ":" -f 1- --output-delimiter=" "); do
|
||||
if [[ -f "/host${p}/zpool" ]]; then
|
||||
chroot /host "${p}/zpool" "${@:1}"
|
||||
exit $?
|
||||
fi
|
||||
done
|
||||
|
||||
chroot /host /usr/bin/env -i PATH="${P}" zpool "${@:1}"
|
||||
exit $?
|
||||
|
|
|
|||
Loading…
Reference in New Issue