/usr/share/tcos/hooks/tcosbin is in initramfs-tools-tcos 0.89.86.
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 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | #!/bin/bash
# new header not using prereqs
if [ "$1" = "prereqs" ]; then
echo ""
exit 0
fi
# Hooks for install binaries for tcos boot
#
. /usr/share/initramfs-tools/hook-functions
# read conf file => /etc/tcos/initramfs.conf
. $CONFDIR/initramfs.conf
# read from env vars TCOS_BOOT
TCOS_BOOT=$(env| awk -F "=" '/^TCOS_BOOT=/ {print $2}')
if [ "${TCOS_BOOT}" != "" ]; then
BOOT=$TCOS_BOOT
fi
if [ "${BOOT}" = "tcos" ]; then
. $CONFDIR/tcos.conf
[ -f $CONFDIR/version.conf ] && . $CONFDIR/version.conf
. $TCOS_DIR/tcos-generation-functions.sh
for tpl in $(tcos_get_templates); do
_verbose "(tcosbin) loading template $(basename $tpl)"
. $tpl
done
# load forced settings for derivatives
if [ -d $CONFDIR/conf.d/ ]; then
for file in $CONFDIR/conf.d/tcos*conf; do
[ -e $file ] && . $file
done
fi
# load hooks-addons (small files with group of packages inside)
_files=$(ls -1 ${TCOS_DIR}/hooks-addons/ | grep -v -e .dpkg -e .svn)
for addon in $_files ; do
_verbose "(tcosbin) LOADING: system addon: ${addon}"
. ${TCOS_DIR}/hooks-addons/${addon}
done
# load hooks-addons in /etc/tcos (small files with group of packages inside)
_files=$(ls -1 ${TCOS_CONF}/hooks-addons/ | grep -v -e dpkg -e .svn)
for addon in $_files ; do
_echo " LOADING: personal addon: ${TCOS_CONF}/hooks-addons/${addon}"
. ${TCOS_CONF}/hooks-addons/${addon}
done
# read all files in ${TCOS_CONF}/hacking/ and load it ( personal files )
_files=$(ls -1 ${TCOS_CONF}/hacking/ | grep -v -e dpkg -e .svn)
for hack in $_files ; do
if [ "${hack}" != "template" ]; then
_echo " LOADING: hack: ${TCOS_CONF}/hacking/${hack}"
fi
. ${TCOS_CONF}/hacking/${hack}
done
# to be sure that /usr have files and not links
# we search links delete them and put file instead
convert_links2files
# read from env vars TCOS_BOOT
TCOS_ENV_DISABLE_SQUASHFS=$(env| awk -F "=" '/^TCOS_ENV_DISABLE_SQUASHFS=/ {print $2}')
if [ "${TCOS_ENV_DISABLE_SQUASHFS}" != "" ]; then
TCOS_DISABLE_SQUASHFS=$TCOS_ENV_DISABLE_SQUASHFS
fi
MKSQUASHFS=mksquashfs
[ -x /usr/bin/mksquashfs ] && MKSQUASHFS=/usr/bin/mksquashfs
[ -x /usr/sbin/mksquashfs ] && MKSQUASHFS=/usr/sbin/mksquashfs
if [ -z $TCOS_DISABLE_SQUASHFS ]; then
# create usr.squashfs
if [ $(env | grep -c ^TCOS_SUFFIX) = 1 ]; then
TCOS_SUFFIX=$(env | grep ^TCOS_SUFFIX | awk -F "=" '{print $2}')
echo "SQUASHFS_FILE=\"usr${TCOS_SUFFIX}-${version}.squashfs\"" >> $DESTDIR/conf/tcos.conf
fi
SQUASHFS_FILE="usr${TCOS_SUFFIX}-${version}.squashfs"
_echo " Creating ${SQUASHFS_FILE} of /usr"
mkdir -p $DESTDIR/mnt/tmp
$MKSQUASHFS $DESTDIR/usr/ $DESTDIR/mnt/tmp/${SQUASHFS_FILE} > /tmp/tcos-mksquashfs.log 2>&1
# check for mksquashfs errors
if [ $? != 0 ]; then
_echo " ERROR:"
_echo " mksquashfs error"
_echo "#############################################"
cat /tmp/tcos-mksquashfs.log
_echo "#############################################"
fi
rm -f /tmp/tcos-mksquashfs.log
# mksquashfs create files with 700 rights, change to 644
chmod 644 $DESTDIR/mnt/tmp/${SQUASHFS_FILE}
rm -rf $DESTDIR/usr/ && mkdir $DESTDIR/usr
# overwrite TCOS_SQUASHFS from shell env var
# this allow to create cdrom with usr.squashfs embedded
if [ $(env | grep -c ^TCOS_SQUASHFS) = 1 ]; then
TCOS_SQUASHFS=$(env | grep ^TCOS_SQUASHFS | awk -F "=" '{print $2}')
_echo "DEBUG: overwrite TCOS_SQUASHFS=$TCOS_SQUASHFS"
else
if [ "${TCOS_SQUASHFS}" = "1" ] ; then
_echo " Moving ${SQUASHFS_FILE} to ${TFTP_DIR}"
mv $DESTDIR/mnt/tmp/${SQUASHFS_FILE} ${TFTP_DIR}
fi
fi # end of TCOS_SQUASHFS
fi # end of TCOS_DISABLE_SQUASHFS
TCOS_INCLUDE_INIT=1
. ${TCOS_DIR}/hooks-addons/00init
unset TCOS_INCLUDE_INIT
# clean /lib/tls if needed
if [ -d $DESTDIR/lib/tls ]; then
_echo " * WARNING: /lib/tls exists in image"
for lib in ${DESTDIR}/lib/tls/*; do
tlslib=$lib
notlslib=$(echo $lib | sed 's/tls\///g')
notlslib1=$(basename $lib)
notlslib2=$(basename $lib | awk -F "." '{print $1}')
if [ -f $notlslib ]; then
_echo "WARNING rm -f $lib"
elif [ -f /lib/${notlslib1} ]; then
_echo "WARNING cp -a /lib/${notlslib} $DESTDIR/lib"
else
_echo "$tlslib not found"
fi
done
fi # end of /lib/tls dir exists
# clean /lib/i686 if needed
if [ -d $DESTDIR/lib/i686 ]; then
# convert symlinks to files into lib/i686 dir
convert_links2files "lib/i686"
for lib in $(find ${DESTDIR}/lib/i686 -type f); do
i686lib=$lib
noi686lib=$(echo $lib | sed 's/i686\/cmov\///g')
noi686lib1=$(basename $lib)
if [ -f $noi686lib ]; then
rm -f $lib
elif [ -f /lib/${noi686lib1} ]; then
cp -f /lib/${noi686lib1} $DESTDIR/lib/
rm -f $lib
else
_echo "WARNING equivalent to $i686lib not found"
fi
done
(rmdir ${DESTDIR}/lib/i686/cmov && rmdir ${DESTDIR}/lib/i686) || _echo " * WARNING can't delete /lib/i686 from image (not empty)"
fi # end of /lib/i686 dir exists
# clean /usr/lib/i686 if needed
if [ -d $DESTDIR/usr/lib/i686 ]; then
# convert symlinks to files into usr/lib/i686 dir
convert_links2files "usr/lib/i686"
for lib in $(find ${DESTDIR}/usr/lib/i686 -type f); do
i686lib=$lib
noi686lib=$(echo $lib | sed 's/i686\/cmov\///g')
noi686lib1=$(basename $lib)
if [ -f $noi686lib ]; then
rm -f $lib
elif [ -f /usr/lib/${noi686lib1} ]; then
cp -f /usr/lib/${noi686lib1} $DESTDIR/usr/lib/
rm -f $lib
else
_echo "WARNING equivalent to $i686lib not found"
fi
done
(rmdir ${DESTDIR}/usr/lib/i686/cmov && rmdir ${DESTDIR}/usr/lib/i686) || _echo " * WARNING can't delete /usr/lib/i686 from image (not empty)"
fi # end of /usr/lib/i686 dir exists
if [ $TCOS_DISABLE_ACPI ]; then
stat_before
rm -rf $DESTDIR/lib/modules/*/drivers/md/
rm -rf $DESTDIR/lib/modules/*/drivers/acpi/
rm -rf $DESTDIR/scripts/usb*
rm -rf $DESTDIR/scripts/live*
rm -rf $DESTDIR/scripts/local*
rm -rf $DESTDIR/scripts/casper*
rm -rf $DESTDIR/scripts/init-premount/thermal
rm -rf $DESTDIR/sbin/mdadm
rm -rf $DESTDIR/scripts/init-premount/mdadm
rm -rf $DESTDIR/sbin/mdrun
rm -rf $DESTDIR/sbin/vgchange
rm -rf $DESTDIR/sbin/cryptsetup
rm -rf $DESTDIR/sbin/dmsetup
rm -rf $DESTDIR/lib/lvm*
rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/md/
rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/scsi
manual_add_modules scsi_mod
manual_add_modules sd_mod
manual_add_modules sr_mod
stat_after "Disable ACPI and RAID support"
else
_verbose "(tcosbin)TCOS_DISABLE_ACPI not set"
fi
# read shell env variables to search TCOS_ALL_MODULES
if [ $(env | grep -c ^TCOS_ALL_MODULES) = 1 ]; then
TCOS_ALL_MODULES=$(env | grep ^TCOS_ALL_MODULES | awk -F "=" '{print $2}')
fi
# create allmodules.squashfs
if [ $TCOS_ALL_MODULES ]; then
_echo "Running depmod of kernel ${version}"
DEPMOD_ARGS="-a -F /boot/System.map-${TCOS_KERNEL}"
if depmod -h 2>&1|grep -q map; then
DEPMOD_ARGS="-am -F /boot/System.map-${TCOS_KERNEL}"
fi
depmod $DEPMOD_ARGS ${version}
_echo " Creating allmodules-${version}.squashfs file"
mkdir -p $DESTDIR/mnt/tmp > /dev/null 2>&1
$MKSQUASHFS /lib/modules/${version}/ $DESTDIR/mnt/tmp/allmodules-${version}.squashfs -e volatile -noappend > /dev/null 2>&1
# mksquashfs create files with 700 rights, change to 644
chmod 644 ${DESTDIR}/mnt/tmp/allmodules-${version}.squashfs
_echo " Moving allmodules-${version}.squashfs to ${TFTP_DIR}"
mv ${DESTDIR}/mnt/tmp/allmodules-${version}.squashfs ${TFTP_DIR}
fi
fi
|