# 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) } # Need wrapper for bash rm -f $DESTDIR/bin/bash cat << EOF > $DESTDIR/bin/bash #!/bin/sh /bin/sh \$@ EOF chmod +x $DESTDIR/bin/bash # Some scripts without correct permissions chmod -R a+x ${DESTDIR}/scripts/panic/ chmod -R a+x ${DESTDIR}/scripts/init-*/ chmod -R a+x ${DESTDIR}/scripts/tcos-*/ [ -e ${DESTDIR}/scripts/init-top/console-setup ] && rm -f ${DESTDIR}/scripts/init-top/console-setup [ -e ${DESTDIR}/scripts/init-top/framebuffer ] && rm -f ${DESTDIR}/scripts/init-top/framebuffer [ -e ${DESTDIR}/scripts/init-top/plymouth ] && rm -f ${DESTDIR}/scripts/init-top/plymouth [ -e ${DESTDIR}/scripts/init-top/brltty ] && rm -f ${DESTDIR}/scripts/init-top/brltty 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 # 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/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