/usr/share/tcos/hooks-addons/00main 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 | # Hook addon for common utils
# copy internal tcos conf
cp $TCOS_DIR/tcos-run-functions.sh $DESTDIR/conf/tcos-run-functions
cp $CONFDIR/tcos.conf $DESTDIR/conf/
for tpl in $(tcos_get_templates); do
_verbose "(00main) cat $tpl >> $DESTDIR/conf/tcos.conf"
cat $tpl >> $DESTDIR/conf/tcos.conf
done
# load forced settings for derivatives
if [ -d $CONFDIR/conf.d/ ]; then
for file in $CONFDIR/conf.d/tcos*conf; do
[ -e $file ] && cat $file >> $DESTDIR/conf/tcos.conf
done
fi
# clean tcos.conf file (delete empty lines and comments)
grep -v "^#" $DESTDIR/conf/tcos.conf | grep "=" | grep -v "^TEMPLATE" > $DESTDIR/conf/tcos.conf.tmp
mv $DESTDIR/conf/tcos.conf.tmp $DESTDIR/conf/tcos.conf
# make some dirs
[ -d $DESTDIR/dev ] || mkdir -m 0755 $DESTDIR/dev
[ -d $DESTDIR/root ] || mkdir --mode=0700 $DESTDIR/root
[ -d $DESTDIR/ram ] || mkdir $DESTDIR/ram
[ -d $DESTDIR/nfs ] || mkdir $DESTDIR/nfs
mkdir -p $DESTDIR/usr/bin
mkdir -p $DESTDIR/usr/sbin
mkdir -p $DESTDIR/lib/lsb/
cp /lib/lsb/init-functions ${DESTDIR}/lib/lsb/
cpifexists /etc/debian_version /etc/
cpifexists $TCOS_DIR/tcos-modules.conf /conf/
# seq script
cpifexists ${TCOS_BINS}/seq /bin
# get_filesystem
cpifexists ${TCOS_BINS}/get_filesystem /bin
# limits
cpifexists ${TCOS_BINS}/set-limits /bin
# exec and daemonize
cpifexists ${TCOS_BINS}/daemonize.sh /sbin
# tcos-pam-usb.sh (tcosxmlrpc helper)
cpifexists ${TCOS_BINS}/tcos-pam-usb.sh /sbin
rm -f $DESTDIR/sbin/start-stop-daemon
# in tcos-buildchroot we save this exe file in start-stop-daemon.original
if [ -e /sbin/start-stop-daemon.original ]; then
copy_exec /sbin/start-stop-daemon.original /sbin/
rm -f $DESTDIR/sbin/start-stop-daemon.original
cp -a /sbin/start-stop-daemon.original $DESTDIR/sbin/start-stop-daemon
if [ "$(file ${DESTDIR}/sbin/start-stop-daemon | grep -c ELF)" = "0" ]; then
_echo " * WARNING:"
_echo " /sbin/start-stop-daemon is not a ELF (binary) file"
_echo " Some apps will not work."
fi
elif [ -e /sbin/start-stop-daemon.REAL ]; then
copy_exec /sbin/start-stop-daemon.REAL /sbin/
rm -f $DESTDIR/sbin/start-stop-daemon.REAL
rm -f $DESTDIR/sbin/start-stop-daemon
cp -a /sbin/start-stop-daemon.REAL $DESTDIR/sbin/start-stop-daemon
if [ "$(file ${DESTDIR}/sbin/start-stop-daemon | grep -c ELF)" = "0" ]; then
_echo " * WARNING:"
_echo " /sbin/start-stop-daemon is not a ELF (binary) file"
_echo " Some apps will not work."
fi
else
copy_exec /sbin/start-stop-daemon /sbin/
rm -f $DESTDIR/sbin/start-stop-daemon
cp -a /sbin/start-stop-daemon $DESTDIR/sbin/start-stop-daemon
fi
# exec and daemonize
cpifexists ${TCOS_BINS}/clear-logs /bin
if [ "${TCOS_INCLUDE_INIT}" != "1" ]; then
# only include ldconfig in no NFS image
# ubuntu hack for ldconfig
if [ -e /sbin/ldconfig.real ]; then
cpifexists /sbin/ldconfig.real /usr/sbin/
# rename
rm -f $DESTDIR/usr/sbin/ldconfig.real
cp -a /sbin/ldconfig.real $DESTDIR/usr/sbin/ldconfig
else
cpifexists /sbin/ldconfig /usr/sbin/
fi
fi
[ -f /etc/ld.so.conf ] && cpifexists /etc/ld.so.conf /etc/
[ ! -f /etc/ld.so.conf ] && echo "/usr/lib" >> $DESTDIR/etc/ld.so.conf
# multiarch support
mkdir -p $DESTDIR/etc/ld.so.conf.d/
[ -f /etc/ld.so.conf.d/i486-linux-gnu.conf ] && cpifexists /etc/ld.so.conf.d/i486-linux-gnu.conf /etc/ld.so.conf.d/
[ -f /etc/ld.so.conf.d/x86_64-linux-gnu.conf ] && cpifexists /etc/ld.so.conf.d/x86_64-linux-gnu.conf /etc/ld.so.conf.d/
cpifexists /sbin/depmod /sbin/
cpifexists /etc/localtime /etc/
[ -f /etc/adjtime ] && cpifexists /etc/adjtime /etc/
cpifexists /etc/securetty /etc
cpifexists /etc/services /etc/
# create (if not exists) empty modules file
touch $DESTDIR/etc/modules
mkdir -p $DESTDIR/usr/lib
# multiarch support
LIB_DIR=/lib
[ -e /lib/x86_64-linux-gnu/libresolv.so.2 ] && LIB_DIR=/lib/x86_64-linux-gnu
[ -e /lib/i386-linux-gnu/libresolv.so.2 ] && LIB_DIR=/lib/i386-linux-gnu
cpifexists ${LIB_DIR}/libresolv.so.2 /lib/
cpifexists /usr/${LIB_DIR}/libgssapi_krb5.so.2 /usr/lib/
# need to copy this libs to support usernames with busybox
cpifexists ${LIB_DIR}/libnss_compat.so.2 /lib/
cpifexists ${LIB_DIR}/libnss_files.so.2 /lib/
cpifexists ${LIB_DIR}/libnss_nis.so.2 /lib/
cpifexists ${LIB_DIR}/libnss_dns.so.2 /lib/
[ -e ${LIB_DIR}/libnss_db.so.2 ] && cpifexists ${LIB_DIR}/libnss_db.so.2 /usr/lib/
# new lib (needed for DNS calls)
[ -e /lib/libnss_mdns4_minimal.so.2 ] && cpifexists /lib/libnss_mdns4_minimal.so.2 /lib/
# needed for NFS
[ -x /sbin/portmap ] && cpifexists /sbin/portmap /sbin
[ -x /sbin/rpcbind ] && cpifexists /sbin/rpcbind /sbin
# create some dirs
mkdir -p $DESTDIR/var/log
touch $DESTDIR/var/log/lastlog
mkdir -p ${DESTDIR}/var/run
# hack run_scripts... TCOS use numbered
cat << EOF >> $DESTDIR/scripts/functions
# TCOS hacked ;)
run_scripts()
{
initdir=\${1}
[ ! -d \${1} ] && return
for sc in \$(ls -t1 \${1}); do
\${1}/\${sc}
done
}
EOF
|