/usr/share/tcos/hooks-addons/05compcache is in initramfs-tools-tcos 0.89.93ubuntu2.
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 | # hook for compcache
# based on Ubuntu initramfs hook
#
#
if [ $TCOS_COMPCACHE ]; then
stat_before
tcos_manual_add_modules ramzswap
tcos_manual_add_modules zram
# need swapon for preference option (busybox swapon don't have it)
cpifexists /sbin/swapon /sbin/
[ -x /usr/sbin/rzscontrol ] && cpifexists /usr/sbin/rzscontrol /usr/sbin/
mkdir -p $DESTDIR/etc/udev/rules.d
cat << EOF > $DESTDIR/etc/udev/rules.d/80-compcache.rules
KERNEL=="ramzswap0", ACTION=="add", RUN+="/sbin/swapon -p 100 /dev/ramzswap0 2>/dev/null"
EOF
cat << EOF > $DESTDIR/scripts/init-top/compcache
#!/bin/sh
# new header not using prereqs
if [ "\$1" = "prereqs" ]; then
echo ""
exit 0
fi
quiet=n
. /conf/tcos.conf
. /conf/tcos-run-functions
# find total amount of available ram
TOTAL_RAM=\$(grep MemTotal /proc/meminfo |tr -d ': [A-Z][a-z]')
# Do not use compcache if we have more than 256M
if [ "\${TOTAL_RAM}" -gt 262144 ]; then
exit 0
fi
# add TCOS_COMPCACHE_PERCENT% of RAM (by default 20)
kbytes="\$((\$TOTAL_RAM * $TCOS_COMPCACHE_PERCENT / 100))"
AVALAIBLE_RAM=\$(grep 'Inactive:' /proc/meminfo |tr -d ': [A-Z][a-z]')
if [ "\${kbytes}" -gt "\${AVALAIBLE_RAM}" ]; then
kbytes=\$(( \${AVALAIBLE_RAM} - 500 ))
fi
if tcos_find_module "zram"; then
modprobe zram
echo \$((1024*\$kbytes)) > /sys/block/zram0/disksize
/sbin/mkswap /dev/zram0 >/dev/null 2>&1
/sbin/swapon -p 100 /dev/zram0 >/dev/null 2>&1
else
modprobe -q --ignore-install ramzswap
fi
EOF
chmod 0755 $DESTDIR/scripts/init-top/compcache
stat_after "Compcache support ($TCOS_COMPCACHE_PERCENT%)"
fi
|