/usr/share/tcos/hooks-addons/clean_initramfs is in initramfs-tools-tcos 0.89.86.
This file is owned by root:root, with mode 0o644.
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 | # this hook is called before mkinitramfs is called
. /etc/tcos/tcos.conf
. /usr/share/initramfs-tools/hook-functions
. $TCOS_DIR/tcos-generation-functions.sh
_verbose "(clean_initramfs) Cleaning initramfs..."
if [ "${DESTDIR}" = "" ] || [ "$DESTDIR" = "/" ]; then
_echo " * ERROR: DESTDIR var not set. not cleaning initramfs..."
exit 1
fi
find $DESTDIR/etc/ -name "*dpkg-old" | xargs rm -f
# clean ORDER files, TCOS use numbers
rm -f $DESTDIR/scripts/*/ORDER
cat << EOF >> $DESTDIR/scripts/functions
cache_run_scripts()
{
return
}
EOF
# replace /bin/sh => /bin/busybox
rm -f $DESTDIR/bin/sh
(cd $DESTDIR/bin && ln -s busybox sh)
create_links() {
( cd $DESTDIR/bin && rm -f $1 ; ln -s busybox $1)
}
# Some scripts without correct permissions
chmod -R a+x ${DESTDIR}/scripts/panic/ 2>/dev/null
chmod -R a+x ${DESTDIR}/scripts/init-*/
chmod -R a+x ${DESTDIR}/scripts/tcos-*/
create_links "date"
create_links "bash"
create_links "tftp"
create_links "awk"
create_links "dirname"
create_links "chown"
create_links "wc"
create_links "head"
create_links "whoami"
create_links "swapon"
create_links "swapoff"
create_links "dmesg"
create_links "route"
create_links "run-parts"
create_links "killall"
create_links "which"
create_links "pidof"
create_links "syslogd"
create_links "logger"
create_links "ulimit"
create_links "ifconfig"
create_links "grep" # needed by a udev rule
create_links "udhcpc"
# use busybox mount/umount instead of klibc utils
create_links "mount"
create_links "umount"
# link creator
mkdir -p $DESTDIR/scripts/tcos-bottom
cat << EOF > $DESTDIR/scripts/tcos-bottom/00linkcreator
#!/bin/sh
if [ "\$1" = "prereqs" ]; then
exit 0
fi
[ ! -e /conf/links ] && exit
cat /conf/links | while read line ; do
ln -s \$line >> /tmp/initramfs.debug 2>&1
echo "[linkcreator] ln -s \$line" >> /tmp/initramfs.debug
done
EOF
chmod +x $DESTDIR/scripts/tcos-bottom/00linkcreator
create_link() {
if [ -e $DESTDIR/$1 ] && [ -e $DESTDIR/$2 ]; then
if cmp $DESTDIR/$1 $DESTDIR/$2; then
rm -f $DESTDIR/$1
echo "$2 $1" >> $DESTDIR/conf/links
fi
fi
}
# mtools
create_link /usr/bin/mcopy /usr/bin/mattrib
create_link /usr/bin/mcopy /usr/bin/mcat
create_link /usr/bin/mcopy /usr/bin/mcopy
create_link /usr/bin/mcopy /usr/bin/mdel
create_link /usr/bin/mcopy /usr/bin/mformat
create_link /usr/bin/mcopy /usr/bin/minfo
create_link /usr/bin/mcopy /usr/bin/mlabel
create_link /usr/bin/mcopy /usr/bin/mmove
create_link /usr/bin/mcopy /usr/bin/mmount
create_link /usr/bin/mcopy /usr/bin/mtype
create_link /usr/lib/libpci.so.3 /lib/libpci.so.3
create_link /usr/lib/libz.so.1 /lib/libz.so.1
create_link /etc/console/boottime.kmap.gz /etc/boottime.kmap.gz
create_link /usr/share/X11/xkb/symbols/sun_vndr/cz /usr/share/X11/xkb/symbols/sun_vndr/cs
create_link /usr/lib/xorg/modules/drivers/i810_drv.so /usr/lib/xorg/modules/drivers/intel_drv.so
create_link /usr/share/X11/xkb/rules/evdev.lst /usr/share/X11/xkb/rules/base.lst
#( cd $DESTDIR/bin && rm -f zcat ; ln -s gunzip zcat )
if [ -d $DESTDIR/lib/cmds ]; then
( cd $DESTDIR/lib/cmds && rm -f poweroff && ln -s reboot poweroff )
fi
( cd $DESTDIR/sbin && rm -f udevsettle ; ln -s udevadm udevsettle )
# zattoo provides libasound.so.2 link in /usr/lib/zattoo that breaks sound support
# move to their site
if [ -e $DESTDIR/usr/lib/zattoo/libasound.so.2 ]; then
mv $DESTDIR/usr/lib/zattoo/libasound.so.2 $DESTDIR/usr/lib/libasound.so.2
rmdir $DESTDIR/usr/lib/zattoo/
fi
if [ $TCOS_DISABLE_ACPI ] ; then
#rm -rf $DESTDIR/bin/sh*
#( cd ${DESTDIR}/bin/ && ln -s busybox sh )
rm -rf $DESTDIR/scripts/usb*
rm -rf $DESTDIR/scripts/live*
rm -rf $DESTDIR/scripts/local*
rm -rf $DESTDIR/scripts/casper*
rm -rf $DESTDIR/scripts/nfs*
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/${TCOS_KERNEL}/kernel/drivers/md/
rm -rf ${DESTDIR}/lib/modules/${TCOS_KERNEL}/drivers/md/
rm -rf ${DESTDIR}/lib/modules/${TCOS_KERNEL}/drivers/acpi/
# rm -rf $(find ${DESTDIR}/lib/modules/${TCOS_KERNEL}/kernel/drivers/scsi/ \
# -not -name "sd_mod.ko" -not -name "sr_mod.ko" \
# -not -name "scsi_mod.ko" -not -name "sg.ko" )
fi
if [ "$TCOS_DISABLE_USPLASH" = "1" ]; then
_echo " * Remove usplash"
rm -f ${DESTDIR}/lib/usplash 2>/dev/null
rm -f ${DESTDIR}/sbin/usplash 2>/dev/null
rm -f ${DESTDIR}/sbin/usplash_write 2>/dev/null
rm -f ${DESTDIR}/scripts/init-top/*usplash* 2>/dev/null
fi
if [ "$TCOS_DISABLE_PLYMOUTH" = "1" ]; then
rm -f ${DESTDIR}/scripts/*/plymouth 2>/dev/null
rm -rf ${DESTDIR}/lib/plymouth 2>/dev/null
rm -f ${DESTDIR}/sbin/plymouthd 2>/dev/null
rm -f ${DESTDIR}/bin/plymouth 2>/dev/null
fi
# experimental delete, not needed LIBS
rm -f ${DESTDIR}/sbin/resume
#rm -f ${DESTDIR}/usr/lib/libgcrypt.so.11
#rm -f ${DESTDIR}/usr/lib/libpcre.so.3
#rm -f ${DESTDIR}/usr/lib/libgpg-error.so.0
rm -f ${DESTDIR}/usr/lib/libGL.so.1.2
rm -f ${DESTDIR}/usr/lib/libGLU.so.1
#rm -f ${DESTDIR}/usr/lib/libkrb5support.so.0
#rm -f ${DESTDIR}/usr/lib/libfusion-1.0.so.0
#rm -f ${DESTDIR}/usr/lib/libdrm.so.2
#rm -f ${DESTDIR}/usr/lib/libdirectfb-1.0.so.0
rm -f ${DESTDIR}/usr/lib/libnvidia-tls.so.1
#rm -f ${DESTDIR}/usr/lib/libdirect-1.0.so.0
#rm -f ${DESTDIR}/usr/lib/libk5crypto.so.3
#rm -f ${DESTDIR}/usr/lib/libkrb5.so.3
#rm -f ${DESTDIR}/usr/lib/libXxf86vm.so.1
#rm -f ${DESTDIR}/usr/lib/libglib-2.0.so.0
# no remove, needed for new lockscreen (imlib2)
#rm -f ${DESTDIR}/usr/lib/imlib2/loaders/png.so
#rm -f ${DESTDIR}/usr/lib/libgssapi_krb5.so.2
#rm -f ${DESTDIR}/lib/libsplashycnf.so.1
#rm -f ${DESTDIR}/lib/libkeyutils.so.1
#rm -f ${DESTDIR}/lib/libsplashy.so.1
rm -rf ${DESTDIR}/etc/dhcp3/gadmin-dhcpd
|