Getting the stratum init ?
by ychaouche from LinuxQuestions.org on (#4T0PK)
In the installer's archive, in bedrock/sbin/init, around line 371, this block of code
Code:if [ -n "${def_tuple}" ] && [ -d "/bedrock/strata/${def_stratum}" ]; then
sproc="/bedrock/strata/${def_stratum}/proc"
mkdir -p "${sproc}" 2>/dev/null || true
mount -t proc proc "${sproc}"
if def_link="$(chroot "/bedrock/strata/${def_stratum}" "/proc/1/root/bedrock/libexec/busybox" realpath "${def_cmd}" 2>/dev/null)"; then
def_path="/bedrock/strata/${def_stratum}${def_link}"
fi
umount "${sproc}"
fiThe difficult part for me was to understand what this assignement does :
Quote:
it seems to be trying to retrive the stratum's init binary but in a somewhat convoluted way. I'm sure it is necessary to do it this way, but I was wondering if anyone would like to explain the details of what's going on there ?


Code:if [ -n "${def_tuple}" ] && [ -d "/bedrock/strata/${def_stratum}" ]; then
sproc="/bedrock/strata/${def_stratum}/proc"
mkdir -p "${sproc}" 2>/dev/null || true
mount -t proc proc "${sproc}"
if def_link="$(chroot "/bedrock/strata/${def_stratum}" "/proc/1/root/bedrock/libexec/busybox" realpath "${def_cmd}" 2>/dev/null)"; then
def_path="/bedrock/strata/${def_stratum}${def_link}"
fi
umount "${sproc}"
fiThe difficult part for me was to understand what this assignement does :
Quote:
| def_link="$(chroot "/bedrock/strata/${def_stratum}" "/proc/1/root/bedrock/libexec/busybox" realpath "${def_cmd}" 2>/dev/null)"; |