/usr/share/dell/scripts/chroot.sh is in dell-recovery 1.48.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | #!/bin/sh
#
# <chroot.sh>
#
# Prepares the installed system for entering into postinstall phase
# Calls the postinatll phase script (run_chroot)
# Cleans up after postinstall completes
#
# Copyright 2008-2010 Dell Inc.
# Mario Limonciello <Mario_Limonciello@Dell.com>
# Hatim Amro <Hatim_Amro@Dell.com>
# Michael E Brown <Michael_E_Brown@Dell.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
set -x
set -e
export TARGET=/target
if [ -d "/isodevice" ]; then
DEVICE=$(mount | sed -n 's/\ on\ \/isodevice.*//p')
else
DEVICE=$(mount | sed -n 's/\ on\ \/cdrom.*//p')
fi
export BOOTDEV=${DEVICE%%[0-9]*}
DEVICE=$(mount | sed -n 's/\ on\ \/target.*//p')
export TARGETDEV=${DEVICE%%[0-9]*}
LOG="var/log"
if [ -d "$TARGET/$LOG/installer" ]; then
LOG="$LOG/installer"
fi
export LOG
if [ -d "$TARGET/$LOG" ]; then
exec > $TARGET/$LOG/chroot.sh.log 2>&1
chroot $TARGET chattr +a $LOG/chroot.sh.log
else
export TARGET=/
exec > $TARGET/$LOG/chroot.sh.log 2>&1
fi
#for debugging later, show efibootmgr output before we proceed
efibootmgr -v
# Nobulate Here.
# This way if we die early we'll RED Screen
if [ -x /dell/fist/tal ]; then
/dell/fist/tal nobulate 0
fi
if [ "$1" != "success" ]; then
. /usr/share/dell/scripts/FAIL-SCRIPT
exit 1
fi
echo "in $0"
# Execute FAIL-SCRIPT if we exit for any reason (abnormally)
trap ". /usr/share/dell/scripts/FAIL-SCRIPT" TERM INT HUP EXIT QUIT
mount --bind /dev $TARGET/dev
MOUNT_CLEANUP="$TARGET/dev $MOUNT_CLEANUP"
if ! mount | grep "$TARGET/run"; then
mount --bind /run $TARGET/run
MOUNT_CLEANUP="$TARGET/run $MOUNT_CLEANUP"
fi
if ! mount | grep "$TARGET/proc"; then
mount -t proc targetproc $TARGET/proc
MOUNT_CLEANUP="$TARGET/proc $MOUNT_CLEANUP"
fi
if ! mount | grep "$TARGET/sys"; then
mount -t sysfs targetsys $TARGET/sys
MOUNT_CLEANUP="$TARGET/sys $MOUNT_CLEANUP"
fi
if ! mount | grep "$TARGET/cdrom"; then
mount --bind /cdrom $TARGET/cdrom
MOUNT_CLEANUP="$TARGET/cdrom $MOUNT_CLEANUP"
fi
if [ ! -L $TARGET/media/cdrom ]; then
ln -s /cdrom $TARGET/media/cdrom
DIR_CLEANUP="$TARGET/media/cdrom $DIR_CLEANUP"
fi
#Make sure fifuncs and target_chroot are available
if [ ! -d $TARGET/usr/share/dell/scripts ]; then
mkdir -p $TARGET/usr/share/dell/scripts
DIR_CLEANUP="$TARGET/usr/share/dell/scripts $DIR_CLEANUP"
mount --bind /usr/share/dell/scripts $TARGET/usr/share/dell/scripts
MOUNT_CLEANUP="$TARGET/usr/share/dell/scripts $MOUNT_CLEANUP"
fi
#If we are loop mounted, this will have been done during the ubiquity
if [ -d /isodevice ]; then
MOUNT_CLEANUP="$TARGET/isodevice $MOUNT_CLEANUP"
fi
export MOUNT_CLEANUP
#Make sure that WinPE isn't in our menus (happens in uEFI case)
if [ -d /dell/fist ] && ! grep "^GRUB_DISABLE_OS_PROBER" $TARGET/etc/default/grub >/dev/null; then
echo "GRUB_DISABLE_OS_PROBER=true" >> $TARGET/etc/default/grub
fi
#Run chroot scripts
chroot $TARGET /usr/share/dell/scripts/target_chroot.sh
for mountpoint in $MOUNT_CLEANUP;
do
umount -l $mountpoint
done
unset MOUNT_CLEANUP
for directory in $DIR_CLEANUP;
do
rm -rf $directory
done
chroot $TARGET chattr -a $LOG/chroot.sh.log
sync;sync
# reset traps, as we are now exiting normally
trap - TERM INT HUP EXIT QUIT
. /usr/share/dell/scripts/SUCCESS-SCRIPT $BOOT_DEV $BOOT_PART_NUM
|