summaryrefslogtreecommitdiff
path: root/hooks-addons
diff options
context:
space:
mode:
Diffstat (limited to 'hooks-addons')
-rw-r--r--hooks-addons/00init69
-rw-r--r--hooks-addons/00main166
-rw-r--r--hooks-addons/00users65
-rw-r--r--hooks-addons/01busybox43
-rw-r--r--hooks-addons/01dhclient31
-rw-r--r--hooks-addons/02hex2ascii8
-rw-r--r--hooks-addons/03udev2171
-rw-r--r--hooks-addons/03wireless189
-rw-r--r--hooks-addons/04debug43
-rw-r--r--hooks-addons/05compcache69
-rw-r--r--hooks-addons/06funionfs12
-rw-r--r--hooks-addons/06nbd_filesystem11
-rw-r--r--hooks-addons/07cdaudio17
-rw-r--r--hooks-addons/08pcimodules8
-rw-r--r--hooks-addons/09printer37
-rw-r--r--hooks-addons/10hwclock7
-rw-r--r--hooks-addons/10ssl_tunnel100
-rw-r--r--hooks-addons/12getty47
-rw-r--r--hooks-addons/13kbmap31
-rw-r--r--hooks-addons/14ssh35
-rw-r--r--hooks-addons/15inetd18
-rw-r--r--hooks-addons/16dbus-avahi108
-rw-r--r--hooks-addons/17acpid29
-rw-r--r--hooks-addons/18openvpn84
-rw-r--r--hooks-addons/18tcos_hdd_installer31
-rw-r--r--hooks-addons/19usbip61
-rw-r--r--hooks-addons/20alsa69
-rw-r--r--hooks-addons/21pulseaudio239
-rw-r--r--hooks-addons/23bootchart46
-rw-r--r--hooks-addons/40etc230045
-rw-r--r--hooks-addons/45wakeonlan22
-rw-r--r--hooks-addons/49xfbdev87
-rw-r--r--hooks-addons/50xorg401
-rw-r--r--hooks-addons/51amd_geode56
-rw-r--r--hooks-addons/51dri81
-rw-r--r--hooks-addons/51paquito132
-rw-r--r--hooks-addons/51via_openchrome111
-rw-r--r--hooks-addons/52intel33
-rw-r--r--hooks-addons/53mga35
-rw-r--r--hooks-addons/54devices76
-rw-r--r--hooks-addons/55vnc40
-rw-r--r--hooks-addons/56rdesktop67
-rw-r--r--hooks-addons/57ntpdate14
-rw-r--r--hooks-addons/59freenx141
-rw-r--r--hooks-addons/60italc119
-rw-r--r--hooks-addons/65web_browser51
-rw-r--r--hooks-addons/70tcosmonitor127
-rw-r--r--hooks-addons/90plymouth100
-rw-r--r--hooks-addons/90usplash22
-rw-r--r--hooks-addons/91splashy65
-rw-r--r--hooks-addons/95usplash_timeout74
-rw-r--r--hooks-addons/96modules72
-rw-r--r--hooks-addons/99clean_nfs_image68
-rw-r--r--hooks-addons/99tcos44
-rwxr-xr-xhooks-addons/clean_initramfs205
55 files changed, 4132 insertions, 0 deletions
diff --git a/hooks-addons/00init b/hooks-addons/00init
new file mode 100644
index 0000000..bd5c78e
--- /dev/null
+++ b/hooks-addons/00init
@@ -0,0 +1,69 @@
+# create reboot && poweroff scripts
+
+if [ "${TCOS_INCLUDE_INIT}" = "1" ]; then
+
+ # now copy reboot and poweroff in /usr/sbin outside of
+ # usr.squashfs, because reboot -f is exec after umount /usr
+
+ stat_before
+ mkdir -p $DESTDIR/usr/sbin >/dev/null 2>&1
+ mkdir -p $DESTDIR/lib/cmds >/dev/null 2>&1
+ # init reboot poweroff
+ cpifexists /sbin/reboot /lib/cmds/
+ cpifexists /sbin/poweroff /lib/cmds/
+ cpifexists ${TCOS_BINS}/down-controller /sbin/
+
+ rm -f $DESTDIR/bin/reboot
+ rm -f $DESTDIR/bin/poweroff
+ rm -f $DESTDIR/bin/halt
+
+
+ # reboot script
+ cat <<EOF > ${DESTDIR}/sbin/reboot
+#!/bin/sh
+# reboot wrapper
+. /scripts/functions
+. /conf/tcos-run-functions
+
+kill_xorg
+
+clear
+ log_begin_msg "Rebooting"
+ log_end_msg 0
+
+kill_all
+
+umount_swap
+
+umount_all
+
+/lib/cmds/reboot -f
+EOF
+ chmod +x ${DESTDIR}/sbin/reboot
+
+ # poweroff script
+ cat <<EOF > ${DESTDIR}/sbin/poweroff
+#!/bin/sh
+# poweroff wrapper
+. /scripts/functions
+. /conf/tcos-run-functions
+
+kill_xorg
+clear
+ log_begin_msg "Poweroff system"
+ log_end_msg 0
+
+kill_all
+
+umount_swap
+
+umount_all
+
+/lib/cmds/poweroff -f
+EOF
+ chmod +x $DESTDIR/sbin/poweroff
+
+ stat_after "Init binaries"
+
+fi
+
diff --git a/hooks-addons/00main b/hooks-addons/00main
new file mode 100644
index 0000000..7605fa8
--- /dev/null
+++ b/hooks-addons/00main
@@ -0,0 +1,166 @@
+# 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 -q ELF ; 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 -q ELF ; 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
+
+
diff --git a/hooks-addons/00users b/hooks-addons/00users
new file mode 100644
index 0000000..a05d6e5
--- /dev/null
+++ b/hooks-addons/00users
@@ -0,0 +1,65 @@
+# Hook addon for user password stuff
+
+cpifexists /etc/login.defs /etc
+cpifexists /usr/sbin/tcospasswd /usr/sbin
+
+# the root password by default is "root"
+root_shadow="root:$(/usr/sbin/tcospasswd root):13562:0:99999:7:::"
+
+if [ "${TCOS_ROOT_PASSWD}" != "" ]; then
+ # generate shadow hash
+ root_shadow="root:$(/usr/sbin/tcospasswd ${TCOS_ROOT_PASSWD}):13562:0:99999:7:::"
+fi
+
+
+# create /etc/tcospasswd if exists tcosmonitor secret passwd
+if [ -e /etc/tcos/secrets/tcosmonitor-secret ]; then
+ secret1="$(cat /etc/tcos/secrets/tcosmonitor-secret | awk -F":" '{print $1}')"
+ secret2="$(cat /etc/tcos/secrets/tcosmonitor-secret | awk -F":" '{print $2}')"
+ secret2_passwd="$(/usr/sbin/tcospasswd $secret2)"
+ echo "$secret1:$secret2_passwd" > $DESTDIR/etc/tcospasswd
+ root_shadow="root:${secret2_passwd}:13562:0:99999:7:::"
+fi
+
+
+# create /etc/passwd /etc/shadow and /etc/group
+
+cat << EOF >> $DESTDIR/etc/passwd
+root:x:0:0:root:/root:/bin/sh
+daemon:x:1:1:daemon:/usr/sbin:/bin/sh
+bin:x:2:2:bin:/bin:/bin/sh
+sys:x:3:3:sys:/dev:/bin/sh
+lp:x:7:7:lp:/var/spool/lpd:/bin/sh
+proxy:x:13:13:proxy:/bin:/bin/sh
+nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
+sshd:x:105:65534::/var/run/sshd:/bin/false
+EOF
+
+# default password for root user is "root"
+cat << EOF >> $DESTDIR/etc/shadow
+${root_shadow}
+daemon:*:13250:0:99999:7:::
+bin:*:13250:0:99999:7:::
+sys:*:13250:0:99999:7:::
+lp:*:13250:0:99999:7:::
+nobody:*:13250:0:99999:7:::
+sshd:!:13250:0:99999:7:::
+EOF
+
+cat << EOF >> $DESTDIR/etc/group
+root:x:0:
+daemon:x:1:
+bin:x:2:
+sys:x:3:
+adm:x:4:
+tty:x:5:
+disk:x:6:
+lp:x:7:
+kmem:x:15:
+audio:x:29:pulse
+users:x:100:
+ssh:x:109:
+EOF
+
+
+
diff --git a/hooks-addons/01busybox b/hooks-addons/01busybox
new file mode 100644
index 0000000..7988b88
--- /dev/null
+++ b/hooks-addons/01busybox
@@ -0,0 +1,43 @@
+# hook addon for busybox
+
+# check for a decent version of busybox
+# ubuntu busybox-initramfs don't have some utils
+if [ -e "${TCOS_BINS}/busybox" ]; then
+ _echo " Found busybox in ${TCOS_BINS}/busybox"
+ [ -e $DESTDIR/bin/busybox ] && rm -f $DESTDIR/bin/busybox
+ cpifexists ${TCOS_BINS}/busybox /bin/
+
+elif [ $DESTDIR/bin/busybox ]; then
+ test1=$($DESTDIR/bin/busybox tftp --help 2>&1 | grep -c -i usage)
+ test2=$($DESTDIR/bin/busybox awk --help 2>&1 | grep -c -i usage)
+ test3=$($DESTDIR/bin/busybox losetup --help 2>&1 | grep -c -i usage)
+
+ if [ $test1 = 0 -o $test2 = 0 -o $test3 = 0 ]; then
+ if [ -x /bin/busybox ]; then
+ _echo " INFO: Better busybox found, replacing it..."
+ rm -f $DESTDIR/bin/busybox
+ cpifexists /bin/busybox /bin/
+ else
+ _echo "ERROR:"
+ _echo ""
+ _echo " The initramfs busybox version don't have some needed utils."
+ _echo " Please install other busybox that have awk, tftp, and losetup"
+ _echo ""
+ _echo " This TCOS image will not work."
+ _echo ""
+ fi
+ else
+ _echo " Busybox pass all tests OK"
+ fi
+
+ # check for busybox static
+ #if ldd /bin/busybox | grep -q libc; then
+ # _echo " busybox (not-static) getty and login disabled"
+ #fi
+
+
+else
+ _echo "busybox not found in initramfs yet..."
+fi
+
+
diff --git a/hooks-addons/01dhclient b/hooks-addons/01dhclient
new file mode 100644
index 0000000..48f9243
--- /dev/null
+++ b/hooks-addons/01dhclient
@@ -0,0 +1,31 @@
+# hook addon DHCLIENT
+# necessary busybox package
+
+
+# some network stuff
+touch $DESTDIR/etc/hosts.allow
+touch $DESTDIR/etc/hosts.deny
+cpifexists /etc/host.conf /etc/
+sed '/hosts:/ chosts: files dns' /etc/nsswitch.conf > $DESTDIR/etc/nsswitch.conf
+
+# put DNS server
+dns1=$(grep ^nameserver /etc/resolv.conf 2>/dev/null | grep -v "127.0.0.1" | head -1 | awk '{print $2}')
+echo "TCOS_DNS_SERVER=${dns1}" >> ${DESTDIR}/conf/tcos.conf
+
+BUSYBOX=/bin/busybox
+[ -e ${DESTDIR}/bin/busybox ] && BUSYBOX=${DESTDIR}/bin/busybox
+
+cpifexists ${TCOS_BINS}/udhcpc-script /bin/
+
+check=$(${BUSYBOX} udhcpc -O 290 2>&1| grep -c swapsrv)
+if [ -e ${TCOS_BINS}/busybox ] || [ "${check}" != "0" ]; then
+ echo " * busybox udhcpc support 'swapsrv' option" >/dev/null
+
+else
+ echo "ERROR"
+ echo ""
+ echo "NO UDHCP support, please install a recent busybox/udhcpc (>= 1:1.13.3) package."
+ echo ""
+fi
+
+
diff --git a/hooks-addons/02hex2ascii b/hooks-addons/02hex2ascii
new file mode 100644
index 0000000..36b9460
--- /dev/null
+++ b/hooks-addons/02hex2ascii
@@ -0,0 +1,8 @@
+# hex2ascii converts an hex ip into ascii format
+
+
+if [ -f /usr/lib/tcos/hex2ascii ]; then
+
+ cpifexists /usr/lib/tcos/hex2ascii /bin/
+
+fi
diff --git a/hooks-addons/03udev2 b/hooks-addons/03udev2
new file mode 100644
index 0000000..0886004
--- /dev/null
+++ b/hooks-addons/03udev2
@@ -0,0 +1,171 @@
+# copy some extra files to /lib/udev
+#
+#
+#
+
+mkdir -p $DESTDIR/lib/udev
+
+
+cpudev() {
+ if [ ! -e "$1" ]; then
+ # don't copy, orig file not exists
+ return
+ fi
+ if [ ! -e "$DESTDIR/$1" ]; then
+ # check if other script have put this file in $DESTDIR
+ cpifexists "$1" "$2"
+ fi
+}
+
+
+cpudev /lib/udev/write_cd_rules /lib/udev
+
+# DON'T COPY write_net_rules, it will hang trying to create new persistent rules !!!
+#cpudev /lib/udev/write_net_rules /lib/udev
+
+cpudev /lib/udev/udev_run_devd /lib/udev
+cpudev /lib/udev/udev_run_hotplugd /lib/udev
+cpudev /lib/udev/logger.agent /lib/udev
+
+# new for keyboard and mouse rules
+cpudev /lib/udev/input_id /lib/udev
+
+
+# new udev > 111
+cpudev /lib/udev/rule_generator.functions /lib/udev
+
+# SATA cdroms (thanks to vidal_joshur at gva dot es for patch )
+cpudev /lib/udev/cdrom_id /lib/udev
+cpudev /lib/udev/scsi_id /lib/udev
+cpudev /etc/udev/rules.d/60-symlinks.rules /etc/udev/rules.d/
+
+# ubuntu rules (create symlinks /dev/snd/*)
+cpudev /lib/udev/rules.d/40-alsa.rules /lib/udev/rules.d/
+
+
+# new udev don't have vol_id => blkid
+#/sbin/blkid -p -o udev /dev/sdb1
+cpudev /sbin/blkid /usr/bin/
+
+
+# needed by evdev driver
+cpudev /lib/udev/rules.d/60-persistent-input.rules /lib/udev/rules.d/
+cpudev /etc/udev/rules.d/60-persistent-input.rules /etc/udev/rules.d/
+
+# new in Ubuntu Lucid
+cpudev /lib/udev/rules.d/60-cdrom_id.rules /lib/udev/rules.d/
+cpudev /lib/udev/rules.d/60-persistent-alsa.rules /lib/udev/rules.d/
+cpudev /lib/udev/rules.d/78-sound-card.rules /lib/udev/rules.d/
+cpudev /lib/udev/rules.d/80-drivers.rules /lib/udev/rules.d/
+
+# new xorg+udev rules
+cpudev /lib/udev/rules.d/64-xorg-xkb.rules /lib/udev/rules.d/
+cpudev /lib/udev/rules.d/65-xorg-evdev.rules /lib/udev/rules.d/
+cpudev /lib/udev/rules.d/69-xserver-xorg-input-wacom.rules /lib/udev/rules.d/
+cpudev /lib/udev/rules.d/78-graphics-card.rules /lib/udev/rules.d/
+mkdir -p $DESTDIR/etc/default
+[ -e /etc/default/keyboard ] && cpifexists /etc/default/keyboard /etc/default/
+
+# console setup
+cpudev /lib/udev/rules.d/95-keyboard-force-release.rules /lib/udev/rules.d/
+cpudev /lib/udev/rules.d/95-keymap.rules /lib/udev/rules.d/
+cpudev /lib/udev/rules.d/85-console-setup.rules /lib/udev/rules.d/
+cpudev /lib/udev/console-setup-tty /lib/udev/
+cpudev /lib/udev/keymap /lib/udev/
+[ -d /lib/udev/keymaps/ ] && cp -ra /lib/udev/keymaps $DESTDIR/lib/udev/
+cpudev /lib/udev/findkeyboards /lib/udev/
+cpudev /lib/udev/pci-db /lib/udev/
+
+# delete not usessfull rules
+rm -f $DESTDIR/etc/udev/rules.d/024_hpmud.rules
+rm -f $DESTDIR/etc/udev/rules.d/025_libgphoto2.rules
+rm -f $DESTDIR/etc/udev/rules.d/025_logitechmouse.rules
+rm -f $DESTDIR/etc/udev/rules.d/45-hpdjconsole.rules
+rm -f $DESTDIR/etc/udev/rules.d/45-hplip.rules
+rm -f $DESTDIR/etc/udev/rules.d/55-hpmud.rules
+rm -f $DESTDIR/etc/udev/rules.d/60-persistent-v4l.rules
+rm -f $DESTDIR/etc/udev/rules.d/70-persistent-cd.rules
+rm -f $DESTDIR/etc/udev/rules.d/70-persistent-net.rules
+rm -f $DESTDIR/etc/udev/rules.d/85-pcmcia.rules
+rm -f $DESTDIR/etc/udev/rules.d/90-hal.rules
+rm -f $DESTDIR/etc/udev/rules.d/91-permissions.rules # ??????
+rm -f $DESTDIR/etc/udev/rules.d/libmtp7.rules
+rm -f $DESTDIR/etc/udev/rules.d/z60_hdparm.rules
+rm -f $DESTDIR/etc/udev/rules.d/z60_libccid.rules
+rm -f $DESTDIR/etc/udev/rules.d/z60_libfprint0.rules
+rm -f $DESTDIR/etc/udev/rules.d/z60_libpisock9.rules
+rm -f $DESTDIR/etc/udev/rules.d/z60_libsane-extras.rules
+rm -f $DESTDIR/etc/udev/rules.d/z60_libsane.rules
+rm -f $DESTDIR/etc/udev/rules.d/z60_virtualbox-ose.rules
+
+# from idefix (sid)
+rm -f $DESTDIR/etc/udev/rules.d/65_dmsetup.rules
+
+# from dartacan (etch)
+rm -f $DESTDIR/etc/udev/rules.d/020_permissions.rules
+rm -f $DESTDIR/etc/udev/rules.d/z25_persistent-cd.rules
+rm -f $DESTDIR/etc/udev/rules.d/z25_persistent-net.rules
+
+# from max40 (Ubuntu hardy)
+rm -f $DESTDIR/etc/udev/rules.d/40-basic-permissions.rules
+rm -f $DESTDIR/etc/udev/rules.d/40-permissions.rules ### ????
+rm -f $DESTDIR/etc/udev/rules.d/45-fuse.rules
+rm -f $DESTDIR/etc/udev/rules.d/45-legousbtower.rules
+rm -f $DESTDIR/etc/udev/rules.d/45-libmtp7.rules
+rm -f $DESTDIR/etc/udev/rules.d/45-libnjb.rules
+rm -f $DESTDIR/etc/udev/rules.d/45-libgphoto2.rules
+rm -f $DESTDIR/etc/udev/rules.d/50-huawei.rules
+rm -f $DESTDIR/etc/udev/rules.d/50-iscan.rules
+rm -f $DESTDIR/etc/udev/rules.d/50-libpisock9.rules
+rm -f $DESTDIR/etc/udev/rules.d/55-hpmud.rules
+rm -f $DESTDIR/etc/udev/rules.d/60-symlinks.rules
+rm -f $DESTDIR/etc/udev/rules.d/62-bluez-hid2hci.rules
+rm -f $DESTDIR/etc/udev/rules.d/65-dmsetup.rules
+rm -f $DESTDIR/etc/udev/rules.d/70-persistent-cd.rules
+rm -f $DESTDIR/etc/udev/rules.d/70-persistent-net.rules
+##rm -f $DESTDIR/etc/udev/rules.d/85-alsa.rules #????
+rm -f $DESTDIR/etc/udev/rules.d/85-brltty.rules
+rm -f $DESTDIR/etc/udev/rules.d/85-hdparm.rules
+rm -f $DESTDIR/etc/udev/rules.d/85-hplj10xx.rules
+rm -f $DESTDIR/etc/udev/rules.d/85-pcmcia.rules
+rm -f $DESTDIR/etc/udev/rules.d/95-hal.rules
+rm -f $DESTDIR/etc/udev/rules.d/kino.rules
+
+# some deprecated and no used rules in my laptop
+rm -f $DESTDIR/etc/udev/rules.d/56-hp*
+rm -f $DESTDIR/etc/udev/rules.d/85-rt*
+rm -f $DESTDIR/etc/udev/rules.d/85-tosh*
+rm -f $DESTDIR/etc/udev/rules.d/usb_mode*
+rm -f $DESTDIR/etc/udev/rules.d/z60-hplip*
+
+
+
+# udev rules are now in /lib/udev/rules.d/
+rm -f $DESTDIR/lib/udev/rules.d/90-hal.rules
+rm -f $DESTDIR/lib/udev/rules.d/91-permissions.rules
+rm -f $DESTDIR/lib/udev/rules.d/*bluez*
+rm -f $DESTDIR/lib/udev/rules.d/*libmtp*
+rm -f $DESTDIR/lib/udev/rules.d/*libpi*
+rm -f $DESTDIR/lib/udev/rules.d/*libsane*
+rm -f $DESTDIR/lib/udev/rules.d/*v4l*
+rm -f $DESTDIR/lib/udev/rules.d/*-dm.*
+
+
+# modify udev script to not wait in init-premount (wait in tcos-top/01busybox)
+#sed -i -e '/udevadm trigger/s/trigger/trigger --subsystem-match=net/g' $DESTDIR/scripts/init-premount/udev
+#sed -i -e '/udevadm settle/s/udevadm/#udevadm/g' $DESTDIR/scripts/init-premount/udev
+#cat $DESTDIR/scripts/init-premount/udev
+
+
+# modify /init script to not call depmod
+sed -i -e '/depmod/s/depmod/#depmod/g' $DESTDIR/init
+
+
+# remove some init scripts
+rm -f ${DESTDIR}/scripts/init-premount/devpts
+rm -f ${DESTDIR}/scripts/init-bottom/dropbear
+rm -f ${DESTDIR}/scripts/init-premount/dropbear
+
+if [ "${BOOT}" != "tcos-nfs" ]; then
+ rm -f ${DESTDIR}/scripts/init-bottom/udev
+fi
diff --git a/hooks-addons/03wireless b/hooks-addons/03wireless
new file mode 100644
index 0000000..3403830
--- /dev/null
+++ b/hooks-addons/03wireless
@@ -0,0 +1,189 @@
+# hook addon for wireless
+# need wireless-tools (firmware....)
+
+
+if [ ! $TCOS_WIRELESS ]; then
+ _verbose "(03wireless) TCOS_WIRELESS disabled"
+else
+ stat_before
+
+ # copy wireless utils (some aren't necesary)
+ cpifexists /sbin/iwconfig /sbin/
+ cpifexists /sbin/iwevent /sbin/
+ cpifexists /sbin/iwgetid /sbin/
+ cpifexists /sbin/iwlist /sbin/
+ cpifexists /sbin/iwpriv /sbin/
+ cpifexists /sbin/iwspy /sbin/
+
+ # copy udev firmware agent
+ mkdir -p $DESTDIR/lib/udev
+ cp -ra /lib/udev/firmware* $DESTDIR/lib/udev/ >/dev/null 2>&1
+
+ if [ -d /lib/firmware/${TCOS_KERNEL} ];then
+ firmwaredir="/lib/firmware/${TCOS_KERNEL}"
+ mkdir -p "${DESTDIR}${firmwaredir}"
+ else
+ firmwaredir="/lib/firmware"
+ mkdir -p "${DESTDIR}${firmwaredir}"
+ fi
+
+ # generic modules
+
+ manual_add_modules arc4
+ manual_add_modules ecb
+ manual_add_modules michael_mic
+ manual_add_modules ieee80211
+ #manual_add_modules rc80211_simple
+ manual_add_modules mac80211
+ manual_add_modules ieee80211_crypt
+ manual_add_modules ieee80211softmac
+ manual_add_modules ieee80211_crypt_tkip
+ manual_add_modules ieee80211_crypt_wep
+ manual_add_modules ieee80211_crypt_ccmp
+
+ # copy kernel modules
+ for mod in $TCOS_WIRELESS_MODS; do
+
+ manual_add_modules $mod
+ if [ "$mod" = "ipw2200" ]; then
+ _echo " WIFI: Copying firmware of ipw2200"
+ cp -ra ${firmwaredir}/ipw2200* ${DESTDIR}${firmwaredir}
+
+ elif [ "$mod" = "ipw2100" ]; then
+ _echo " WIFI: Copying firmware of ipw2100"
+ cp -ra ${firmwaredir}/ipw2100* ${DESTDIR}${firmwaredir}
+
+ elif [ "$mod" = "madwifi" ]; then
+ _echo " WIFI: Copying madwifi modules"
+ #ath-pci ath-hal wlan_tkip wlan_scan_sta ath-hal
+ manual_add_modules ath-pci
+ manual_add_modules ath-hal
+ manual_add_modules wlan-tkip
+ manual_add_modules wlan-scan-sta
+
+ elif [ "$mod" = "ndiswrapper" ]; then
+ _echo " WIFI: ndiswrapper not supported (perl based)"
+
+
+ elif [ "$mod" = "zd1211" ]; then
+ _echo " WIFI: Copying Zydas modules and firmware"
+ manual_add_modules zd1211rw
+ # firmware
+ #mkdir -p $DESTDIR/lib/firmware/
+ cp -ra ${firmwaredir}/zd1211/ ${DESTDIR}${firmwaredir}
+ cat << EOF > $DESTDIR/scripts/tcos-top/02zydas_firmware
+#!/bin/sh
+if [ "\$1" = "prereqs" ]; then
+ exit 0
+fi
+
+mkdir -p /usr/lib/hotplug/firmware/
+ln -s ${firmwaredir}/zd1211/zd1211_ub /usr/lib/hotplug/firmware/zd1211-WS11Ub.fw
+ln -s ${firmwaredir}/zd1211/zd1211_uph /usr/lib/hotplug/firmware/zd1211-WS11UPh.fw
+ln -s ${firmwaredir}/zd1211/zd1211_uphm /usr/lib/hotplug/firmware/zd1211-WS11UPhm.fw
+ln -s ${firmwaredir}/zd1211/zd1211_uphr /usr/lib/hotplug/firmware/zd1211-WS11UPhR.fw
+ln -s ${firmwaredir}/zd1211/zd1211_ur /usr/lib/hotplug/firmware/zd1211-WS11Ur.fw
+
+EOF
+ chmod +x $DESTDIR/scripts/tcos-top/02zydas_firmware
+
+ elif [ "$mod" = "rt61" -o "$mod" = "rt2561" -o "$mod" = "rt61pci" ]; then
+ _echo " WIFI: Copying firmware of rt61/2561"
+ cp -ra ${firmwaredir}/rt2* ${DESTDIR}${firmwaredir}
+
+ elif [ "$mod" = "rt73" -o "$mod" = "rt73usb" ]; then
+ _echo " WIFI: Copying firmware of rt73"
+ cp -ra ${firmwaredir}/rt7* ${DESTDIR}${firmwaredir}
+
+ elif [ "$mod" = "bcm43xx" -o "$mod" = "broadcom" ]; then
+ _echo " WIFI: Copying firmware of bcm43xx"
+ [ -e /lib/firmware/bcm43* ] && cp -ra /lib/firmware/bcm43* ${DESTDIR}/lib/firmware
+ cp -ra ${firmwaredir}/bcm43* ${DESTDIR}${firmwaredir}
+
+ else
+ _echo " WIFI: Trying to copy unknow firmware"
+ cp -ra ${firmwaredir}/$mod* ${DESTDIR}${firmwaredir} 2>/dev/null
+ fi # end of if module
+
+ done # end of modules for loop
+
+ if [ "$TCOS_WIRELESS_ENC" = "WEP" ]; then
+ _echo " DEBUG: using WEP..."
+ if [ ! $TCOS_WIRELESS_KEY ]; then
+ _echo ""
+ _echo " WARNING:"
+ _echo " Configured Wireless with WEP encription, but TCOS_WIRELESS_KEY is empty"
+ _echo " Put your wireless key into this var in a supported format (HEX or ASCII)."
+ _echo " See: man iwconfig (section key)"
+ _echo ""
+ fi
+ fi
+
+ if [ "$TCOS_WIRELESS_ENC" = "WPA" ]; then
+ cpifexists /sbin/wpa_action /sbin/
+ cpifexists /sbin/wpa_cli /sbin/
+ cpifexists /sbin/wpa_supplicant /sbin/
+ cpifexists /usr/bin/wpa_passphrase /sbin/
+ # need linked libs in /lib not /usr/lib
+ for lib in $(_ldd /sbin/wpa_supplicant /sbin/wpa_action /sbin/wpa_cli /usr/bin/wpa_passphrase | awk '{print $3}' |grep ^/); do
+ newlib=$(echo $lib | sed s/"\/i686\/cmov"//g | sed s/"\/tls"//g )
+ #_echo " DEBUG: WPA: copying lib=$lib newlib=$newlib"
+ if [ -e $newlib ]; then
+ if [ ! -e $DESTDIR/lib/$(basename $lib) ]; then
+ cp $newlib $DESTDIR/lib/
+ #else
+ # _echo " DEBUG: WPA: $newlib is in image, not copy."
+ fi
+ else
+ _echo " DEBUG: WPA: ### ERROR ### $newlib or $lib not found !!!!"
+ fi
+ done
+
+
+ copydir /etc/wpa_supplicant /etc/
+cat << EOF > $DESTDIR/sbin/start-wpa.sh
+#!/bin/sh
+
+. /scripts/functions
+. /conf/tcos.conf
+. /conf/tcos-run-functions
+
+TCOS_NET_WIFI_ESSID=\$(read_cmdline_var "essid" "")
+
+TCOS_WIRELESS_DEV=\$1
+if [ "\$TCOS_WIRELESS_DEV" = "" ]; then
+ echo "Error, need a wireless network device name"
+ echo " example: \$0 ath0"
+ echo " example: \$0 wlan0"
+fi
+
+WPA_CONF=\$(ls /etc/wpa_supplicant/*conf 2>/dev/null)
+if [ "\$WPA_CONF" = "" ]; then
+ psk=\$(wpa_passphrase "\${TCOS_NET_WIFI_ESSID}" "\${TCOS_WIRELESS_KEY}" | sed 's/[[:blank:]]//g' | awk -F"=" '/^psk=/ {print \$2}')
+
+ WPA_CONF=/etc/wpa_supplicant/wpa_supplicant.conf
+ cat << EOC > \$WPA_CONF
+ctrl_interface=/var/run/wpa_supplicant
+network={
+ssid="\${TCOS_NET_WIFI_ESSID}"
+proto=\${TCOS_WIRELESS_ENC}
+key_mgmt=WPA-PSK
+psk=\$psk
+}
+EOC
+
+fi
+
+PID=/var/run/wpa_supplicant.\${TCOS_WIRELESS_DEV}.pid
+#WPA_RUN=/var/run/wpa_supplicant
+
+wpa_supplicant -B -P\$PID -i\${TCOS_WIRELESS_DEV} -c\${WPA_CONF}
+
+EOF
+ chmod +x $DESTDIR/sbin/start-wpa.sh
+ fi
+
+ stat_after "Wireless support"
+fi
+
+
diff --git a/hooks-addons/04debug b/hooks-addons/04debug
new file mode 100644
index 0000000..c734da9
--- /dev/null
+++ b/hooks-addons/04debug
@@ -0,0 +1,43 @@
+# hooks addon DEBUG support
+# need strace, lsmod and ldd wrapper
+
+
+
+# for debug purposes
+if [ ! $TCOS_DEBUG_TOOLS ]; then
+ _verbose "(04debug) TCOS_DEBUG_TOOLS disabled"
+else
+ stat_before
+
+ mkdir -p $DESTDIR/lib/terminfo/l/
+ mkdir -p $DESTDIR/lib/terminfo/x/
+ cp -a /lib/terminfo/l/linux $DESTDIR/lib/terminfo/l/
+ cp -a /lib/terminfo/x/xterm* $DESTDIR/lib/terminfo/x/
+
+
+ [ -e /usr/sbin/iftop ] && cpifexists /usr/sbin/iftop /usr/bin/
+ cpifexists /bin/lsmod /usr/bin/
+ [ -e /usr/bin/strace ] && cpifexists /usr/bin/strace /usr/bin/
+ cpifexists /sbin/mkfs /sbin/
+ cpifexists /sbin/mkfs.vfat /sbin/
+ cpifexists /sbin/mkfs.ext3 /sbin/
+
+
+ stat_after "Debug tools"
+fi # end of TCOS_DEBUG_TOOLS
+
+
+cat <<EOF > $DESTDIR/bin/ldd
+#!/bin/sh
+file=\$1
+if [ ! -f /\$file ]; then
+ file=\$(which \$file)
+fi
+if [ ! -e \${file} ]; then
+ echo "\${file} not found"
+ exit 1
+fi
+[ -e /lib/ld-linux.so.2 ] && /lib/ld-linux.so.2 --list \$file
+[ -e /lib64/ld-linux-x86-64.so.2 ] && /lib64/ld-linux-x86-64.so.2 --list \$file
+EOF
+chmod +x $DESTDIR/bin/ldd
diff --git a/hooks-addons/05compcache b/hooks-addons/05compcache
new file mode 100644
index 0000000..586cc6a
--- /dev/null
+++ b/hooks-addons/05compcache
@@ -0,0 +1,69 @@
+# 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
+
+# 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 modprobe --list zram | grep -q zram; then
+ modprobe zram num_devices=1
+ 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 disksize_kb="\$kbytes"
+fi
+
+EOF
+
+ chmod 0755 $DESTDIR/scripts/init-top/compcache
+
+ stat_after "Compcache support ($TCOS_COMPCACHE_PERCENT%)"
+fi
diff --git a/hooks-addons/06funionfs b/hooks-addons/06funionfs
new file mode 100644
index 0000000..06829fb
--- /dev/null
+++ b/hooks-addons/06funionfs
@@ -0,0 +1,12 @@
+# hook-addon for funionfs
+#
+# not support / unionfs at this moment, disabled by default
+#
+
+#if [ -e /usr/bin/funionfs ]; then
+#
+# cpifexists /usr/bin/funionfs /usr/bin/
+# manual_add_modules fuse
+# echo "fuse" >> $DESTDIR/etc/modules
+#
+#fi
diff --git a/hooks-addons/06nbd_filesystem b/hooks-addons/06nbd_filesystem
new file mode 100644
index 0000000..11b630e
--- /dev/null
+++ b/hooks-addons/06nbd_filesystem
@@ -0,0 +1,11 @@
+
+
+#if [ -e /sbin/nbd-client ]; then
+#
+# stat_before
+# manual_add_modules nbd
+# cpifexists /sbin/nbd-client /sbin
+# stat_after "NBD client"
+#
+#
+#fi
diff --git a/hooks-addons/07cdaudio b/hooks-addons/07cdaudio
new file mode 100644
index 0000000..9eedf07
--- /dev/null
+++ b/hooks-addons/07cdaudio
@@ -0,0 +1,17 @@
+# hooks addon to read cdaudio
+# need cdparanoia
+
+
+if [ $TCOS_SOUND ] && [ -x /usr/bin/cdparanoia ]; then
+
+ stat_before
+
+ cpifexists /usr/bin/cdparanoia /usr/bin
+ cpifexists ${TCOS_BINS}/cd_type /usr/bin
+ manual_add_modules cdfs
+
+ stat_after "CD-AUDIO support"
+else
+ _verbose "(07cdaudio) TCOS_SOUND && cdparanoia disabled"
+fi
+
diff --git a/hooks-addons/08pcimodules b/hooks-addons/08pcimodules
new file mode 100644
index 0000000..fc50d76
--- /dev/null
+++ b/hooks-addons/08pcimodules
@@ -0,0 +1,8 @@
+# hook addon to load pcimodules
+
+
+# need pcimodules
+cpifexists /usr/bin/pcimodules /bin/
+mv -f $DESTDIR/usr/lib/libz.so.1 $DESTDIR/lib/libz.so.1 2>/dev/null
+mv -f $DESTDIR/usr/lib/libpci.so.3 $DESTDIR/lib/libpci.so.3 2>/dev/null
+mv -f $DESTDIR/$LIB_MULTIARCH/libpci.so.3 $DESTDIR/lib/libpci.so.3 2>/dev/null
diff --git a/hooks-addons/09printer b/hooks-addons/09printer
new file mode 100644
index 0000000..0725239
--- /dev/null
+++ b/hooks-addons/09printer
@@ -0,0 +1,37 @@
+# hooks addon for printer support
+
+add_lp_modules() {
+ force_load parport_pc
+ force_load usblp
+ force_load lp
+}
+
+
+
+
+if [ ! $TCOS_PRINTER ] ;then
+ _verbose "(09printer) TCOS_PRINTER disabled"
+else
+ stat_before
+
+ if [ -e /usr/sbin/p910nd ]; then
+ #/var/run/p9100d.pid, /var/lock/subsys/p9100d, /etc/hosts.allow, /etc/hosts.deny
+ mkdir -p $DESTDIR/var/run
+ mkdir -p $DESTDIR/var/lock/subsys
+ cpifexists /usr/sbin/p910nd /usr/bin/
+ stat_after "Print server [p910nd]"
+
+ else
+ _echo "WARNING:"
+ _echo ""
+ _echo " TCOS_PRINTER enabled but not found p910nd package"
+ _echo " Please install p910nd, or disable TCOS_PRINTER support"
+ _echo ""
+ _echo ""
+ fi
+
+ add_lp_modules
+
+
+fi
+# end of TCOS_PRINTER
diff --git a/hooks-addons/10hwclock b/hooks-addons/10hwclock
new file mode 100644
index 0000000..e7801c2
--- /dev/null
+++ b/hooks-addons/10hwclock
@@ -0,0 +1,7 @@
+# addon to set hwclock
+
+stat_before
+
+cpifexists /sbin/hwclock /usr/bin/
+
+stat_after "HWclock"
diff --git a/hooks-addons/10ssl_tunnel b/hooks-addons/10ssl_tunnel
new file mode 100644
index 0000000..51e4466
--- /dev/null
+++ b/hooks-addons/10ssl_tunnel
@@ -0,0 +1,100 @@
+# hooks addon for stunnel4
+# need stunnel4 package
+
+if [ ! $TCOS_ENABLE_SSL ]; then
+ _verbose "(10ssl_tunnel) TCOS_ENABLE_SSL disabled"
+else
+ stat_before
+
+ [ -x /usr/bin/stunnel4 ] && cpifexists /usr/bin/stunnel4 /usr/bin/
+ [ -x /usr/sbin/stunnel4 ] && cpifexists /usr/sbin/stunnel4 /usr/bin/
+ [ -x /usr/bin/openssl ] && cpifexists /usr/bin/openssl /usr/bin/
+
+ mkdir -p $DESTDIR/etc/stunnel
+ mkdir -p $DESTDIR/usr/lib/ssl
+ cpifexists /usr/lib/ssl/openssl.cnf /usr/lib/ssl
+ #cpifexists /usr/lib/libcrypto.so.0.9.8 /usr/lib/
+ #cpifexists /usr/lib/libssl.so.0.9.8 /usr/lib/
+
+ [ -e ${DESTDIR}/usr/lib/i686/cmov/libcrypto.so.0.9.8 ] && mv -f ${DESTDIR}/usr/lib/i686/cmov/libcrypto.so.0.9.8 ${DESTDIR}/usr/lib/libcrypto.so.0.9.8 2>/dev/null
+ [ -e ${DESTDIR}/usr/lib/i686/cmov/libssl.so.0.9.8 ] && mv -f ${DESTDIR}/usr/lib/i686/cmov/libssl.so.0.9.8 ${DESTDIR}/usr/lib/libssl.so.0.9.8 2>/dev/null
+
+cat << EOF > ${DESTDIR}/etc/stunnel/stunnel.conf
+cert = /etc/stunnel/tcos.pem
+sslVersion=all
+foreground=yes
+syslog=no
+session=1
+delay=no
+chroot=/var/lib/stunnel4/
+setuid=root
+setgid=root
+pid=/stunnel4.pid
+socket=l:TCP_NODELAY=1
+socket=r:TCP_NODELAY=1
+;socket=a:SO_REUSEADDR=0
+;compression=rle
+;debug=7
+output=/var/log/stunnel.log
+pty=no
+;transparent=yes
+;verify=1
+
+[tcosxmlrpc]
+accept=8999
+connect=8998
+TIMEOUTclose=0
+TIMEOUTconnect=2
+TIMEOUTidle=2
+EOF
+
+ #if [ -e /etc/tcos/ssl/tcos-custom.pem ]; then
+ # cp /etc/tcos/ssl/tcos-custom.pem ${DESTDIR}/etc/stunnel/tcos.pem
+ #else
+ # cp /etc/tcos/ssl/tcos.pem ${DESTDIR}/etc/stunnel/tcos.pem
+ #fi
+ #chmod 600 $DESTDIR/etc/stunnel/tcos.pem
+ mkdir -p $DESTDIR/var/lib/stunnel4/
+
+
+ cat << EOF > ${DESTDIR}/scripts/tcos-bottom/60stunnel
+#!/bin/sh
+#
+
+# new header not using prereqs
+if [ "\$1" = "prereqs" ]; then
+ echo ""
+ exit 0
+fi
+
+
+quiet=n
+
+. /scripts/functions
+. /conf/tcos.conf
+. /conf/tcos-run-functions
+
+nosslxmlrpc=\$(read_cmdline_var "nosslxmlrpc" "0")
+if [ "\${nosslxmlrpc}" = "1" ]; then
+ _log "SSL XMLRPC disabled from cmdline"
+ exit 0
+fi
+
+ [ -e /etc/stunnel/tcos.pem ] && rm -f /etc/stunnel/tcos.pem 2>/dev/null
+ openssl req -new -x509 -nodes -days 365 -out /etc/stunnel/tcos.pem -keyout /etc/stunnel/tcos.pem -subj "/C=/ST=/L=/CN=localhost/emailAddress=root@localhost" 2>/dev/null
+ dd if=/dev/urandom of=/tmp/temp_file_ssl count=2 2>/dev/null
+ openssl dhparam -rand /tmp/temp_file_ssl 256 >> /etc/stunnel/tcos.pem 2>/dev/null
+ chmod 600 /etc/stunnel/tcos.pem 2>/dev/null
+ rm -f /tmp/temp_file_ssl 2>/dev/null
+
+ stunnel4 >/dev/null 2>&1 &
+exit 0
+
+EOF
+
+ chmod +x ${DESTDIR}/scripts/tcos-bottom/60stunnel
+
+ stat_after "SSL secure XMLRPC connection"
+
+fi # end of TCOS_ENABLE_SSL
+
diff --git a/hooks-addons/12getty b/hooks-addons/12getty
new file mode 100644
index 0000000..dfd1580
--- /dev/null
+++ b/hooks-addons/12getty
@@ -0,0 +1,47 @@
+# getty console
+
+# use fgetty if found
+#/sbin/fgetty
+#/bin/fgetty-login
+#/bin/fgetty-login2
+#/bin/checkpassword
+
+if [ -e /sbin/fgetty ]; then
+ stat_before
+ cpifexists /sbin/fgetty /sbin/
+ cpifexists /bin/fgetty-login /bin/
+ cpifexists /bin/fgetty-login2 /bin/
+ cpifexists /bin/checkpassword /bin/
+
+ cat << EOF > $DESTDIR/bin/login
+#!/bin/sh
+fgetty-login \$@
+EOF
+ chmod +x $DESTDIR/bin/login
+
+ cat << EOF > $DESTDIR/sbin/rungetty
+#!/bin/sh
+
+
+
+VEL=38400
+CONSOLE_NUMBER=\$1
+
+if [ "\${CONSOLE_NUMBER}" = "" ]; then
+ echo "Error: need a console name (example tty1)"
+ exit 1
+fi
+
+while [ 1 ]; do
+ fgetty \$CONSOLE_NUMBER --noclear >/dev/null 2>&1
+ sleep 2
+done
+
+
+EOF
+ chmod +x $DESTDIR/sbin/rungetty
+
+
+ stat_after "fgetty (login)"
+fi # end of -e /sbin/fgetty
+
diff --git a/hooks-addons/13kbmap b/hooks-addons/13kbmap
new file mode 100644
index 0000000..7880383
--- /dev/null
+++ b/hooks-addons/13kbmap
@@ -0,0 +1,31 @@
+# hook addon for keymap
+
+if [ -e $DESTDIR/bin/loadkeys ]; then
+ if [ -e $DESTDIR/etc/console/boottime.kmap.gz ] || [ -e /etc/console-setup/cached.kmap.gz ] ; then
+ # don't copy again if exists
+ _verbose "(13kbmap) No copy keymaps again"
+ fi
+else
+
+
+ # server kbmap
+ cpifexists /bin/loadkeys /bin
+
+ if [ -f /etc/console/boottime.kmap.gz ]; then
+ mkdir -p $DESTDIR/etc/console
+ cp -ra /etc/console/boottime.kmap.gz $DESTDIR/etc/console
+ fi
+
+ # for ubuntu
+ if [ -f /etc/console-setup/boottime.kmap.gz ]; then
+ mkdir -p $DESTDIR/etc/console
+ cp -ra /etc/console-setup/boottime.kmap.gz $DESTDIR/etc/console
+ fi
+
+ # for new console-setup
+ if [ -f /etc/console-setup/cached.kmap.gz ]; then
+ mkdir -p $DESTDIR/etc/console-setup
+ cp -ra /etc/console-setup/cached.kmap.gz $DESTDIR/etc/console-setup
+ fi
+
+fi
diff --git a/hooks-addons/14ssh b/hooks-addons/14ssh
new file mode 100644
index 0000000..f47e48e
--- /dev/null
+++ b/hooks-addons/14ssh
@@ -0,0 +1,35 @@
+# hooks addon to have a SSH daemon in terminal
+# need dropbear SSH package
+
+
+
+if [ ! $TCOS_SSH ] ;then
+ _verbose "(14ssh) TCOS_SSH disabled"
+else
+ stat_before
+ if [ ! -d /usr/share/doc/dropbear ]; then
+ echo "WARNING"
+ echo ""
+ echo "Please install dropbear package or disable SSH support."
+ echo " => apt-get install dropbear"
+ echo ""
+ else
+ mkdir -p $DESTDIR/etc
+ mkdir -p $DESTDIR/usr/lib/dropbear
+ mkdir -p $DESTDIR/var/log/dropbear
+ mkdir -p $DESTDIR/var/run/dropbear
+
+ copydir /etc/dropbear/ /etc/
+ rm -f $DESTDIR/etc/dropbear/supervise
+ rm -f $DESTDIR/etc/dropbear/log/supervise
+ rm -f $DESTDIR/etc/dropbear/log/main
+
+ cpifexists /usr/sbin/dropbear /usr/bin/ # ssh server
+ cpifexists /usr/bin/dbclient /usr/bin/ # ssh client ( no have ssh -X support )
+
+ cpifexists /usr/lib/dropbear/dropbearconvert /usr/lib/dropbear/
+
+ fi
+ stat_after "Dropbear ssh server"
+
+fi # end of TCOS_SSH
diff --git a/hooks-addons/15inetd b/hooks-addons/15inetd
new file mode 100644
index 0000000..d1ed2c1
--- /dev/null
+++ b/hooks-addons/15inetd
@@ -0,0 +1,18 @@
+# hooks addon of inetd
+# need inetd package
+
+if [ ! $TCOS_INETD ]; then
+ _verbose "(15inetd) TCOS_INETD disabled"
+else
+ stat_before
+ # inetd and telnet
+ #copy_exec /usr/sbin/in.telnetd /usr/bin
+ #copy_exec /usr/bin/telnet /usr/bin
+
+ cpifexists /usr/sbin/tcpd /usr/bin/
+ cpifexists /usr/sbin/inetd /usr/bin/
+
+ #echo "telnet stream tcp nowait root /sbin/tcpd telnetd" > $DESTDIR/etc/inetd.conf
+ #copy_exec /usr/lib/telnetlogin /usr/lib/
+ stat_after "Inetd daemon"
+fi # end of TCOS_INETD
diff --git a/hooks-addons/16dbus-avahi b/hooks-addons/16dbus-avahi
new file mode 100644
index 0000000..2d68543
--- /dev/null
+++ b/hooks-addons/16dbus-avahi
@@ -0,0 +1,108 @@
+# hook to include DBus/avahi
+# need dbus,dbus-x11,avahi-daemon packages
+
+if [ -n "$TCOS_DBUS" ]; then
+ stat_before
+
+ mkdir -p $DESTDIR/usr/lib/dbus-1.0
+ mkdir -p $DESTDIR/etc/dbus-1/system.d
+ mkdir -p $DESTDIR/etc/dbus-1/session.d
+
+ cpifexists $(which dbus-daemon) /usr/bin/
+ cpifexists $(which dbus-uuidgen) /usr/bin/
+ cpifexists /usr/bin/dbus-launch /usr/bin/
+
+ cpifexists /etc/dbus-1/system.conf /etc/dbus-1/
+ cpifexists /etc/dbus-1/session.conf /etc/dbus-1/
+
+ if [ -f /etc/dbus-1/system.d/pulseaudio-system.conf ]; then
+ cpifexists /etc/dbus-1/system.d/pulseaudio-system.conf /etc/dbus-1/system.d/
+ fi
+
+ cat << EOF >> $DESTDIR/etc/passwd
+messagebus:x:104:107::/var/run/dbus:/bin/false
+avahi:x:106:113:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false
+EOF
+
+ cat << EOF >> $DESTDIR/etc/shadow
+messagebus:*:14994:0:99999:7:::
+avahi:*:14994:0:99999:7:::
+EOF
+
+ cat << EOF >> $DESTDIR/etc/group
+messagebus:x:107:
+netdev:x:111:
+avahi:x:113:
+EOF
+
+ cat << EOF > $DESTDIR/scripts/tcos-bottom/15dbus-avahi
+#!/bin/sh
+if [ "\$1" = "prereqs" ]; then
+ exit 0
+fi
+
+mkdir -p /var/run/dbus /var/lib/dbus
+
+mkdir -p /var/run/avahi-daemon
+chown avahi:avahi /var/run/avahi-daemon
+chmod 755 /var/run/avahi-daemon
+chown messagebus:messagebus /var/lib/dbus /var/run/dbus
+
+dbus-uuidgen > /var/lib/dbus/machine-id
+
+start-stop-daemon --start --quiet --pidfile /var/run/dbus/dbus.pid \
+ --user messagebus --exec /usr/bin/dbus-daemon -- --system
+
+[ -x /usr/sbin/avahi-daemon ] && avahi-daemon --no-drop-root -D
+
+EOF
+
+ chmod +x $DESTDIR/scripts/tcos-bottom/15dbus-avahi
+
+ stat_after "DBus-Avahi"
+fi # end of TCOS_DBUS
+
+###############################################################################
+
+if [ -n "$TCOS_AVAHI" ]; then
+
+ # avahi-utils avahi-daemon
+ cpifexists /usr/sbin/avahi-daemon /usr/bin/
+ mkdir -p $DESTDIR/var/run/avahi-daemon
+ mkdir -p $DESTDIR/etc/avahi/services
+ cpifexists /etc/avahi/avahi-daemon.conf /etc/avahi
+ cat << EOF > $DESTDIR/etc/nsswitch.conf
+ passwd: compat
+ group: compat
+ shadow: compat
+ hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
+ networks: files
+ protocols: db files
+ services: db files
+ ethers: db files
+ rpc: db files
+ netgroup: nis
+ EOF
+
+ cpifexists /etc/dbus-1/system.d/avahi-dbus.conf /etc/dbus-1/system.d/
+
+cat << EOF > $DESTDIR/etc/avahi/services/tcos.service
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
+
+<service-group>
+ <name replace-wildcards="yes">tcos-%h</name>
+ <service>
+ <type>_workstation._tcp</type>
+ </service>
+
+ <service>
+ <type>_http._tcp</type>
+ <port>8998</port>
+ </service>
+</service-group>
+EOF
+
+stat_after "Avahi"
+
+fi # end of TCOS_AVAHI
diff --git a/hooks-addons/17acpid b/hooks-addons/17acpid
new file mode 100644
index 0000000..3bc1837
--- /dev/null
+++ b/hooks-addons/17acpid
@@ -0,0 +1,29 @@
+# hooks addon of acpid
+
+if [ ! $TCOS_ACPID ]; then
+ _verbose "(17acpi) TCOS_ACPI disabled"
+else
+ stat_before
+
+ manual_add_modules button
+ cpifexists /usr/sbin/acpid /usr/sbin/
+
+ mkdir -p ${DESTDIR}/etc/acpi
+ mkdir -p ${DESTDIR}/var/run
+
+cat << EOF > ${DESTDIR}/sbin/startacpid
+#!/bin/sh
+
+modprobe button
+/usr/sbin/acpid -c /etc/acpi
+EOF
+chmod +x ${DESTDIR}/sbin/startacpid
+
+cat << EOF > ${DESTDIR}/etc/acpi/button_event
+event=button[ /]power
+action=/sbin/poweroff
+EOF
+
+ stat_after "ACPI daemon"
+
+fi # end of TCOS_ACPID
diff --git a/hooks-addons/18openvpn b/hooks-addons/18openvpn
new file mode 100644
index 0000000..b55f0ef
--- /dev/null
+++ b/hooks-addons/18openvpn
@@ -0,0 +1,84 @@
+# hook to include openvpn
+# need openvpn
+
+if [ -n "$TCOS_OPENVPN" ] && [ ! -d /var/lib/tcos/openvpn/keys ] ; then
+ _echo " TCOS_OPENVPN enabled but no keys"
+ _echo ""
+ _echo " Please run 'tcos-init-openvpn' as root user"
+ _echo ""
+
+elif [ -n "$TCOS_OPENVPN" ] && [ -d /var/lib/tcos/openvpn/keys ]; then
+
+stat_before
+
+tcos_manual_add_modules tun
+
+cpifexists /usr/sbin/openvpn /usr/bin/
+mkdir -p $DESTDIR/usr/share/openvpn
+cpifexists /var/lib/tcos/openvpn/keys/ca.crt /usr/share/openvpn/
+cpifexists /var/lib/tcos/openvpn/keys/client.key /usr/share/openvpn/
+cpifexists /var/lib/tcos/openvpn/keys/client.crt /usr/share/openvpn/
+
+TCOS_VPN_SERVER=$(awk '/^server/ {print $2}' /var/lib/tcos/openvpn/tcosserver.conf | cut -d . -f -3)".1"
+
+# startup script
+cat << EOF > $DESTDIR/scripts/tcos-bottom/18vpn
+#!/bin/sh
+
+if [ "\$1" = "prereqs" ]; then
+ exit 0
+fi
+
+quiet=n
+. /scripts/functions
+maybe_break openvpn1
+
+modprobe tun
+ln -s /bin/busybox /sbin/ifconfig
+ln -s /bin/busybox /sbin/route
+openvpn /usr/share/openvpn/client.conf > /tmp/openvpn.log 2>&1 &
+
+grep -v -e xdmcp-server -e font-server /etc/hosts > /etc/hosts.new
+mv /etc/hosts.new /etc/hosts
+echo "$TCOS_VPN_SERVER xdmcp-server" >> /etc/hosts
+echo "$TCOS_VPN_SERVER font-server" >> /etc/hosts
+echo "$TCOS_VPN_SERVER vpn-server" >> /etc/hosts
+
+maybe_break openvpn2
+
+# wait for carrier/ping in tap0
+log_begin_msg "Waiting for OpenVPN connection"
+log_end_msg 0
+while [ 1 ]; do
+ #if [ "\$(cat /sys/class/net/tap0/carrier)" = "1" ]; then
+ # break
+ #fi
+ ping -q -W 1 -c 2 vpn-server >/dev/null 2>&1 && break
+ sleep 1
+done
+
+
+EOF
+chmod +x $DESTDIR/scripts/tcos-bottom/18vpn
+
+
+cat << EOF > $DESTDIR/usr/share/openvpn/client.conf
+client
+dev tap
+proto udp
+remote tcos-server 2194
+float
+resolv-retry infinite
+nobind
+persist-key
+persist-tun
+ca "/usr/share/openvpn/ca.crt"
+cert "/usr/share/openvpn/client.crt"
+key "/usr/share/openvpn/client.key"
+comp-lzo
+verb 1
+ns-cert-type server
+EOF
+
+stat_after "OpenVPN"
+fi # end of TCOS_OPENVPN
diff --git a/hooks-addons/18tcos_hdd_installer b/hooks-addons/18tcos_hdd_installer
new file mode 100644
index 0000000..f36ae0e
--- /dev/null
+++ b/hooks-addons/18tcos_hdd_installer
@@ -0,0 +1,31 @@
+# hooks addon TCOS hdd installer
+# need whiptail, syslinux
+
+# needed for swap creation
+cpifexists /sbin/mkswap /sbin/
+
+# fdisk for fstab generation
+cpifexists /sbin/fdisk /sbin/
+
+# disktype detection (for fstab too)
+[ -x /usr/bin/disktype ] && cpifexists /usr/bin/disktype /usr/bin/
+
+
+if [ ! $TCOS_INSTALLER ]; then
+ _verbose "(18_tcos_hdd_installer) TCOS_INSTALLER disabled"
+else
+ cpifexists /usr/bin/whiptail /usr/bin
+ cpifexists /usr/bin/syslinux /usr/bin
+ cpifexists /usr/bin/mcopy /usr/bin
+ cpifexists /usr/bin/mattrib /usr/bin
+ cpifexists /sbin/install-mbr /sbin
+
+ cpifexists /sbin/mkfs.vfat /usr/bin
+
+ mkdir -p $DESTDIR/usr/lib/syslinux/
+ [ -f /usr/lib/syslinux/mbr.bin ] && cp /usr/lib/syslinux/mbr.bin $DESTDIR/usr/lib/syslinux/
+ [ -f /usr/lib/syslinux/ldlinux.sys ] && cp /usr/lib/syslinux/ldlinux.sys $DESTDIR/usr/lib/syslinux/
+
+ install -m 755 ${TCOS_BINS}/installer.sh ${DESTDIR}/sbin/installer.sh
+
+fi # end of TCOS_INSTALLER
diff --git a/hooks-addons/19usbip b/hooks-addons/19usbip
new file mode 100644
index 0000000..95e4ea6
--- /dev/null
+++ b/hooks-addons/19usbip
@@ -0,0 +1,61 @@
+# hooks addon to export USB devices with USB/IP
+# need usbip-tools and modules
+
+if [ $TCOS_USBIP ] && [ -x /usr/sbin/usbip ]; then
+
+ stat_before
+
+ cpifexists /usr/sbin/usbip /usr/sbin
+ cpifexists /usr/sbin/usbipd /usr/sbin
+ cpifexists /usr/sbin/usbip_bind_driver /usr/sbin
+ cpifexists /usr/lib/libusbip.so.0 /usr/lib
+
+ cpifexists /usr/bin/lsusb /usr/bin
+
+ mkdir -p $DESTDIR/usr/share/misc
+ [ -e /usr/share/misc/usb.ids ] && \
+ cpifexists /usr/share/misc/usb.ids /usr/share/misc
+
+ manual_add_modules usbip_common_mod
+ manual_add_modules usbip
+ manual_add_modules vhci-hcd
+
+
+ cat << EOF > $DESTDIR/scripts/tcos-bottom/70usbip
+#!/bin/sh
+#
+
+# new header not using prereqs
+if [ "\$1" = "prereqs" ]; then
+ echo ""
+ exit 0
+fi
+
+
+quiet=n
+. /scripts/functions
+. /conf/tcos.conf
+. /conf/tcos-run-functions
+
+log_begin_msg "Starting USB/IP"
+ mkdir -p /usr/share/usbip
+ mkdir -p /usr/share/hwdata
+ mkdir -p /var/lib/usbutils
+ ln -s /usr/share/misc/usb.ids /usr/share/usbip 2>/dev/null
+ ln -s /usr/share/usbip/usb.ids /usr/share/hwdata 2>/dev/null
+ ln -s /usr/share/usbip/usb.ids /var/lib/usbutils 2>/dev/null
+
+ modprobe usbip_common_mod
+ modprobe usbip
+
+ usbipd -D > /var/log/usbipd.log 2>&1
+log_end_msg \$?
+
+exit 0
+EOF
+ chmod +x $DESTDIR/scripts/tcos-bottom/70usbip
+
+ stat_after "** EXPERIMENTAL ** USB/IP support"
+
+fi
+
diff --git a/hooks-addons/20alsa b/hooks-addons/20alsa
new file mode 100644
index 0000000..b7e321b
--- /dev/null
+++ b/hooks-addons/20alsa
@@ -0,0 +1,69 @@
+# hooks addon SOUND support
+# need alsa-utils
+
+
+if [ ! $TCOS_SOUND ]; then
+ _verbose "(20alsa) TCOS_SOUND disabled"
+else
+
+ stat_before
+
+ # TCOS MIXER (include ALSA and OSS support)
+ cpifexists ${TCOS_BINS}/tmixer /usr/bin/
+
+ mkdir -p $DESTDIR/usr/share/
+ copydir /usr/share/alsa/ /usr/share/
+
+ # Ubuntu make pulse default in this dir (thin clients must use ALSA directly)
+ rm -f $DESTDIR/usr/share/alsa/*pulse*
+
+ mkdir -p $DESTDIR/var/run/alsa
+
+ mkdir -p $DESTDIR/lib
+ if [ -d /lib/alsa ]; then
+ copydir /lib/alsa /lib/
+ fi
+
+ mkdir -p $DESTDIR/etc/init.d/
+ [ -e /etc/init.d/alsa-utils ] && cpifexists /etc/init.d/alsa-utils /etc/init.d/
+
+ if [ -d /etc/alsa ]; then
+ copydir /etc/alsa/ /etc/
+ fi
+
+ if [ -f /etc/modutils/alsa-base ]; then
+ # OLD alsa-base
+ mkdir -p $DESTDIR/etc/modutils/
+ cpifexists /etc/modutils/alsa-base /etc/modutils
+ fi
+
+ if [ -f /etc/modprobe.d/alsa-base ]; then
+ # NEW alsa-base
+ mkdir -p $DESTDIR/etc/modprobe.d/
+ cpifexists /etc/modprobe.d/alsa-base /etc/modprobe.d/
+ fi
+
+ if [ -f /etc/modprobe.d/alsa-base.conf ]; then
+ # NEW alsa-base
+ mkdir -p $DESTDIR/etc/modprobe.d/
+ cpifexists /etc/modprobe.d/alsa-base.conf /etc/modprobe.d/
+ fi
+
+
+ mkdir -p ${DESTDIR}/usr/lib/alsa-lib/
+ [ -e /usr/lib/alsa-lib/libasound_module_pcm_pulse.so ] && \
+ cpifexists /usr/lib/alsa-lib/libasound_module_pcm_pulse.so /usr/lib/alsa-lib/
+ [ -e /usr/lib/alsa-lib/libasound_module_ctl_pulse.so ] && \
+ cpifexists /usr/lib/alsa-lib/libasound_module_ctl_pulse.so /usr/lib/alsa-lib/
+ # new in Ubuntu??
+ [ -e /usr/lib/alsa-lib/libasound_module_conf_pulse.so ] && \
+ cpifexists /usr/lib/alsa-lib/libasound_module_conf_pulse.so /usr/lib/alsa-lib/
+ [ -e /usr/lib/alsa-lib/libasound_module_pcm_alsa_dsp.so ] && \
+ cpifexists /usr/lib/alsa-lib/libasound_module_pcm_alsa_dsp.so /usr/lib/alsa-lib/
+
+
+
+
+ stat_after "Alsa sound support"
+
+fi # end of TCOS_SOUND
diff --git a/hooks-addons/21pulseaudio b/hooks-addons/21pulseaudio
new file mode 100644
index 0000000..0528a55
--- /dev/null
+++ b/hooks-addons/21pulseaudio
@@ -0,0 +1,239 @@
+# pulseaudio hook
+#
+# clients must connect in two ways:
+#
+# connecting to server: tcp:thin_client_ip:4713
+# or
+# importing X11 cookie with: $ pax11publish -i
+# or
+# using this env var PULSE_SERVER="thin_client_hostname"
+
+if [ ${TCOS_PULSEAUDIO} ] && [ ${TCOS_SOUND} ]; then
+
+# check for apps
+check1=0
+[ -x /usr/bin/pulseaudio ] && check1=1
+
+#check2=0
+#[ -e /usr/lib/pulse*/modules/module-esound-protocol-tcp.so ] && check2=1
+#[ -d ${TCOS_PKG_CACHE}/pulseaudio-esound-compat/usr/lib ] && check2=1
+
+if [ $check1 = 0 ]; then
+ echo " WARNING:"
+ echo " pulseaudio is not installed, disable it from tcos.conf!!!"
+
+#elif [ $check2 = 0 ]; then
+# echo " WARNING:"
+# echo " pulseaudio-esound-compat is not installed, need some esound modules"
+# echo " install this package or disable PulseAudio in /etc/tcos/tcos.conf"
+# echo " You can install a cached package with:"
+# echo " # gentcos -instpkg pulseaudio-esound-compat"
+# echo ""
+# echo " See /usr/share/doc/initramfs-tools-tcos/README.cache"
+# echo ""
+
+else
+
+
+ stat_before
+
+ cpifexists /usr/bin/pulseaudio /usr/bin/
+ cpifexists /usr/bin/pax11publish /usr/bin/
+ cpifexists /usr/bin/pactl /usr/bin/
+
+ mkdir -p ${DESTDIR}/usr/lib
+ copydir /usr/lib/pulse-* /usr/lib/
+
+ mkdir -p ${DESTDIR}/var/lib/pulse
+
+ # clean unneeded modules
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*.la
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*jack*
+ # rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*rtp*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*lirc*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*evdev*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*sine*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*x11-bell*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*zeroconf*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*avahi*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*gconf*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*hal*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*pipe*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*tunel*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*volume-restore*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*cli*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*http*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*console-kit*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*ladspa*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*bluetooth*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*augment*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*phone*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*position-event*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*filter*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*equalizer*
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*rygel*
+
+ # don't use suspend-idle (we don't use dbus yet to reload pulseaudio)
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*idle*
+
+ # don't copy x11 modules
+ rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*x11*
+
+ # copy channel configuration files if exists
+ if [ -d /usr/share/pulseaudio/ ]; then
+ copydir /usr/share/pulseaudio /usr/share/
+ fi
+
+ # needed for pulse -> esound -> OSS
+ [ -e /usr/lib/pulse-*/modules/libsocket-client.so ] && \
+ cpifexists /usr/lib/pulse-*/modules/libsocket-client.so /usr/lib/pulse-*/modules/
+
+
+ # delete modules and copy again to put linked libs
+ for _lib in $DESTDIR/usr/lib/pulse-*/modules/*so; do
+ librel=$(basename $_lib)
+ rm -f $_lib
+ cpifexists /usr/lib/pulse-*/modules/${librel} /usr/lib/pulse-*/modules/
+ done
+
+ echo "pulse:x:111:120:PulseAudio daemon,,,:/var/run/pulse:/bin/false" >> $DESTDIR/etc/passwd
+ echo "pulse:x:120:" >> $DESTDIR/etc/group
+
+
+ #copydir /etc/pulse /etc/
+ mkdir -p $DESTDIR/etc/pulse
+ cp /etc/pulse/client.conf $DESTDIR/etc/pulse/
+ cp /etc/pulse/daemon.conf $DESTDIR/etc/pulse/
+
+
+ if [ "$TCOS_SOUND_REMOTE_ESD" ]; then
+ _SERVER=";\$(read_server "xdmcp-server")"
+ else
+ _SERVER=""
+ fi
+
+ if [ -e /usr/lib/pulse-*/modules/module-udev-detect.so ]; then
+ _MODULE="module-udev-detect"
+ else
+ _MODULE="module-detect"
+ fi
+
+ cat << EOF >> ${DESTDIR}/sbin/startpulseaudio
+#!/bin/sh
+
+
+. /scripts/functions
+. /conf/tcos.conf
+. /conf/tcos-run-functions
+
+
+# limit PulseAudio SHM memory in low memory systems (<96MiB = 98304)
+if [ "\$(awk '/MemTotal/ {print \$2}' /proc/meminfo)" -lt 98305 ]; then
+ if grep -q shm-size-bytes /etc/pulse/daemon.conf; then
+ echo "shm-size-bytes = 16" >> /etc/pulse/daemon.conf
+ fi
+ if grep -q enable-shm /etc/pulse/daemon.conf; then
+ echo "enable-shm = no" >> /etc/pulse/daemon.conf
+ fi
+fi
+
+# don't allow to exit_idle (by default 20 seconds)
+if grep -q exit-idle-time /etc/pulse/daemon.conf; then
+ echo "exit-idle-time = -1" >> /etc/pulse/daemon.conf
+fi
+
+# generate conf
+rm -f /etc/pulse/default.pa
+
+if [ "\$(pidof esd | sed '/^\$/d')" != "" ]; then
+cat << FIN > /etc/pulse/default.pa
+#!/usr/bin/pulseaudio -nF
+
+load-module module-esound-sink server=127.0.0.1
+load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;\$(read_server "xdmcp-server")
+
+#.ifexists module-x11-publish.so
+#.nofail
+#load-module module-x11-publish
+#.fail
+#.endif
+
+FIN
+
+else
+cat << FIN > /etc/pulse/default.pa
+#!/usr/bin/pulseaudio -nF
+
+load-module $_MODULE
+
+
+load-module module-esound-protocol-tcp auth-ip-acl=127.0.0.1$_SERVER
+load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;\$(read_server "xdmcp-server")
+
+load-module module-esound-protocol-unix
+
+#.ifexists module-x11-publish.so
+#.nofail
+#load-module module-x11-publish
+#.fail
+#.endif
+
+.nofail
+load-module module-device-restore
+load-module module-stream-restore
+load-module module-card-restore
+
+load-module module-always-sink
+.fail
+
+FIN
+
+fi
+
+
+DISPLAY=:0
+export DISPLAY
+
+cpu=\$(grep MHz /proc/cpuinfo | tail -1 | awk -F":" '{if(int(\$2) < 1024) printf "low"}')
+realtime=\$(pulseaudio --help 2>&1 | grep -c realtime)
+
+OPTS="--log-target=stderr "
+if [ \${TCOS_PULSEAUDIO_RESAMPLE_METHOD} ]; then
+ OPTS="\${OPTS} --resample-method=\${TCOS_PULSEAUDIO_RESAMPLE_METHOD}"
+fi
+
+OPTS="--no-cpu-limit \${OPTS}"
+
+if [ "\$cpu" = "low" ]; then
+ #OPTS="--no-cpu-limit \${OPTS}"
+ # old versions of pulseaudio don't have realtime switch (Etch)
+ if [ "\$realtime" != "0" ]; then
+ OPTS="\${OPTS} --realtime "
+ fi
+fi
+
+_log "STARTPULSEAUDIO starting pulseaudio server..."
+pulseaudio \${OPTS} &
+
+
+sleep 4
+#
+# wait for Xorg is started
+#
+waitforX || exit
+sleep 2
+#
+DISPLAY=:0 pax11publish -e
+#
+exit 0
+
+EOF
+ chmod +x ${DESTDIR}/sbin/startpulseaudio
+
+ stat_after "PulseAudio (sound server)"
+
+fi # end of else of /usr/bin/pulseaudio
+
+else
+ _verbose "(21pulseaudio) TCOS_PULSEAUDIO && sound disabled"
+fi # end of TCOS_PULSEAUDIO
diff --git a/hooks-addons/23bootchart b/hooks-addons/23bootchart
new file mode 100644
index 0000000..cb4f8d3
--- /dev/null
+++ b/hooks-addons/23bootchart
@@ -0,0 +1,46 @@
+
+# must export this variable from shell no config yet
+
+if [ "$TCOS_ENABLE_BOOTCHARTD" = "1" ]; then
+
+ cpifexists $TCOS_BINS/tcos-bootchartd /sbin
+ cpifexists /bin/sleep /bin
+
+ cat << EOF > $DESTDIR/sbin/bootlogger
+#!/bin/sh
+cmd="\$1"
+logfile="\$2"
+
+while [ -f "/tmp/bootchart.lock" ]; do
+ # Write the time (in jiffies).
+ read uptime < /proc/uptime
+ uptime=\${uptime%% [0-9]*}
+ uptime=\${uptime%.*}\${uptime#*.}
+ echo \$uptime
+
+ # Log the command output
+ eval \$cmd 2>/dev/null
+ echo
+ /bin/sleep 0.2
+done >> "\$logfile"
+
+EOF
+ chmod +x $DESTDIR/sbin/bootlogger
+
+
+ cat << EOF > $DESTDIR/scripts/init-top/000bootchartd
+#!/bin/sh
+#
+if [ "\$1" = "prereqs" ]; then
+ exit 0
+fi
+
+if grep -q bootchartd /proc/cmdline ; then
+ /sbin/daemonize.sh /sbin/tcos-bootchartd start
+fi
+
+EOF
+
+ chmod +x $DESTDIR/scripts/init-top/000bootchartd
+
+fi
diff --git a/hooks-addons/40etc2300 b/hooks-addons/40etc2300
new file mode 100644
index 0000000..84775f3
--- /dev/null
+++ b/hooks-addons/40etc2300
@@ -0,0 +1,45 @@
+# hook addon for EPATEC eTC2300
+
+
+cat << EOF > ${DESTDIR}/scripts/tcos-bottom/15etc2300
+#!/bin/sh
+#
+
+# new header not using prereqs
+if [ "\$1" = "prereqs" ]; then
+ echo ""
+ exit 0
+fi
+
+
+quiet=n
+
+. /conf/tcos.conf
+. /conf/tcos-run-functions
+
+
+test1=\$(grep -c "10395315" /proc/bus/pci/devices)
+
+if [ "\$test1" = "0" ]; then
+ # no client with chip Silicon Integrated Systems [SiS] 550 PCI/AGP VGA Display Adapter
+ exit 0
+fi
+
+echo "#/scripts/tcos-bottom/15etc2300" >> /conf/tcos.conf
+echo "TCOS_XORG_VIDEO_DRIVER=auto" >> /conf/tcos.conf
+
+EOF
+chmod +x ${DESTDIR}/scripts/tcos-bottom/15etc2300
+
+stat_before
+
+ manual_add_modules sis5513
+ if modprobe --set-version="${TCOS_KERNEL}" -l| grep -q snd-sis7019 ; then
+ manual_add_modules ac97_codec
+ manual_add_modules sis7019
+ else
+ manual_add_modules snd-sis7019
+ fi
+
+stat_after "eTC2300 thin client hacks"
+
diff --git a/hooks-addons/45wakeonlan b/hooks-addons/45wakeonlan
new file mode 100644
index 0000000..5c4e31c
--- /dev/null
+++ b/hooks-addons/45wakeonlan
@@ -0,0 +1,22 @@
+# WAKEONLAN support
+# need to copy ethtool to image
+#
+
+if [ $TCOS_WAKEONLAN ]; then
+
+ if [ -x /sbin/ethtool ]; then
+ cpifexists /sbin/ethtool /sbin
+
+ elif [ -x /usr/sbin/ethtool ]; then
+ cpifexists /usr/sbin/ethtool /sbin
+
+ else
+ _echo " WARNING:"
+ _echo " WAKEONLAN enabled but ethtool package not found !!!"
+ _echo " Please install ethtool or disable WAKEONLAN"
+ _echo ""
+ fi
+
+else
+ _verbose "(45wakeonlan) TCOS_WAKEONLAN disabled"
+fi
diff --git a/hooks-addons/49xfbdev b/hooks-addons/49xfbdev
new file mode 100644
index 0000000..82d40a2
--- /dev/null
+++ b/hooks-addons/49xfbdev
@@ -0,0 +1,87 @@
+
+
+if [ -n "$TCOS_XFBDEV" ] && [ -x /usr/bin/Xfbdev ]; then
+ stat_before
+ _echo " * Using Xfbdev as Xserver"
+
+ cpifexists /usr/bin/Xfbdev /usr/bin/
+ cat << EOF > $DESTDIR/usr/bin/Xorg
+#!/bin/sh
+echo "ARGS=\$@" > /tmp/xorg.args
+
+if [ "\$1" = "-version" ]; then
+ echo "7.1"
+ exit
+fi
+
+/usr/bin/Xfbdev \$@ -screen 1024x768x16 -mouse mouse,2 -3button -keybd keyboard
+# example
+# Xfbdev vt7 -query 192.168.0.3 -auth /root/.Xauthority -screen 1024x768x16 -mouse mouse,2 -3button
+EOF
+ chmod +x $DESTDIR/usr/bin/Xorg
+
+ install -m 755 ${TCOS_BINS}/tryXorg.sh ${DESTDIR}/sbin/tryXorg
+ cpifexists /usr/bin/xauth /usr/bin
+ cpifexists /usr/bin/mcookie /usr/bin
+
+ # some xutils
+ cpifexists /usr/bin/xset /usr/bin
+ cpifexists /usr/bin/xsetroot /usr/bin
+ cpifexists /usr/bin/xkbcomp /usr/bin
+
+ XORG_XKB_DIR=/usr/share/X11/xkb/
+ [ ! -d "${XORG_XKB_DIR}" ] && XORG_XKB_DIR=/etc/X11/xkb/
+ mkdir -p ${DESTDIR}/usr/share/X11
+
+ # copy all dir (some files not needed)
+ cp -ra ${XORG_XKB_DIR} ${DESTDIR}/usr/share/X11
+
+ # delete symlinks
+ find ${DESTDIR}/usr/share/X11/ -type l | xargs rm -f --
+
+ # keymap DB
+ cpifexists /usr/share/X11/XKeysymDB /usr/share/X11/
+
+ mkdir -p $DESTDIR/var/log
+ mkdir -p $DESTDIR/etc/X11/xserver
+ mkdir -p $DESTDIR/etc/X11/PreRun
+
+ if [ -d /usr/share/fonts/X11 ]; then
+ TCOS_FONTS_PATH="/usr/share/fonts/X11"
+ TCOS_FONT_EXTENSION=".gz"
+
+ elif [ ! -L /usr/lib/X11/fonts ]; then
+ TCOS_FONTS_PATH="/usr/lib/X11/fonts"
+ TCOS_FONT_EXTENSION=""
+
+ else
+ _echo ""
+ _echo "ERROR: Cant' locate fonts dir, XFS is deprecated, BUG!!!"
+ _echo ""
+ TCOS_FONTS_PATH=""
+ exit
+ fi # end of -d /usr/share/fonts/X11
+
+ cat << EOF > ${DESTDIR}/sbin/configurexorg
+#!/bin/sh
+exit 0
+EOF
+
+ if [ "$TCOS_FONTS_PATH" != "" ]; then
+ mkdir -p $DESTDIR/$TCOS_FONTS_PATH/misc
+ mkdir -p $DESTDIR/$TCOS_FONTS_PATH/100dpi
+
+ cat << EOF > $DESTDIR/$TCOS_FONTS_PATH/misc/fonts.alias
+fixed -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
+7x14 -misc-fixed-medium-r-semicondensed--14-120-75-75-c-60-iso8859-1
+EOF
+ cpifexists $TCOS_FONTS_PATH/misc/6x13-ISO8859-1.pcf${TCOS_FONT_EXTENSION} $TCOS_FONTS_PATH/misc
+ cpifexists $TCOS_FONTS_PATH/misc/cursor.pcf${TCOS_FONT_EXTENSION} $TCOS_FONTS_PATH/misc
+ mkfontdir $DESTDIR/$TCOS_FONTS_PATH/misc
+
+ cpifexists $TCOS_FONTS_PATH/100dpi/helvB24-ISO8859-1.pcf${TCOS_FONT_EXTENSION} $TCOS_FONTS_PATH/100dpi
+ cpifexists $TCOS_FONTS_PATH/100dpi/helvB08-ISO8859-1.pcf${TCOS_FONT_EXTENSION} $TCOS_FONTS_PATH/100dpi
+ mkfontdir $DESTDIR/$TCOS_FONTS_PATH/100dpi
+ fi # end of $TCOS_FONTS_PATH
+ stat_after "Xfbdev"
+fi
diff --git a/hooks-addons/50xorg b/hooks-addons/50xorg
new file mode 100644
index 0000000..b99b9aa
--- /dev/null
+++ b/hooks-addons/50xorg
@@ -0,0 +1,401 @@
+# hooks addon of Xorg
+# compatible with Xorg 7.x
+
+
+if [ -z "$TCOS_XFBDEV" ] && [ $TCOS_XORG ]; then
+# Xorg stuff
+ stat_before
+if [ "$(pathof Xorg)" = /usr/bin/Xorg ]; then
+ XORG=7
+ #_echo " USING Xorg 7.X dirs"
+ XORG_PATH=/usr/bin
+else
+ _echo " **ERROR** Xorg not found"
+ exit
+fi
+
+
+cpifexists $XORG_PATH/Xorg /usr/bin
+cpifexists $XORG_PATH/xauth /usr/bin
+cpifexists $XORG_PATH/mcookie /usr/bin
+cpifexists $XORG_PATH/xhost /usr/bin
+cpifexists $XORG_PATH/xterm /usr/bin
+if [ -e $XORG_PATH/twm ]; then
+ cpifexists $XORG_PATH/twm /usr/bin
+else
+ _echo " WARNING: twm package not found"
+fi
+
+# some xutils
+cpifexists $XORG_PATH/xset /usr/bin
+cpifexists $XORG_PATH/xsetroot /usr/bin
+cpifexists $XORG_PATH/sessreg /usr/bin
+cpifexists $XORG_PATH/xkbcomp /usr/bin
+
+# bin to wait until Xorg is started
+cpifexists ${TCOS_BINS}/waitforX /usr/bin/
+
+
+cpifexists ${TCOS_BINS}/get_vga_vendor /usr/bin/
+
+mkdir -p $DESTDIR/var/log
+mkdir -p $DESTDIR/etc/X11/xserver
+mkdir -p $DESTDIR/etc/X11/PreRun
+mkdir -p $DESTDIR/etc/X11/xserver/
+
+
+# copy xorg.conf template and generator
+cp ${TCOS_CONF}/xorg.conf.tpl ${DESTDIR}/conf/xorg.conf.tpl
+install -m 755 ${TCOS_BINS}/configurexorg ${DESTDIR}/sbin/configurexorg
+install -m 755 ${TCOS_BINS}/tryXorg.sh ${DESTDIR}/sbin/tryXorg
+
+
+# new xorg.conf.d configuration files
+XORG_CONF_PATH=/usr/lib/X11/xorg.conf.d/
+[ -d /usr/share/X11/xorg.conf.d ] && XORG_CONF_PATH=/usr/share/X11/xorg.conf.d/
+
+for f in $(find $XORG_CONF_PATH -type f 2>/dev/null); do
+ mkdir -p $DESTDIR/$XORG_CONF_PATH
+ cp $f $DESTDIR/$XORG_CONF_PATH
+done
+
+
+# include xorg PCI IDS file
+mkdir -p ${DESTDIR}/usr/share/xserver-xorg/pci/
+cpifexists ${TCOS_DIR}/inc/xorg.pciids /usr/share/xserver-xorg/pci/
+
+mkdir -p $DESTDIR/usr/lib/xorg/modules/
+
+# new in xorg 1.5
+[ -e /usr/lib/xorg/protocol.txt ] && cpifexists /usr/lib/xorg/protocol.txt /usr/lib/xorg/
+
+# FONTS modules
+[ -d /usr/lib/xorg/modules/fonts ] && copydir /usr/lib/xorg/modules/fonts /usr/lib/xorg/modules/
+
+
+if [ -d /usr/share/fonts/X11 ]; then
+ TCOS_FONTS_PATH="/usr/share/fonts/X11"
+ TCOS_FONT_EXTENSION=".gz"
+
+elif [ ! -L /usr/lib/X11/fonts ]; then
+ TCOS_FONTS_PATH="/usr/lib/X11/fonts"
+ TCOS_FONT_EXTENSION=""
+
+
+else
+ _echo ""
+ _echo "ERROR: Cant' locate fonts dir, XFS is deprecated, BUG!!!"
+ _echo ""
+ TCOS_FONTS_PATH=""
+ exit
+fi
+
+
+if [ "$TCOS_FONTS_PATH" != "" ]; then
+ mkdir -p $DESTDIR/$TCOS_FONTS_PATH/misc
+ mkdir -p $DESTDIR/$TCOS_FONTS_PATH/100dpi
+
+ cat << EOF > $DESTDIR/$TCOS_FONTS_PATH/misc/fonts.alias
+fixed -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
+7x14 -misc-fixed-medium-r-semicondensed--14-120-75-75-c-60-iso8859-1
+EOF
+ cpifexists $TCOS_FONTS_PATH/misc/6x13-ISO8859-1.pcf${TCOS_FONT_EXTENSION} $TCOS_FONTS_PATH/misc
+ cpifexists $TCOS_FONTS_PATH/misc/cursor.pcf${TCOS_FONT_EXTENSION} $TCOS_FONTS_PATH/misc
+ mkfontdir $DESTDIR/$TCOS_FONTS_PATH/misc
+
+ cpifexists $TCOS_FONTS_PATH/100dpi/helvB24-ISO8859-1.pcf${TCOS_FONT_EXTENSION} $TCOS_FONTS_PATH/100dpi
+ cpifexists $TCOS_FONTS_PATH/100dpi/helvB08-ISO8859-1.pcf${TCOS_FONT_EXTENSION} $TCOS_FONTS_PATH/100dpi
+ mkfontdir $DESTDIR/$TCOS_FONTS_PATH/100dpi
+fi
+
+# PCIIDS
+if [ -d /usr/share/xserver-xorg/pci ] ; then
+ mkdir -p $DESTDIR/usr/share/xserver-xorg/
+ copydir /usr/share/xserver-xorg/pci /usr/share/xserver-xorg/
+fi
+
+
+# MODULES
+mkdir -p $DESTDIR/usr/lib/xorg/modules/input/
+
+for _ext in $(ls /usr/lib/xorg/modules/lib*so); do
+ cpifexists $_ext /usr/lib/xorg/modules/
+done
+
+for _inp in $(ls /usr/lib/xorg/modules/input/*); do
+ cpifexists $_inp /usr/lib/xorg/modules/input/
+done
+
+if [ -d /usr/lib/xorg/modules/linux ]; then
+ mkdir -p $DESTDIR/usr/lib/xorg/modules/linux
+
+ for _lnx in $(ls /usr/lib/xorg/modules/linux/lib*so); do
+ cpifexists $_lnx /usr/lib/xorg/modules/linux/
+ done
+fi
+
+# DRIVERS and EXTENSIONS
+mkdir -p $DESTDIR/usr/lib/xorg/modules/drivers
+# essential xorg driver
+cpifexists /usr/lib/xorg/modules/drivers/vesa_drv.so /usr/lib/xorg/modules/drivers/
+
+
+if [ $TCOS_XORG_ALLDRIVERS ]; then
+ driver_dir=/usr/lib/xorg/modules/drivers
+ _echo " Xorg: installing all drivers..."
+ for _drv in $(ls ${driver_dir}/*so|grep -v -e nvidia -e vmware -e vbox); do
+ cpifexists $_drv ${driver_dir}/
+ done
+ rm -f $DESTDIR/${driver_dir}/nvidia_drv.so
+fi
+
+mkdir -p $DESTDIR/usr/lib/xorg/modules/extensions
+# copy linked libs
+for _file in $(ls /usr/lib/xorg/modules/extensions/lib*.so| grep -v glx); do
+ cpifexists $_file /usr/lib/xorg/modules/extensions/
+done
+
+# delete nvidia/ati glx module
+rm -f $DESTDIR/usr/lib/xorg/modules/extensions/libglx.so*
+rm -f $DESTDIR/usr/lib/xorg/modules/libwfb.so
+rm -f $DESTDIR/usr/lib/xorg/modules/libnvidia-wfb.so.*
+rm -rf $DESTDIR/usr/lib/xorg/modules/extensions/libGLcore.so
+rm -rf $DESTDIR/usr/lib/libnvidia-*
+# for multiarch
+rm -rf $DESTDIR/usr/lib/*/libnvidia-*
+
+# delete linked nvidia driver (10Mb)
+rm -f $DESTDIR/usr/lib/libGL*
+
+LIBGL_PATH=/usr/lib/
+if [ -e /usr/lib/mesa/libGL.so.1 ]; then
+ LIBGL_PATH=/usr/lib/mesa/
+fi
+
+# multiarch support
+[ -e $LIB_MULTIARCH/libGL.so.1 ] && LIBGL_PATH=$LIB_MULTIARCH
+[ -e $LIB_MULTIARCH/mesa/libGL.so.1 ] && LIBGL_PATH=$LIB_MULTIARCH/mesa/
+
+# delete vnc extension
+rm -f $DESTDIR/usr/lib/xorg/modules/extensions/libvnc.so
+
+if [ $TCOS_XORG_OPENGL ]; then
+ _echo " * OpenGL support is ENABLED"
+ if [ "$(strings $LIBGL_PATH/libGL.so.1|grep -c NVIDIA)" != 0 ] || \
+ [ "$(strings /usr/lib/xorg/modules/extensions/libglx.so 2>&1 |grep -c NVIDIA)" != 0 ] || \
+ [ "$(strings $LIBGL_PATH/libGL.so.1|grep -c -i fgl)" != 0 ]; then
+
+ if [ -d ${TCOS_PKG_CACHE}/fix-nvidia-ati ]; then
+ rm -rf $DESTDIR/usr/lib/xorg/modules/libglx.so*
+ rm -f $DESTDIR/usr/lib/xorg/modules/libnvidia-wfb.so.*
+ [ -e ${TCOS_PKG_CACHE}/fix-nvidia-ati/libGLcore.so ] && \
+ cpifexists ${TCOS_PKG_CACHE}/fix-nvidia-ati/libGLcore.so /usr/lib/xorg/modules/extensions/
+
+ cpifexists ${TCOS_PKG_CACHE}/fix-nvidia-ati/libglx.so /usr/lib/xorg/modules/extensions/
+ cpifexists ${TCOS_PKG_CACHE}/fix-nvidia-ati/libGL.so.1.2 /usr/lib/
+ [ -e /usr/lib/libGLU.so.1 ] && cpifexists /usr/lib/libGLU.so.1 /usr/lib/
+ [ -f ${TCOS_PKG_CACHE}/fix-nvidia-ati/libwfb.so ] && \
+ cpifexists ${TCOS_PKG_CACHE}/fix-nvidia-ati/libwfb.so /usr/lib/xorg/modules/
+ _echo " * OpenGL use cached fix-nvidia-ati libs"
+ else
+ _echo " ********************************************** "
+ _echo " WARNING: NVIDIA/ATI libs found !!!!!! "
+ _echo " "
+ _echo " Please fix with: gentcos -fix-nvidia-ati "
+ _echo " or uninstall nvidia/ati drivers "
+ _echo " "
+ _echo " OpenGL support will not work on thin clients "
+ _echo " ********************************************** "
+ fi
+
+ else
+ cpifexists /usr/lib/xorg/modules/extensions/libglx.so /usr/lib/xorg/modules/extensions/
+ [ -e /usr/lib/xorg/modules/extensions/libGLcore.so ] && \
+ cpifexists /usr/lib/xorg/modules/extensions/libGLcore.so /usr/lib/xorg/modules/extensions/
+ cpifexists $LIBGL_PATH/libGL.so.1 /usr/lib/
+ [ -e /usr/lib/libGLcore.so.1 ] && cpifexists /usr/lib/libGLcore.so.1 /usr/lib/
+ [ -e /usr/lib/libGLU.so.1 ] && cpifexists /usr/lib/libGLU.so.1 /usr/lib/
+ fi # end of NVIDIA/ATI strings
+
+if [ -e $DESTDIR/usr/lib/libGL.so.1 ];then
+ if [ "$(strings $DESTDIR/usr/lib/libGL.so.1|grep -c NVIDIA)" != 0 ] || \
+ [ "$(strings $DESTDIR/usr/lib/libGL.so.1|grep -c -i fgl)" != 0 ]; then
+ rm -rf $DESTDIR/usr/lib/libGL.so.1
+ fi
+fi
+
+if [ -e $DESTDIR/usr/lib/libGLcore.so.1 ];then
+ if [ "$(strings $DESTDIR/usr/lib/libGLcore.so.1|grep -c NVIDIA)" != 0 ] || \
+ [ "$(strings $DESTDIR/usr/lib/libGLcore.so.1|grep -c -i fgl)" != 0 ]; then
+ rm -rf $DESTDIR/usr/lib/libGLcore.so.1
+ fi
+fi
+
+else
+_echo " * OpenGL support is not enabled!!"
+fi # end of $TCOS_XORG_OPENGL
+
+
+# keyboard and keymap
+
+XORG_XKB_DIR=/usr/share/X11/xkb/
+[ ! -d "${XORG_XKB_DIR}" ] && XORG_XKB_DIR=/etc/X11/xkb/
+mkdir -p ${DESTDIR}/usr/share/X11
+
+# copy all dir (some files not needed)
+cp -ra ${XORG_XKB_DIR} ${DESTDIR}/usr/share/X11
+
+# delete symlinks
+find ${DESTDIR}/usr/share/X11/ -type l | xargs rm -f --
+
+# keymap DB
+[ -e /usr/share/X11/XKeysymDB ] && cpifexists /usr/share/X11/XKeysymDB /usr/share/X11/
+
+
+
+
+# xorg locale
+mkdir -p $DESTDIR/usr/share/locale
+mkdir -p $DESTDIR/usr/lib/X11
+[ -d /usr/lib/X11/locale ] && copydir /usr/lib/X11/locale/ /usr/lib/X11/
+#copydir /usr/lib/X11/config/ /usr/lib/X11/
+[ -e /etc/X11/rgb.txt ] && cpifexists /etc/X11/rgb.txt /etc/X11/
+
+
+
+stat_after "Xorg"
+
+fi # end of TCOS_XORG
+############### XORG SCRIPTS ####################
+
+
+
+
+
+
+cat <<EOF > $DESTDIR/sbin/killX
+#!/bin/sh
+echo \"killing xorg process...\"
+killall Xorg 2>/dev/null
+EOF
+chmod +x $DESTDIR/sbin/killX
+
+cat <<EOF > $DESTDIR/sbin/restartxorg
+#!/bin/sh
+
+killall Xorg 2>/dev/null
+
+EOF
+chmod +x $DESTDIR/sbin/restartxorg
+
+
+cat <<EOF > $DESTDIR/sbin/startlocalx
+#!/bin/sh
+export DISPLAY=:0
+export HOME=/root
+
+if [ -f \$XAUTHORITY ]; then
+ TCOS_XORG_OPTS="\$TCOS_XORG_OPTS -auth \$XAUTHORITY"
+fi
+
+/sbin/tryXorg --xorgopts="\${TCOS_XORG_OPTS}" &
+
+waitforX || exit
+sleep 1
+
+xterm >> /tmp/initramfs.debug 2>&1 &
+twm >> /tmp/initramfs.debug 2>&1 &
+
+# set background color
+xsetroot -cursor_name left_ptr -solid "#338899"
+
+EOF
+chmod +x $DESTDIR/sbin/startlocalx
+
+cat <<EOF > $DESTDIR/sbin/startnx
+#!/bin/sh
+. /conf/tcos.conf
+. /conf/tcos-run-functions
+SERVER=\$(read_server "xdmcp-server")
+export DISPLAY=:0
+export HOME=/root
+export USER_NX_DIR=/root/.nx
+
+if [ -x /usr/bin/ssh ]; then
+ ssh -N -p 2022 -l mario -C -2 -L 5000:localhost:2022 ${SERVER}
+fi
+
+if [ -f $\XAUTHORITY ]; then
+ TCOS_XORG_OPTS="\$TCOS_XORG_OPTS -auth \$XAUTHORITY"
+fi
+
+/sbin/tryXorg --xorgopts="\${TCOS_XORG_OPTS}" &
+
+waitforX || exit
+sleep 1
+
+# no window manager for freenx
+#twm >> /tmp/initramfs.debug 2>&1 &
+
+sleep 2
+# set background color
+xsetroot -cursor_name left_ptr -solid "#338899"
+
+/usr/NX/bin/nxclient >> /tmp/initramfs.debug 2>&1
+xterm
+
+EOF
+chmod +x $DESTDIR/sbin/startnx
+
+cat <<EOF > $DESTDIR/sbin/startremotex
+#!/bin/sh
+. /conf/tcos.conf
+. /conf/tcos-run-functions
+SERVER=\$(read_server "xdmcp-server")
+export DISPLAY=:0
+
+if [ -f \$XAUTHORITY ]; then
+ TCOS_XORG_OPTS="\$TCOS_XORG_OPTS -auth \$XAUTHORITY"
+fi
+
+/sbin/tryXorg --server=\${SERVER} --xorgopts="\${TCOS_XORG_OPTS} -query \${SERVER}" &
+
+EOF
+chmod +x $DESTDIR/sbin/startremotex
+
+
+# FIXME, not documented
+
+cat <<EOF > $DESTDIR/sbin/startsshx
+#!/bin/sh
+. /conf/tcos.conf
+. /conf/tcos-run-functions
+SERVER=\$(read_server "xdmcp-server")
+export DISPLAY=:0
+export HOME=/root
+
+if [ -f \$XAUTHORITY ]; then
+ TCOS_XORG_OPTS="\$TCOS_XORG_OPTS -auth \$XAUTHORITY"
+fi
+
+/sbin/tryXorg --xorgopts="\${TCOS_XORG_OPTS}" &
+
+waitforX || exit
+sleep 1
+
+remoteuser=\$(read_cmdline_var "sshuser" "root")
+remotesshhost=\$(read_cmdline_var "sshhost" "\${SERVER}")
+remotesshport=\$(read_cmdline_var "sshport" "2022")
+# gnome-session, startkde , startxfce4
+remotesshdesktop=\$(read_cmdline_var "sshdesktop" "startxfce4")
+
+while [ 1 ]; do
+ xterm -e "echo \"SSH \${remoteuser}@\${remotesshhost} -p \${remotesshport}...\" ; ssh -X -C -f -l \${remoteuser} \${remotesshhost} -p \${remotesshport} \${remotesshdesktop}"
+done
+
+EOF
+chmod +x $DESTDIR/sbin/startsshx
+
+
+
+
diff --git a/hooks-addons/51amd_geode b/hooks-addons/51amd_geode
new file mode 100644
index 0000000..eb24281
--- /dev/null
+++ b/hooks-addons/51amd_geode
@@ -0,0 +1,56 @@
+# hook addon for thin clients with chip AMD - GEODE
+
+stat_before
+
+ # save Xorg version in file
+ Xorg -version > $DESTDIR/conf/xorg.version 2>&1
+
+cat << EOF > ${DESTDIR}/scripts/tcos-bottom/15amd_geode
+#!/bin/sh
+#
+
+# new header not using prereqs
+if [ "\$1" = "prereqs" ]; then
+ echo ""
+ exit 0
+fi
+
+
+quiet=n
+
+. /scripts/functions
+. /conf/tcos.conf
+. /conf/tcos-run-functions
+
+test1=0
+#geode 100B:0030
+#geode 1022:2081
+test1=\$(lspci -n |grep -c -e "100B:0030" -e "1022:2081")
+
+test2=0
+test2=\$(cat /conf/xorg.version | sed '/^\$/d' | head -1 | awk '{print \$NF}' | awk -F"." '{if (\$1 <= 1 && \$2 > 3) printf "1"}')
+
+
+if [ "\$test1" = "0" ] || [ "\$test2" = "1" ] ; then
+ # no client with chip amd geode or Xorg with amd fixes
+ exit 0
+fi
+
+[ "\$TCOS_XORG_VIDEO_DRIVER" = "fullauto" ] && exit 0
+[ "\$TCOS_XORG_VIDEO_DRIVER" = "xorgauto" ] && exit 0
+
+log_begin_msg "Loading xserver AMD Geode Support"
+
+ if [ -f /usr/lib/xorg/modules/drivers/amd_drv.so ]; then
+ configurexorg --newsettings --xdriver=amd --outputfile=/etc/X11/xorg.conf 2>> /tmp/initramfs.debug
+ elif [ -f /usr/lib/xorg/modules/drivers/geode_drv.so ]; then
+ configurexorg --newsettings --xdriver=geode --outputfile=/etc/X11/xorg.conf 2>> /tmp/initramfs.debug
+ fi
+
+log_end_msg \$?
+
+EOF
+chmod +x ${DESTDIR}/scripts/tcos-bottom/15amd_geode
+
+
+stat_after "AMD Geode Xorg support"
diff --git a/hooks-addons/51dri b/hooks-addons/51dri
new file mode 100644
index 0000000..5a60abb
--- /dev/null
+++ b/hooks-addons/51dri
@@ -0,0 +1,81 @@
+# hook addon for enable direct rendering
+
+#TCOS_XORG_DRI=
+#TCOS_XORG_DRI_INTEL=
+#TCOS_XORG_DRI_ATI=
+#TCOS_XORG_DRI_SAVAGE=
+#TCOS_XORG_DRI_SIS=
+#TCOS_XORG_DRI_TRIDENT=
+#TCOS_XORG_DRI_UNICHROME=
+#TCOS_XORG_DRI_MATROX=
+
+DRI_DIR=/usr/lib/dri/
+[ -d $LIB_MULTIARCH/dri ] && DRI_DIR=$LIB_MULTIARCH/dri/
+
+mkdir -p ${DESTDIR}/${DRI_DIR}
+
+copy_dri() {
+ [ -e "${DRI_DIR}/$1" ] && cpifexists ${DRI_DIR}/$1 ${DRI_DIR}
+}
+
+
+if [ $TCOS_XORG_DRI_INTEL ]; then
+ stat_before
+ copy_dri i810_dri.so
+ copy_dri i915_dri.so
+ copy_dri i965_dri.so
+ stat_after "Intel DRI"
+fi
+
+if [ $TCOS_XORG_DRI_ATI ]; then
+ stat_before
+ copy_dri r128_dri.so
+ copy_dri r200_dri.so
+ copy_dri r300_dri.so
+ copy_dri r600_dri.so
+ copy_dri radeon_dri.so
+ stat_after "ATI DRI"
+fi
+
+if [ $TCOS_XORG_DRI_SAVAGE ]; then
+ stat_before
+ copy_dri s3v_dri.so
+ copy_dri savage_dri.so
+ stat_after "Savage DRI"
+fi
+
+if [ $TCOS_XORG_DRI_SIS ]; then
+ stat_before
+ copy_dri sis_dri.so
+ stat_after "SiS DRI"
+fi
+
+if [ $TCOS_XORG_DRI_TRIDENT ]; then
+ stat_before
+ copy_dri trident_dri.so
+ copy_dri tdfx_dri.so
+ stat_after "Trident DRI"
+fi
+
+if [ $TCOS_XORG_DRI_UNICHROME ]; then
+ stat_before
+ copy_dri unichrome_dri.so
+ stat_after "Unichrome DRI"
+fi
+
+if [ $TCOS_XORG_DRI_MATROX ]; then
+ stat_before
+ copy_dri mach64_dri.so
+ copy_dri mga_dri.so
+ stat_after "Matrox DRI"
+fi
+
+
+
+if [ $TCOS_XORG_DRI ]; then
+ _echo " ** WARNING: TCOS_XORG_DRI is deprecated, generate new config."
+fi
+
+# Software Rendering DRI extension (always copy)
+copy_dri swrast_dri.so
+
diff --git a/hooks-addons/51paquito b/hooks-addons/51paquito
new file mode 100644
index 0000000..5a66c3c
--- /dev/null
+++ b/hooks-addons/51paquito
@@ -0,0 +1,132 @@
+# hook addon for INTEL DOT STATION alias Paquito
+
+PAQUITO_MODULES="intel-agp agpgart i2c-i810 intelfb i810fb vfb video"
+
+
+make_launcher() {
+cat << EOF > ${DESTDIR}/scripts/tcos-bottom/16paquito
+#!/bin/sh
+#
+
+# new header not using prereqs
+if [ "\$1" = "prereqs" ]; then
+ echo ""
+ exit 0
+fi
+
+
+quiet=n
+
+
+. /scripts/functions
+. /conf/tcos.conf
+. /conf/tcos-run-functions
+
+# check if we are in paquito machine
+test1=0
+test1=\$(lspci | grep -c "PCTel Inc HSP MicroModem 56" )
+
+test2=0
+test2=\$(lspci|grep -c "Intel Corporation 82810 CGC")
+
+if [ "\$test1" = "0" ] || [ "\$test2" = "0" ] ; then
+ # not in paquito, exit now
+ exit 0
+fi
+
+log_begin_msg "Loading Intel Dot Station (Paquito) modules"
+
+ PAQUITO_MODULES="${PAQUITO_MODULES}"
+ _log "PAQUITO loading modules: \${PAQUITO_MODULES}"
+
+ for mod in \${PAQUITO_MODULES}; do
+ modprobe \$mod >> /tmp/initramfs.debug 2>&1
+ done
+
+ # test if we have intel-drv or i810
+ if [ -L /usr/lib/xorg/modules/drivers/i810_drv.so ]; then
+ configurexorg --newsettings --xdriver=intel --outputfile=/etc/X11/xorg.conf 2>> /tmp/initramfs.debug
+ else
+ configurexorg --newsettings --xdriver=i810 --outputfile=/etc/X11/xorg.conf 2>> /tmp/initramfs.debug
+ fi
+
+
+log_end_msg \$?
+
+EOF
+chmod +x ${DESTDIR}/scripts/tcos-bottom/16paquito
+
+}
+
+if [ "$(pathof Xorg)" = /usr/bin/Xorg ]; then
+ XORG=7
+else
+ XORG=6
+fi
+
+# test if we have intel-drv or i810
+if [ -L /usr/lib/xorg/modules/drivers/i810_drv.so ]; then
+ intel_driver=intel
+else
+ intel_driver=i810
+fi
+
+
+if [ $TCOS_PAQUITO ] && [ "$intel_driver" = "i810" ] ; then
+ stat_before
+
+ for mod in ${PAQUITO_MODULES}; do
+ manual_add_modules $mod
+ done
+
+ cpifexists /usr/lib/libI810XvMC.so.1 /usr/lib
+
+ mkdir -p ${DESTDIR}/usr/lib/dri
+ cpifexists /usr/lib/dri/i810_dri.so /usr/lib/dri
+
+ if [ $XORG = 6 ];then
+ if [ ! -e $DESTDIR/usr/X11R6/lib/modules/drivers/i810_drv.so ]; then
+ cp -ra /usr/X11R6/lib/modules/drivers/i810_drv.so $DESTDIR/usr/X11R6/lib/modules/drivers
+ fi
+ else
+ if [ ! -e $DESTDIR/usr/lib/xorg/modules/drivers/i810_drv.so ]; then
+ cp -ra /usr/lib/xorg/modules/drivers/i810_drv.so $DESTDIR/usr/lib/xorg/modules/drivers
+ fi
+ fi
+ make_launcher
+
+ stat_after "Intel Dot Station (Paquito) drivers support [i810]"
+
+elif [ $TCOS_PAQUITO ] && [ "$intel_driver" = "intel" ] ; then
+ stat_before
+
+ for mod in ${PAQUITO_MODULES}; do
+ manual_add_modules $mod
+ done
+
+ cpifexists /usr/lib/libI810XvMC.so.1 /usr/lib
+
+ mkdir -p ${DESTDIR}/usr/lib/dri
+ cpifexists /usr/lib/dri/i810_dri.so /usr/lib/dri
+ if [ $XORG = 6 ];then
+ if [ ! -e $DESTDIR/usr/X11R6/lib/modules/drivers/intel_drv.so ]; then
+ cp -ra /usr/X11R6/lib/modules/drivers/intel_drv.so $DESTDIR/usr/X11R6/lib/modules/drivers
+ fi
+ else
+ if [ ! -e $DESTDIR/usr/lib/xorg/modules/drivers/intel_drv.so ]; then
+ cp -ra /usr/lib/xorg/modules/drivers/intel_drv.so $DESTDIR/usr/lib/xorg/modules/drivers
+ fi
+ fi
+ make_launcher
+
+ stat_after "Intel Dot Station (Paquito) drivers support [intel]"
+
+
+elif [ $TCOS_PAQUITO ] && [ "$intel_driver" != "i810" ] && [ "$intel_driver" != "intel" ]; then
+ echo ""
+ echo " WARNING: Intel Dot Station (Paquito) enabled but don't have installed i810/intel video driver package"
+ echo ""
+ echo " Please install xserver-xorg-driver-i810 or xserver-xorg-video-intel"
+ echo ""
+fi
+
diff --git a/hooks-addons/51via_openchrome b/hooks-addons/51via_openchrome
new file mode 100644
index 0000000..3a13d2f
--- /dev/null
+++ b/hooks-addons/51via_openchrome
@@ -0,0 +1,111 @@
+# hook addon for thin clients with chip VIA
+
+make_launcher() {
+cat << EOF > ${DESTDIR}/scripts/tcos-bottom/15via_openchrome
+#!/bin/sh
+#
+
+# new header not using prereqs
+if [ "\$1" = "prereqs" ]; then
+ echo ""
+ exit 0
+fi
+
+
+quiet=n
+
+. /scripts/functions
+. /conf/tcos.conf
+. /conf/tcos-run-functions
+
+test1=0
+test1=\$(get_vga_vendor 1106)
+
+
+if [ "\$test1" != "1" ]; then
+ # not in client with chip VIA unichrome
+ exit 0
+fi
+
+log_begin_msg "Loading Via Openchrome drivers"
+
+ modprobe drm
+ modprobe via
+
+[ "\$TCOS_XORG_VIDEO_DRIVER" = "fullauto" ] && exit 0
+[ "\$TCOS_XORG_VIDEO_DRIVER" = "xorgauto" ] && exit 0
+
+ if [ -f /usr/lib/xorg/modules/drivers/openchrome_drv.so ]; then
+ configurexorg --newsettings --xdriver=openchrome --outputfile=/etc/X11/xorg.conf 2>> /tmp/initramfs.debug
+ else
+ configurexorg --newsettings --xdriver=via --outputfile=/etc/X11/xorg.conf 2>> /tmp/initramfs.debug
+ fi
+
+log_end_msg \$?
+
+EOF
+chmod +x ${DESTDIR}/scripts/tcos-bottom/15via_openchrome
+
+}
+
+if [ $TCOS_ETC_GENERIC ]; then
+ stat_before
+
+ manual_add_modules drm
+ manual_add_modules via-agp
+ manual_add_modules via
+ manual_add_modules i2c-viapro
+
+ stat_after "Generic VIA modules support"
+
+fi
+
+if [ $TCOS_XORG_DRIVER_OPENCHROME ];then
+
+ test_driver1=$(strings /usr/lib/xorg/modules/drivers/via_drv.so 2> /dev/null| grep -c openchrome)
+ test_driver2=$(strings /usr/lib/xorg/modules/drivers/openchrome_drv.so 2> /dev/null | grep -c openchrome)
+
+ if [ -z $TCOS_ETC_GENERIC ];then
+ manual_add_modules drm
+ manual_add_modules via-agp
+ manual_add_modules via
+ manual_add_modules i2c-viapro
+ fi
+
+ if [ $TCOS_XORG_DRIVER_OPENCHROME ] && [ "$test_driver1" != 0 ] ; then
+ stat_before
+ cpifexists /usr/lib/libviaXvMC.so /usr/lib
+ cpifexists /usr/lib/libviaXvMCPro.so /usr/lib
+ [ -e /etc/X11/XvMCConfig ] && cpifexists /etc/X11/XvMCConfig /etc/X11
+
+
+ mkdir -p ${DESTDIR}/usr/lib/dri
+ cpifexists /usr/lib/dri/unichrome_dri.so /usr/lib/dri
+ make_launcher
+
+ stat_after "VIA Openchrome driver support"
+
+ elif [ $TCOS_XORG_DRIVER_OPENCHROME ] && [ "$test_driver2" != 0 ] ; then
+ stat_before
+ manual_add_modules via_chrome9
+ cpifexists /usr/lib/libchromeXvMC.so /usr/lib
+ cpifexists /usr/lib/libchromeXvMCPro.so /usr/lib
+ [ -e /etc/X11/XvMCConfig ] && cpifexists /etc/X11/XvMCConfig /etc/X11
+
+ mkdir -p ${DESTDIR}/usr/lib/dri
+ cpifexists /usr/lib/dri/unichrome_dri.so /usr/lib/dri
+ make_launcher
+
+ stat_after "Openchrome driver support"
+
+
+ elif [ $TCOS_XORG_DRIVER_OPENCHROME ] && [ "$test_driver1" = 0 ] && [ "$test_driver2" = 0 ]; then
+ echo ""
+ echo " WARNING: Use Openchrome drivers enabled but don't have installed via/openchrome package"
+ echo ""
+ echo " Please install openchrome VIA drivers package"
+ echo ""
+ fi
+
+fi
+
diff --git a/hooks-addons/52intel b/hooks-addons/52intel
new file mode 100644
index 0000000..ba57bc6
--- /dev/null
+++ b/hooks-addons/52intel
@@ -0,0 +1,33 @@
+# hook for intel graphics card
+# Copyright Rubén Gómez Antolí <listas at mucharuina [.] com>
+
+
+cat << EOF > $DESTDIR/sbin/disable_dpms
+#!/bin/sh
+
+sleep 2
+waitforX || exit
+# disable dpms
+sleep 2
+xset -dpms
+
+EOF
+chmod +x $DESTDIR/sbin/disable_dpms
+
+
+cat << EOF > $DESTDIR/etc/X11/PreRun/30intel_dpms
+#!/bin/sh
+
+test1=0
+test1=\$(get_vga_vendor 8086)
+
+if [ "\$test1" = "1" ]; then
+ /sbin/disable_dpms &
+fi
+
+
+EOF
+
+chmod +x $DESTDIR/etc/X11/PreRun/30intel_dpms
+
+
diff --git a/hooks-addons/53mga b/hooks-addons/53mga
new file mode 100644
index 0000000..1111d87
--- /dev/null
+++ b/hooks-addons/53mga
@@ -0,0 +1,35 @@
+# hook addon for thin clients with chip Matrox MGA*
+
+cat << EOF > ${DESTDIR}/scripts/tcos-bottom/15mga
+#!/bin/sh
+#
+if [ "\$1" = "prereqs" ]; then
+ exit 0
+fi
+
+quiet=n
+
+. /scripts/functions
+. /conf/tcos.conf
+. /conf/tcos-run-functions
+
+#ids="2064w 1064sg 2164w g100 g200 g400 g550"
+test1=\$(get_vga_vendor "102B")
+
+
+if [ "\$test1" != "1" ]; then
+ # not in client with chip Matrox mga
+ exit 0
+else
+
+ if [ -f /usr/lib/xorg/modules/drivers/mga_drv.so ]; then
+ log_begin_msg "Loading support Matrox MGA driver"
+ configurexorg --newsettings --xdriver=mga --outputfile=/etc/X11/xorg.conf 2>> /tmp/initramfs.debug
+ log_end_msg \$?
+ fi
+
+fi
+
+
+EOF
+chmod +x ${DESTDIR}/scripts/tcos-bottom/15mga
diff --git a/hooks-addons/54devices b/hooks-addons/54devices
new file mode 100644
index 0000000..41355df
--- /dev/null
+++ b/hooks-addons/54devices
@@ -0,0 +1,76 @@
+# hooks addon to use terminal devices
+# need ltspfs
+# ltspfs
+# TCOS_REMOTEFS = shfs ltspfs
+
+mkdir -p $DESTDIR/etc/X11/PreRun/
+cat << EOF > $DESTDIR/etc/X11/PreRun/15ltspfs-set-xprop
+#!/bin/sh
+
+/bin/ltspfs-set-xprop >> /tmp/initramfs.debug 2>&1 &
+
+
+EOF
+
+chmod +x $DESTDIR/etc/X11/PreRun/15ltspfs-set-xprop
+
+
+
+create_launcher() {
+ cat << EOF > $DESTDIR/bin/ltspfs-set-xprop
+#!/bin/sh
+# wait for Xorg
+
+export DISPLAY=:0
+export XAUTHORITY=/root/.Xauthority
+
+if [ "\$1" != "now" ]; then
+ sleep 2
+fi
+
+echo "ltspfs-set-xprop::waitforX"
+waitforX || exit
+
+# wait until Xorg is complety started
+if [ "\$1" != "now" ]; then
+ sleep 5
+fi
+
+echo "ltspfs-set-xprop::setting xprop value"
+echo "xprop -root -f LTSPFS_TOKEN 8s -set LTSPFS_TOKEN \$(cat /var/run/ltspfs_token)"
+xprop -root -f LTSPFS_TOKEN 8s -set LTSPFS_TOKEN \$(cat /var/run/ltspfs_token)
+
+exit 0
+EOF
+ chmod +x $DESTDIR/bin/ltspfs-set-xprop
+}
+
+if [ "$TCOS_REMOTEFS" = "ltspfs" ]; then
+
+ create_launcher
+ cpifexists /usr/bin/xprop /usr/bin/
+
+ if [ -e /usr/bin/ltspfsd ]; then
+ stat_before
+ cpifexists /usr/bin/ltspfsd /usr/bin
+ stat_after "ltspfsd"
+
+ else
+ echo "ERROR:"
+ echo ""
+ echo "Not LTSPFS support, please install ltspfsd-core."
+ echo ""
+ echo ""
+ fi
+fi
+
+if [ $TCOS_NTFS_3G ] && [ ! -e /usr/share/initramfs-tools/hooks/ntfs_3g ]; then
+ stat_before
+ # copy ntfs-3g bin and force load fuse
+ cpifexists /usr/bin/ntfs-3g /usr/bin/
+ echo "/usr/bin/ntfs-3g /sbin/mount.ntfs-3g" >> $DESTDIR/conf/links
+ manual_add_modules fuse
+ echo "fuse" >> $DESTDIR/etc/modules
+ stat_after "NTFS-3G tools"
+fi
+
diff --git a/hooks-addons/55vnc b/hooks-addons/55vnc
new file mode 100644
index 0000000..b6dbcdd
--- /dev/null
+++ b/hooks-addons/55vnc
@@ -0,0 +1,40 @@
+# hooks addon to use X11VNC
+# need x11vnc package
+
+
+if [ ! ${TCOS_X11VNC} ]; then
+ _verbose "(55vnc) TCOS_X11VNC disabled"
+else
+ if [ ! -d /usr/share/doc/x11vnc ]; then
+ echo "WARNING:"
+ echo ""
+ echo "x11vnc not found, install x11vnc or disable TCOS_X11VNC."
+ echo " => # apt-get install x11vnc"
+ echo ""
+ else
+ stat_before
+ cpifexists /usr/bin/x11vnc /usr/bin/
+
+
+ cat <<EOF > $DESTDIR/sbin/startvnc
+#!/bin/sh
+# kill all x11vnc process
+killall x11vnc >/dev/null 2>&1
+sleep 1
+DISPLAY=:0 x11vnc -o /tmp/vnc.log -forever -shared -noshm -rfbauth /tmp/.tcosvnc
+#FIXME (daemonize ??)
+EOF
+ chmod +x $DESTDIR/sbin/startvnc
+ stat_after "x11vnc"
+
+# FIXME use inetd for launching (man x11vnc)
+#-inetd
+# Launched by inetd(8): stdio instead of listening socket. Note: if you are not redirecting stderr to a log
+# file (via shell 2> or -o option) you MUST also specify the -q option, otherwise the stderr goes to the
+# viewer which will cause it to abort. Specifying both -inetd and -q and no -o will automatically close the stderr.
+
+
+ fi
+fi #end of TCOS_X11VNC
+
+
diff --git a/hooks-addons/56rdesktop b/hooks-addons/56rdesktop
new file mode 100644
index 0000000..8f58de1
--- /dev/null
+++ b/hooks-addons/56rdesktop
@@ -0,0 +1,67 @@
+# hook for windows rdesktop
+
+
+if [ ! $TCOS_RDESKTOP ]; then
+ _verbose "(56rdesktop) TCOS_RDESKTOP"
+else
+ if [ ! -e /usr/bin/rdesktop ]; then
+ _echo " * rDesktop not installed"
+ fi
+ stat_before
+ cpifexists /usr/bin/rdesktop /usr/bin/
+ mkdir -p $DESTDIR/usr/share/
+ copydir /usr/share/rdesktop/ /usr/share/
+
+ if [ ${TCOS_PULSEAUDIO} ] && [ ${TCOS_SOUND} ]; then
+ # padsp pulseaudio support
+ cpifexists /usr/bin/padsp /usr/bin/
+ cpifexists /usr/lib/libpulsedsp.so /usr/lib/
+ fi
+
+cat << EOF > $DESTDIR/sbin/startrdesktop
+#!/bin/sh
+
+. /conf/tcos.conf
+. /conf/tcos-run-functions
+export DISPLAY=:0
+export HOME=/root
+
+if [ -f \$XAUTHORITY ]; then
+ TCOS_XORG_OPTS="\$TCOS_XORG_OPTS -auth \$XAUTHORITY"
+fi
+
+XKB=\${TCOS_XORG_XKB}
+if [ "\${XKB}" = "br" ]; then
+ XKB="pt-br"
+fi
+
+
+Xorg \${TCOS_XORG_OPTS} >> /tmp/initramfs.debug 2>&1 &
+
+sleep 2
+waitforX || exit
+sleep 1
+
+# default server
+RDESKTOP_SERVER=\$(read_server 'rdesktop' "$TCOS_RDESKTOP_SERVER")
+RDESKTOP_CMD="/usr/bin/rdesktop -5 -u \"\" -f -a 16 -k \${XKB} \${RDESKTOP_SERVER}"
+
+if [ -x /usr/bin/padsp ] && [ -d /proc/asound ]; then
+ RDESKTOP_CMD="padsp -s localhost /usr/bin/rdesktop -5 -r sound -u \"\" -f -a 16 -k \${XKB} \${RDESKTOP_SERVER}"
+fi
+
+# -r sound
+# -u "" # empty username
+# -f -a 16 fullscreen and 16 color bits
+while [ 1 ]; do
+ xterm -e "echo Connecting with \" \${RDESKTOP_SERVER}...\" ; sleep 1 ; \${RDESKTOP_CMD} >/tmp/rdesktop 2>&1; echo \"Connection closed.\"; sleep 2"
+done
+
+EOF
+
+chmod +x $DESTDIR/sbin/startrdesktop
+
+# old redesktop cmd
+#/usr/bin/rdesktop -5 -f -a 16 -k \${XKB} -T "Remotedesktop-Client: \${rdesktop}" \${rdesktop} > /dev/null 2>&1
+stat_after "rDesktop"
+fi
diff --git a/hooks-addons/57ntpdate b/hooks-addons/57ntpdate
new file mode 100644
index 0000000..4fbe007
--- /dev/null
+++ b/hooks-addons/57ntpdate
@@ -0,0 +1,14 @@
+# hook to update date/time in thin clients
+
+
+if [ ! $TCOS_NTPDATE ]; then
+ _verbose "(57ntpdate) TCOS_NTPDATE"
+else
+ if [ ! -e /usr/sbin/ntpdate ]; then
+ _echo " * ntpdate not installed"
+ fi
+ stat_before
+ cpifexists /usr/sbin/ntpdate /usr/bin/
+ stat_after "ntpdate"
+
+fi
diff --git a/hooks-addons/59freenx b/hooks-addons/59freenx
new file mode 100644
index 0000000..6e557b2
--- /dev/null
+++ b/hooks-addons/59freenx
@@ -0,0 +1,141 @@
+# hooks addon of FreeNX
+# need nxclient installed
+
+
+if [ ! ${TCOS_FREENX} ]; then
+ _verbose "(59freenx) TCOS_FREENX disabled"
+else
+ stat_before
+ mkdir -p $DESTDIR/usr/NX/bin
+ mkdir -p $DESTDIR/usr/NX/lib
+ mkdir -p $DESTDIR/usr/NX/share
+ mkdir -p $DESTDIR/usr/NX/share/keys
+
+# mkdir -p $DESTDIR/etc/nxserver/
+#cat << EOF > $DESTDIR/etc/nxserver/node.conf
+#COMMAND_XAUTH=/usr/bin/xauth
+#ENABLE_SSH_AUTHENTICATION="1"
+#EOF
+
+ #FIXME
+ # to work sound need esddsp and this vars
+ ##ENABLE_ESD_PRELOAD="0"
+ ##ESD_BIN_PRELOAD="esddsp"
+ # not know if needed
+ # ssh ssh-keygen md5sum
+ # AGENT_EXTRA_OPTIONS_X commented as Antonio Quesada said
+# firewalled freenx (by Antonio Quesada)
+# $ssh -l pepito -C -2 -L 5000:serverNX:22 dominio.com
+#
+#pepito= cuenta de usuario registrado en el fw
+#serverNX= hostname del servidor NX al que queremos acceder
+#dominio.com= el fw, claro está.
+#5000= Puerto local al que queremos redirigir, puedes escoger el que quieras
+#22= Salvo que redirijas a otro puerto, el NX está a la escucha en el ssh
+#-C -2= utilizar ssh 2 y comprimido
+
+#ahora llamamos al NXclient y le decimos que el servidor es localhost y que se
+#conecte al puerto 5000 o al que hayamos decidido en la opción -L xxxx:
+
+ cpifexists /usr/NX/bin/nxclient /usr/NX/bin/
+ cpifexists /usr/NX/bin/nxesd /usr/NX/bin/
+ cpifexists /usr/NX/bin/nxssh /usr/NX/bin/
+
+ # firewalled connection
+ cpifexists /usr/bin/ssh /usr/bin/
+ cpifexists /usr/bin/ssh-keygen /usr/bin/
+
+# expect runs on server
+# cpifexists /usr/bin/expect /usr/bin/
+
+ #copydir /usr/NX/share/keyboards/ /usr/NX/share/
+ cpifexists /usr/NX/share/keyboards /usr/NX/share/
+ cpifexists /usr/NX/share/keys/server.id_dsa.key /usr/NX/share/keys/
+ copydir /usr/NX/share/images /usr/NX/share/
+
+ cpifexists /lib/libpthread.so.0 /lib/
+ if [ ! -d /usr/share/doc/libstdc++2.10-glibc2.2/ ]; then
+ _echo " ** ERROR: need to install libstdc++2.10-glibc2.2 package for FreeNX"
+ else
+ cpifexists /usr/lib/libstdc++-libc6.2-2.so.3 /usr/lib/
+ fi
+ cpifexists /usr/NX/lib/libcrypto.so /usr/NX/lib/
+ cpifexists /usr/NX/lib/libjpeg.so /usr/NX/lib/
+ cpifexists /usr/NX/lib/libpng12.so /usr/NX/lib/
+ cpifexists /usr/NX/lib/libXcomp.so /usr/NX/lib/
+ cpifexists /usr/NX/lib/libz.so /usr/NX/lib/
+
+ # not know if necesary
+ cpifexists /usr/lib/libXcomp.so.1 /usr/lib/
+ cpifexists /usr/lib/libXcompext.so.1 /usr/lib/
+ cpifexists /usr/lib/libaudiofile.so.0 /usr/lib/
+
+ #echo "/usr/NX/lib" >> $DESTDIR/etc/ld.so.conf
+
+ stat_after "FreeNX"
+fi # end of TCOS_FREENX
+
+
+
+if [ ${TCOS_FREENX_SQUASHFS} ]; then
+ stat_before
+
+ cat << EOF > ${DESTDIR}/scripts/tcos-premount/60freenx
+#!/bin/sh
+#
+
+# new header not using prereqs
+if [ "\$1" = "prereqs" ]; then
+ echo ""
+ exit 0
+fi
+
+
+quiet=n
+
+. /scripts/functions
+. /conf/tcos.conf
+. /conf/tcos-run-functions
+
+TCOS_FREENX_SQUASHFS_FILE=\$(read_cmdline_var "freenx" "")
+
+if [ "\$TCOS_FREENX_SQUASHFS_FILE" = "" ]; then
+ exit 0
+fi
+
+# load modules
+modprobe -q loop >> /tmp/initramfs.debug 2>&1
+modprobe -q squashfs >> /tmp/initramfs.debug 2>&1
+modprobe -q unionfs >> /tmp/initramfs.debug 2>&1
+
+value=0
+log_begin_msg "Downloading FREENX squashfs"
+ download_file /tcos/\${TCOS_FREENX_SQUASHFS_FILE} /mnt/tmp/nxclient.squashfs || value=1
+ sync
+ sleep 1
+log_end_msg \$value
+
+# Mount squashfs filesystems
+log_begin_msg "Mounting FREENX filesystem"
+ mkdir -p /usr/NX
+ mount -r -o loop -t squashfs /mnt/tmp/\${TCOS_FREENX_SQUASHFS_FILE} /usr/NX >> /tmp/initramfs.debug 2>&1
+log_end_msg \$?
+
+# download settings
+mkdir -p /root/.nx/config
+download_file /tcos/nxclient.cfg /root/.nx/config/nxclient.cfg
+download_file /tcos/servidor.nxs /root/.nx/config/servidor.nxs
+
+
+echo "TCOS_XORG_TYPE=\"F\"" >> /conf/tcos.conf
+
+EOF
+
+chmod +x ${DESTDIR}/scripts/tcos-premount/60freenx
+
+
+ # needed libs (libstdc++2.10-glibc2.2 package)
+ cpifexists /usr/lib/libstdc++-libc6.2-2.so.3 /usr/lib/
+
+ stat_after "FreeNX squashfs"
+fi
diff --git a/hooks-addons/60italc b/hooks-addons/60italc
new file mode 100644
index 0000000..1377418
--- /dev/null
+++ b/hooks-addons/60italc
@@ -0,0 +1,119 @@
+# hooks addon to use iTALC vnc MasterEye
+# need italc-client
+# also copy xmessage instead of messageviewer
+# that don't need qt libs
+
+if [ ! ${TCOS_ITALC} ]; then
+ _verbose "(60italc) TCOS_ITALC disabled"
+else
+
+ if [ -x /usr/bin/ica ]; then
+ # new italc 1.0.0 version
+ stat_before
+ if [ ! -d /etc/italc/keys/public ]; then
+ echo ""
+ echo "ERROR:"
+ echo " You must create public/private iTALC keys:"
+ echo ""
+ echo " # ica -role teacher -createkeypair "
+ echo ""
+ else
+ cpifexists /usr/bin/ica /usr/bin/
+ mkdir -p $DESTDIR/etc/italc/keys
+ cp -ra /etc/italc/keys/public $DESTDIR/etc/italc/keys/
+ cat <<EOF > $DESTDIR/sbin/startica
+#!/bin/sh
+# kill
+killall ica >/dev/null 2>&1
+sleep 4
+export DISPLAY=:0
+
+while [ 1 ]; do
+ killall ica
+ ica >/dev/null 2>&1
+done
+
+EOF
+ chmod +x $DESTDIR/sbin/startica
+ fi
+
+ stat_after "iTalc 1.0.0"
+
+ elif [ -x /usr/bin/ivs ]; then
+ stat_before
+ cpifexists /usr/bin/ivs /usr/bin/
+ cpifexists /usr/bin/demoviewer /usr/bin/
+ cpifexists /usr/bin/screenlocker /usr/bin/
+
+ #cpifexists /usr/bin/messageviewer /usr/bin/
+ # messageviewer need qt libs
+ # ugly wrapper less ram
+
+ cpifexists /usr/bin/xmessage /usr/bin/
+ # overwrite, not link
+ rm $DESTDIR/usr/bin/xmessage
+ cp $(pathof xmessage) $DESTDIR/usr/bin/
+ mv $DESTDIR/usr/bin/xmessage $DESTDIR/usr/bin/messageviewer
+
+ if [ ${TCOS_ADMIN_USER} ]; then
+ # search public italc key
+ if [ ! -f /etc/italc-client/public-keys/${TCOS_ADMIN_USER}.public ]; then
+ # try to find in $HOME dir
+ if [ "${TCOS_ADMIN_USER}" = "root" ]; then
+ key=/root/.italc/id_rsa.public
+ else
+ home=$(getent passwd | grep "^${TCOS_ADMIN_USER}:" | awk -F":" '{print $6}')
+ key=${home}/.italc/id_rsa.public
+ fi
+ else
+ key=/etc/italc-client/public-keys/${TCOS_ADMIN_USER}.public
+ fi
+
+ if [ ! -f ${key} ]; then
+ _echo "WARNING:"
+ _echo " ${key} not found"
+ _echo " You can generate running italc as ${TCOS_ADMIN_USER} for first time"
+ _echo " or running italc-keygen"
+ else
+ mkdir -p $DESTDIR/etc/italc-client/public-keys/
+ cp ${key} $DESTDIR/etc/italc-client/public-keys/ 2>&1 > /dev/null
+ mv $DESTDIR/etc/italc-client/public-keys/id_rsa.public $DESTDIR/etc/italc-client/public-keys/${TCOS_ADMIN_USER}.public 2>&1 > /dev/null
+ cp $DESTDIR/etc/italc-client/public-keys/${TCOS_ADMIN_USER}.public $DESTDIR/etc/italc-client/public-keys/root.public 2>&1 > /dev/null
+ fi
+
+ else
+ _echo "WARNING: Unknow TCOS_ADMIN_USER, iTALC need public user key to allow connections"
+ _echo " Please fill TCOS_ADMIN_USER value"
+ fi
+
+
+
+ cat <<EOF > $DESTDIR/sbin/startivs
+#!/bin/sh
+# kill and wait until Xorg is started
+killall ivs >/dev/null 2>&1
+sleep 1
+DISPLAY=:0 ivs -o /tmp/ivs.log -noshm -forever -shared
+
+#(start again if italc kill it ??)
+#while [ 1 ] ; do
+# killall -9 ivs >/dev/null 2>&1
+# sleep 1
+# DISPLAY=:0 ivs -o /tmp/ivs.log -noshm -forever -shared
+# sleep 2
+#done
+exit 0
+EOF
+ chmod +x $DESTDIR/sbin/startivs
+ stat_after "iTALC"
+
+ else
+ echo "WARNING:"
+ echo ""
+ echo "italc-client not found, install italc-client or disable TCOS_ITALC."
+ echo " => # apt-get install italc-client"
+ echo ""
+ fi
+
+fi #end of TCOS_ITALC
+
diff --git a/hooks-addons/65web_browser b/hooks-addons/65web_browser
new file mode 100644
index 0000000..76923de
--- /dev/null
+++ b/hooks-addons/65web_browser
@@ -0,0 +1,51 @@
+# hooks addon embedded web browser
+# need links2 or dillo
+# dillo copy some system fonts (25 Mb)
+
+
+if [ "${TCOS_WEB_BROWSER}" = "dillo" ]; then
+ if [ ! -d /usr/share/doc/dillo ]; then
+ echo "WARNING"
+ echo ""
+ echo "Please install dillo package or disable WEB BROWSER support."
+ echo " => apt-get install dillo"
+ echo ""
+ else
+ stat_before
+ cpifexists /usr/bin/dillo /usr/bin/
+ cpifexists /usr/bin/dillocfg /usr/bin/
+ cpifexists /usr/bin/dpid /usr/bin/
+ #cpifexists /usr/bin/dpidc /usr/bin/ # FIXME this need perl :(
+ cpifexists /etc/dillorc /etc/
+ cpifexists /etc/dpidrc /etc/
+
+ mkdir -p $DESTDIR/usr/lib/dillo/
+ copydir /usr/lib/dillo/dpi /usr/lib/dillo/
+ mkdir -p $DESTDIR/etc/fonts/
+ cpifexists /etc/fonts/fonts.conf /etc/fonts/
+ copydir /usr/share/fonts /usr/share/
+ rm -rf $DESTDIR/usr/share/fonts/X11/
+ stat_after "Dillo, web browser"
+ fi
+fi
+
+
+if [ "${TCOS_WEB_BROWSER}" = "links2" ]; then
+ if [ ! -d /usr/share/doc/links2 ]; then
+ echo "WARNING"
+ echo ""
+ echo "Please install links2 package or disable WEB BROWSER support."
+ echo " => apt-get install links2"
+ echo ""
+ else
+ stat_before
+ cpifexists /usr/bin/links2 /usr/bin/
+ cpifexists /usr/bin/xlinks2 /usr/bin/
+
+ stat_after "Links2, web browser"
+ fi
+fi
+
+if [ ! $TCOS_WEB_BROWSER ]; then
+ _verbose "(65web_browser) TCOS_WEB_BROWSER disabled"
+fi
diff --git a/hooks-addons/70tcosmonitor b/hooks-addons/70tcosmonitor
new file mode 100644
index 0000000..fa179cb
--- /dev/null
+++ b/hooks-addons/70tcosmonitor
@@ -0,0 +1,127 @@
+# this file copies tcosxmlrpc server into initramfs
+# and adds startup scripts of tcosxmlrpc server
+
+if [ $TCOS_MONITOR ]; then
+
+stat_before
+
+# EJECT for mount/umount cdrom
+copy_exec /usr/bin/eject /usr/bin/
+
+
+# SCROT package
+copy_exec /usr/bin/scrot /usr/bin/
+mkdir -p $DESTDIR/usr/lib/imlib2/filters/
+mkdir -p $DESTDIR/usr/lib/imlib2/loaders/
+cpifexists /usr/lib/imlib2/loaders/png.so /usr/lib/imlib2/loaders/
+cpifexists /usr/lib/imlib2/loaders/jpeg.so /usr/lib/imlib2/loaders/
+#cpifexists /usr/lib/imlib2/loaders/gif.so /usr/lib/imlib2/loaders/
+
+# screenshot script and webserver
+cpifexists ${TCOS_BINS}/screenshot.sh /sbin/
+
+cpifexists ${TCOS_BINS}/useallmodules.sh /sbin/
+cpifexists ${TCOS_BINS}/devicesctl.sh /sbin/
+cpifexists ${TCOS_BINS}/vnc-controller.sh /sbin/
+cpifexists ${TCOS_BINS}/vlc-controller.sh /sbin/
+cpifexists ${TCOS_BINS}/rtp-controller.sh /sbin/
+cpifexists ${TCOS_BINS}/pactl-controller.sh /sbin/
+
+# new VNC client (avalaible in armel)
+mkdir -p $DESTDIR/etc/X11/app-defaults
+# don't run ShowPopup() with F8
+grep -v ShowPopup /etc/X11/app-defaults/Vncviewer > $DESTDIR/etc/X11/app-defaults/Vncviewer
+cpifexists /usr/bin/xtightvncviewer /usr/bin/
+
+cpifexists ${TCOS_BINS}/soundctl.sh /sbin/
+cpifexists ${TCOS_BINS}/configctl.sh /sbin/
+
+# udev process
+cpifexists ${TCOS_BINS}/tcos-udevd.sh /sbin/
+mkdir -p ${DESTDIR}/etc/udev/rules.d/
+cpifexists ${TCOS_DIR}/xmlrpc/050_tcos_devices.rules /etc/udev/rules.d/
+
+# with new kernels (>= 2.6.22) need mount/umount events
+cpifexists ${TCOS_BINS}/mount-listener /usr/sbin/
+cpifexists ${TCOS_BINS}/save-udev.sh /usr/sbin/
+cpifexists ${TCOS_BINS}/listener-daemon.sh /usr/sbin/
+cpifexists ${TCOS_BINS}/cdrom-mount /usr/sbin/
+
+# need udevinfo in listener-daemon.sh
+if [ ! -e /usr/bin/udevinfo ] || readlink /usr/bin/udevinfo | grep -q udevadm; then
+ cat << EOF > $DESTDIR/usr/bin/udevinfo
+#!/bin/sh
+/sbin/udevadm info \$@
+EOF
+ chmod +x $DESTDIR/usr/bin/udevinfo
+else
+ cpifexists /usr/bin/udevinfo /usr/bin/
+fi
+
+# tcosxmlrpc utils
+cpifexists ${TCOS_BINS}/tcosxmlrpc /usr/bin/
+cpifexists ${TCOS_BINS}/lockscreen /usr/bin/
+cpifexists ${TCOS_BINS}/screensize /usr/bin/
+cpifexists ${TCOS_BINS}/lockvlc /usr/bin/
+cpifexists ${TCOS_BINS}/lockvnc /usr/bin/
+cpifexists ${TCOS_BINS}/get_server /usr/bin/
+
+# copy locked image
+mkdir -p ${DESTDIR}/usr/share/tcos-core/
+if [ -e /usr/share/tcos-core/lockscreen-custom.png ];then
+ cp /usr/share/tcos-core/lockscreen-custom.png ${DESTDIR}/usr/share/tcos-core/
+else
+ cp /usr/share/tcos-core/lockscreen.png ${DESTDIR}/usr/share/tcos-core/
+fi
+
+
+cpifexists ${TCOS_BINS}/getinfo.sh /sbin/
+chmod +x $DESTDIR/sbin/getinfo.sh
+
+
+cat << EOF > $DESTDIR/sbin/restartx
+#!/bin/sh
+
+restartxorg &
+exit 0
+EOF
+chmod +x $DESTDIR/sbin/restartx
+
+
+# pci database
+copy_exec /usr/bin/lspci /usr/bin/
+mkdir -p $DESTDIR/usr/share/misc/
+[ -f /usr/share/misc/pci.ids ] && cpifexists /usr/share/misc/pci.ids /usr/share/misc/
+[ -f /usr/share/misc/pci.ids.gz ] && cpifexists /usr/share/misc/pci.ids.gz /usr/share/misc/
+
+
+
+cpifexists ${TCOS_DIR}/xmlrpc/abyss.conf /etc/
+cpifexists ${TCOS_DIR}/xmlrpc/mime.types /etc/
+
+# configure /etc/abyss.conf
+# abs path of mime.types
+sed -i s/"etc"/"\/etc"/g ${DESTDIR}/etc/abyss.conf
+
+# configure user
+sed -i s/"nobody"/"root"/g ${DESTDIR}/etc/abyss.conf
+
+mkdir -p $DESTDIR/var/log
+mkdir -p $DESTDIR/var/www
+
+# add launcher
+cat << EOF > $DESTDIR/sbin/startxmlrpc
+#!/bin/sh
+killall tcosxmlrpc >/dev/null 2>&1
+cd /
+/usr/bin/tcosxmlrpc /etc/abyss.conf >> /var/log/tcosxmlrpc.log 2>&1
+exit 0
+EOF
+chmod +x $DESTDIR/sbin/startxmlrpc
+
+
+stat_after "TcosMonitor"
+
+else
+ _verbose "(25tcosmonitor) TCOS_TCOSMONITOR Disabled"
+fi
diff --git a/hooks-addons/90plymouth b/hooks-addons/90plymouth
new file mode 100644
index 0000000..5c77148
--- /dev/null
+++ b/hooks-addons/90plymouth
@@ -0,0 +1,100 @@
+# hook-addon for plymouth support
+
+if [ ! -x /bin/plymouth ]; then
+ _verbose "(90plymouth) Plymouth not installed"
+else
+
+if [ $TCOS_DISABLE_PLYMOUTH ]; then
+ rm -f ${DESTDIR}/lib/plymouth 2>/dev/null
+ rm -f ${DESTDIR}/sbin/plymouthd 2>/dev/null
+ rm -f ${DESTDIR}/bin/plymouth 2>/dev/null
+ rm -rf ${DESTDIR}/usr/share/plymouth ${DESTDIR}/lib/plymouth ${DESTDIR}/usr/lib/plymouth 2>/dev/null
+ rm -f ${DESTDIR}/scripts/*/plymouth 2>/dev/null
+ cat << EOF > ${DESTDIR}/sbin/plymouthd
+#!/bin/sh
+exit 0
+EOF
+ chmod +x ${DESTDIR}/sbin/plymouthd
+ cp ${DESTDIR}/sbin/plymouthd ${DESTDIR}/bin/plymouth
+ _verbose "(90plymouth) TCOS_DISABLE_PLYMOUTH enabled !!!"
+else #TCOS_DISABLE_PLYMOUTH not found
+
+stat_before
+
+
+
+cpifexists /sbin/plymouthd /sbin
+cpifexists /bin/plymouth /bin
+
+PLY_PATH="/usr/share/plymouth"
+
+# in ubuntu /lib/plymouth
+if [ -d /lib/plymouth/themes ]; then
+ PLY_PATH="/lib/plymouth"
+fi
+
+mkdir -p ${DESTDIR}/${PLY_PATH}
+mkdir -p ${DESTDIR}/${PLY_PATH}/renderers
+mkdir -p ${DESTDIR}/${PLY_PATH}/themes
+
+echo "TCOS $TCOS_VESRION" >> $DESTDIR/etc/debian_version
+
+THEMES="$PLY_PATH/themes"
+THEME=$(readlink -f ${THEMES}/${TCOS_PLYMOUTH}/${TCOS_PLYMOUTH}.plymouth)
+MODULE=$(grep "ModuleName *= *" ${THEME} | sed 's/ModuleName *= *//')
+TEXT_THEME=$(readlink -f ${THEMES}/text.plymouth)
+MODULE_TEXT=$(grep "ModuleName *= *" ${TEXT_THEME} | sed 's/ModuleName *= *//')
+
+# plugin that is always required
+cpifexists $PLY_PATH/details.so ${PLY_PATH}
+
+# copy the default themes
+cp -a ${PLY_PATH}/themes/details ${DESTDIR}${PLY_PATH}/themes/
+
+
+if [ -n "$TEXT_THEME" ]; then
+ rm -f ${DESTDIR}${PLY_PATH}/themes/text.plymouth 2>/dev/null
+ ln -s $TEXT_THEME ${DESTDIR}${PLY_PATH}/themes/text.plymouth
+ cp -a $(dirname $TEXT_THEME) ${DESTDIR}${PLY_PATH}/themes/
+ cpifexists /lib/plymouth/$MODULE_TEXT.so ${PLY_PATH}
+fi
+
+
+if [ -n "$THEME" ]; then
+ rm -f ${DESTDIR}${PLY_PATH}/themes/default.plymouth 2>/dev/null
+ ln -s $THEME ${DESTDIR}${PLY_PATH}/themes/default.plymouth
+ cp -a $(dirname $THEME) ${DESTDIR}${PLY_PATH}/themes/
+ cpifexists ${PLY_PATH}/$MODULE.so ${PLY_PATH}
+
+ # if we have a non-text theme, make sure we copy all the support libs
+ cpifexists ${PLY_PATH}/label.so ${PLY_PATH}
+
+ # output renderers
+ cpifexists ${PLY_PATH}/renderers/frame-buffer.so ${PLY_PATH}/renderers/
+ cpifexists ${PLY_PATH}/renderers/drm.so ${PLY_PATH}/renderers/
+ cpifexists ${PLY_PATH}/renderers/vga16fb.so ${PLY_PATH}/renderers/
+
+ [ -e $PLY_PATH/${TCOS_PLYMOUTH}.png ] && cp $PLY_PATH/${TCOS_PLYMOUTH}.png ${DESTDIR}${PLY_PATH}
+ [ -e $PLY_PATH/ubuntu-logo.png ] && cp $PLY_PATH/ubuntu-logo.png ${DESTDIR}${PLY_PATH}
+ [ -e $PLY_PATH/debian-logo.png ] && cp $PLY_PATH/debian-logo.png ${DESTDIR}${PLY_PATH}
+
+ # and copy the font support files needed in order to actually display
+ # any text
+ mkdir -p ${DESTDIR}/usr/share/fonts/truetype/ttf-dejavu
+ mkdir -p ${DESTDIR}/etc/fonts/conf.d
+ mkdir -p ${DESTDIR}/usr/lib/pango/1.6.0/module-files.d
+ mkdir -p ${DESTDIR}/usr/lib/pango/1.6.0/modules
+ [ -e /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf ] && \
+ cp /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf ${DESTDIR}/usr/share/fonts/truetype/ttf-dejavu/
+ cp /etc/fonts/fonts.conf ${DESTDIR}/etc/fonts/fonts.conf
+ cp -L /etc/fonts/conf.d/60-latin.conf ${DESTDIR}/etc/fonts/conf.d
+ cp /usr/lib/pango/1.6.0/module-files.d/libpango1.0-0.modules ${DESTDIR}/usr/lib/pango/1.6.0/module-files.d/
+ cp /usr/lib/pango/1.6.0/modules/pango-basic-fc.so ${DESTDIR}/usr/lib/pango/1.6.0/modules/pango-basic-fc.so
+fi
+
+stat_after "Plymouth support"
+
+
+fi
+
+fi
diff --git a/hooks-addons/90usplash b/hooks-addons/90usplash
new file mode 100644
index 0000000..38e1178
--- /dev/null
+++ b/hooks-addons/90usplash
@@ -0,0 +1,22 @@
+# hook-addon for disable usplash support
+
+if [ $TCOS_DISABLE_UPLASH ]; then
+ rm -f ${DESTDIR}/lib/usplash
+ rm -f ${DESTDIR}/sbin/usplash
+ rm -f ${DESTDIR}/sbin/usplash_write
+ rm -f $DESTDIR/usr/lib/usplash/*.so
+ cat << EOF > ${DESTDIR}/sbin/usplash
+#!/bin/sh
+exit 0
+EOF
+ chmod +x ${DESTDIR}/sbin/usplash
+ cat << EOF > ${DESTDIR}/sbin/usplash_write
+#!/bin/sh
+exit 0
+EOF
+ chmod +x ${DESTDIR}/sbin/usplash_write
+ _verbose "(90usplash) TCOS_DISABLE_USPLASH enabled !!!"
+
+fi # end if TCOS_DISABLE_USPLASH
+
+
diff --git a/hooks-addons/91splashy b/hooks-addons/91splashy
new file mode 100644
index 0000000..09b6288
--- /dev/null
+++ b/hooks-addons/91splashy
@@ -0,0 +1,65 @@
+#
+#
+#
+# splashy_update commands
+#
+#cmd = "progress",
+#cmd = "PROGRESS",
+#cmd = "print",
+#cmd = "TEXT",
+#cmd = "scroll",
+#cmd = "SCROLL",
+#cmd = "CLEAR",
+#cmd = "clear",
+#cmd = "chvt",
+#cmd = "allowchvt",
+#cmd = "exit",
+#cmd = "QUIT",
+#cmd = "getstring",
+#cmd = "getpass",
+#cmd = "chroot",
+
+
+if [ -x /sbin/splashy_update ]; then
+
+ rm -rf $DESTDIR/etc/splashy
+ mkdir -p $DESTDIR/etc/splashy/themes
+
+ cat << EOF > $DESTDIR/etc/splashy/config.xml
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Automatically generated by gentcos. Do not edit -->
+<splashy>
+ <!-- themes directory: conventional path /etc/splashy/themes -->
+ <themes>/etc/splashy/themes</themes>
+ <!-- current theme could be relative the themes defined above or full path -->
+ <current_theme>tcos</current_theme>
+ <!-- full path to theme to fall back in case of problems. DO NOT CHANGE -->
+ <default_theme>/etc/splashy/themes/default</default_theme>
+ <pid>/etc/splashy/splashy.pid</pid>
+</splashy>
+EOF
+
+ cp -ra /etc/splashy/themes/tcos $DESTDIR/etc/splashy/themes
+
+
+ cpifexists /sbin/splashy /sbin
+ cpifexists /sbin/splashy_chvt /sbin
+ cpifexists /sbin/splashy_update /sbin
+
+ mv $DESTDIR/usr/lib/directfb-1.0-0/ $DESTDIR/lib/directfb-1.0-0/
+ cat << EOF > $DESTDIR/scripts/init-top/00_splashy
+#!/bin/sh
+
+# new header not using prereqs
+if [ "\$1" = "prereqs" ]; then
+ echo ""
+ exit 0
+fi
+
+mkdir -p /usr/lib
+ln -s /lib/directfb-1.0-0 /usr/lib/directfb-1.0-0
+
+
+EOF
+chmod +x $DESTDIR/scripts/init-top/00_splashy
+fi
diff --git a/hooks-addons/95usplash_timeout b/hooks-addons/95usplash_timeout
new file mode 100644
index 0000000..b5e8e6d
--- /dev/null
+++ b/hooks-addons/95usplash_timeout
@@ -0,0 +1,74 @@
+# Add timeout on usplash startup script
+
+if [ -e $DESTDIR/scripts/init-top/usplash -o -e /scripts/init-top/plymouth -o -e /scripts/init-top/00_splashy ]; then
+
+ _echo " * Applying usplash timeout patch"
+
+cat << EOF > $DESTDIR/scripts/init-top/00_nosplash
+#!/bin/sh
+
+# new header not using prereqs
+if [ "\$1" = "prereqs" ]; then
+ echo ""
+ exit 0
+fi
+
+. /scripts/functions
+. /conf/tcos.conf
+. /conf/tcos-run-functions
+
+# kill usplash if cmdline have "nousplash" or "nosplash"
+for x in \$(cat /proc/cmdline); do
+ case \$x in
+ nosplash)
+ KILL_SPLASH=true
+ ;;
+ nousplash)
+ KILL_SPLASH=true
+ ;;
+ esac
+done
+
+if [ "\$KILL_SPLASH" = "true" ] ; then
+ echo -e "#!/bin/sh\nexit 0" > /scripts/init-top/framebuffer
+ [ -e /scripts/init-top/usplash ] && echo -e "#!/bin/sh\nexit 0" > /scripts/init-top/usplash
+ [ -e /scripts/init-top/plymouth ] && echo -e "#!/bin/sh\nexit 0" > /scripts/init-top/plymouth
+ [ -e /scripts/init-top/00_splashy ] && echo -e "#!/bin/sh\nexit 0" > /scripts/init-top/00_splashy
+fi
+
+
+EOF
+chmod +x $DESTDIR/scripts/init-top/00_nosplash
+
+else
+ _verbose "(95usplash_timeout) Splash not found, timeout path not applied."
+fi
+
+
+# add fancy startup messages
+
+cat << EOF >> $DESTDIR/scripts/functions
+
+log_use_fancy_output () {
+ TPUT=/bin/tput
+ EXPR=/bin/expr
+ if [ "x\$TERM" != "xdumb" ] && [ -x \$TPUT ] && [ -x \$EXPR ] && \$TPUT hpa 60 >/dev/null 2>&1 && \$TPUT setaf 1 >/dev/null 2>&1; then
+ [ -z \$FANCYTTY ] && FANCYTTY=1 || true
+ else
+ FANCYTTY=0
+ fi
+ case "\$FANCYTTY" in
+ 1|Y|yes|true) true;;
+ *) false;;
+ esac
+}
+
+FANCYTTY=
+[ -e /etc/lsb-base-logging.sh ] && . /etc/lsb-base-logging.sh || true
+
+EOF
+
+[ -e /etc/lsb-base-logging.sh ] && cpifexists /etc/lsb-base-logging.sh /etc
+cpifexists /usr/bin/tput /bin
+cpifexists /usr/bin/expr /bin
+
diff --git a/hooks-addons/96modules b/hooks-addons/96modules
new file mode 100644
index 0000000..251906a
--- /dev/null
+++ b/hooks-addons/96modules
@@ -0,0 +1,72 @@
+# hook addon for blacklist or add kernel modules options on startup
+
+stat_before
+
+cat << EOF > ${DESTDIR}/scripts/init-top/tcos_modules
+#!/bin/sh
+#
+
+# new header not using prereqs
+if [ "\$1" = "prereqs" ]; then
+ echo ""
+ exit 0
+fi
+
+
+quiet=n
+
+FORCE_MODULES=""
+BLACKLIST_MODULES=""
+
+for x in \$(cat /proc/cmdline); do
+ case \$x in
+ force_modules=*)
+ FORCE_MODULES="\$(echo \${x#force_modules=}|tr "," " ")"
+ ;;
+ blacklist_modules=*)
+ BLACKLIST_MODULES="\$(echo \${x#blacklist_modules=}|tr "," " ")"
+ ;;
+ esac
+done
+
+if [ "\$FORCE_MODULES" != "" ] ; then
+ for x in \$FORCE_MODULES ; do
+ modprobe -Q \$x 2>/dev/null || true
+ done
+fi
+
+if [ "\$BLACKLIST_MODULES" != "" ] ; then
+ for x in \$BLACKLIST_MODULES ; do
+ echo "blacklist \$x" >> /etc/modprobe.d/blacklist-tcos.conf 2>/dev/null || true
+ done
+fi
+
+
+# Fix corruption MAC address in Realtek PCI Express RTL810xE with kernel module r8169.ko
+if [ "\$(pcimodules | grep -c r8101)" != "0" ]; then
+ if [ "\$(modprobe -l | grep -c r8101)" != "0" ]; then
+ modprobe -Q r8101 2>/dev/null || true
+ if [ "\$(dmesg | grep -c -i rtl*810.e)" != "0" ]; then
+ echo "blacklist r8169" >> /etc/modprobe.d/blacklist-tcos.conf 2>/dev/null || true
+ else
+ modprobe -Q -r -f r8101 2>/dev/null || true
+ fi
+ else
+ echo -n -e "WARNING!!! Your computer has an Ethernet Realtek 810xE PCI Express does not work correctly with kernel module r8169. Please regenerate TCOS images, adding the extra kernel module r8101 and blacklisting r8169 kernel modules."
+ fi
+fi
+
+
+EOF
+chmod +x ${DESTDIR}/scripts/init-top/tcos_modules
+
+
+# add options to snd-hda-intel
+if ! grep -q snd-hda-intel ${DESTDIR}/etc/modprobe.d/alsa-base* ; then
+ [ -e ${DESTDIR}/etc/modprobe.d/alsa-base ] && \
+ mv ${DESTDIR}/etc/modprobe.d/alsa-base ${DESTDIR}/etc/modprobe.d/alsa-base.conf
+ echo "options snd-hda-intel model=auto" >> ${DESTDIR}/etc/modprobe.d/alsa-base.conf
+fi
+
+
+stat_after "Tcos Kernel modules support"
diff --git a/hooks-addons/99clean_nfs_image b/hooks-addons/99clean_nfs_image
new file mode 100644
index 0000000..90571e2
--- /dev/null
+++ b/hooks-addons/99clean_nfs_image
@@ -0,0 +1,68 @@
+# addon to clean initramfs-$(uname -r)-nfs
+
+# only exec in tcos-nfs boot
+if [ "${BOOT}" = "tcos-nfs" ]; then
+
+stat_before
+
+# not delete ide and ata
+#rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/ide
+#rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/ata
+#rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/scsi
+#rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/cdrom
+
+# delete fstab
+#rm -f ${DESTDIR}/scripts/tcos-top/*fstab
+
+
+# delete some kernel modules
+rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/usb
+rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/ieee1394
+rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/firewire
+rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/pcmcia
+rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/md
+rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/message
+
+# filesystems
+rm -rf ${DESTDIR}/lib/modules/${version}/kernel/fs/xfs
+rm -rf ${DESTDIR}/lib/modules/${version}/kernel/fs/reiserfs
+rm -rf ${DESTDIR}/lib/modules/${version}/kernel/fs/jfs
+rm -rf ${DESTDIR}/lib/modules/${version}/kernel/fs/ext3
+rm -rf ${DESTDIR}/lib/modules/${version}/kernel/fs/jbd
+rm -rf ${DESTDIR}/lib/modules/${version}/kernel/fs/isofs/
+
+
+# delete some bins
+rm -rf ${DESTDIR}/scripts/local*
+rm -rf ${DESTDIR}/scripts/nfs*
+rm -rf ${DESTDIR}/scripts/tcos-bottom
+rm -rf ${DESTDIR}/scripts/tcos-premount
+
+
+rm -rf ${DESTDIR}/sbin/vgchange
+rm -rf ${DESTDIR}/lib/libdevmapper*
+
+rm -f ${DESTDIR}/sbin/usplash*
+rm -rf ${DESTDIR}/usr/lib/usplash*
+rm -f ${DESTDIR}/lib*splash*
+rm -f ${DESTDIR}/scripts/init-top/*usplash*
+rm -f ${DESTDIR}/scripts/init-top/*framebuffer*
+
+rm -f ${DESTDIR}/sbin/resume
+rm -f ${DESTDIR}/bin/strace
+
+mv ${DESTDIR}/usr/lib/liblzo*so* ${DESTDIR}/lib/ >/dev/null 2>&1
+rm -rf ${DESTDIR}/usr/lib
+
+
+# add again ata scsi and ide modules
+tcos_manual_add_modules libata
+tcos_manual_add_modules scsi-mod
+tcos_manual_add_modules ide-generic
+tcos_manual_add_modules ata-generic
+tcos_manual_add_modules ide-cd
+
+
+stat_after "Clean NFS initramfs"
+
+fi
diff --git a/hooks-addons/99tcos b/hooks-addons/99tcos
new file mode 100644
index 0000000..91fd3d9
--- /dev/null
+++ b/hooks-addons/99tcos
@@ -0,0 +1,44 @@
+# save generated date and version into tcos.conf
+
+if [ -e /var/lib/tcos/version.conf ]; then
+ cat /var/lib/tcos/version.conf >> ${DESTDIR}/conf/tcos.conf
+fi
+
+
+# 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
+
+tcos_date=$(LANG=C LC_ALL=C date)
+echo "# date of image" >> ${DESTDIR}/conf/tcos.conf
+echo "TCOS_DATE=\"${tcos_date}\"" >> ${DESTDIR}/conf/tcos.conf
+echo "" >> ${DESTDIR}/conf/tcos.conf
+
+
+# export some vars
+echo "" >> ${DESTDIR}/conf/tcos.conf
+echo "# some environment vars" >> ${DESTDIR}/conf/tcos.conf
+echo "export XAUTHORITY=/root/.Xauthority" >> ${DESTDIR}/conf/tcos.conf
+echo "export HOME=/root" >> ${DESTDIR}/conf/tcos.conf
+echo "export DISPLAY=:0" >> ${DESTDIR}/conf/tcos.conf
+echo "export PATH=/bin:/sbin:/usr/bin:/usr/sbin" >> ${DESTDIR}/conf/tcos.conf
+
+
+cat << EOF > $DESTDIR/etc/issue
+TCOS $TCOS_VERSION \n \l
+
+
+EOF
+
+
+# reduce /dev tmpfs size to 5Mb
+if [ -e $DESTDIR/init ]; then
+ sed -i '/tmpfs_size/s/"10M"/"5M"/g' $DESTDIR/init
+fi
+if [ -e $DESTDIR/etc/udev/udev.conf ]; then
+ sed -i '/tmpfs_size/s/"10M"/"5M"/g' $DESTDIR/etc/udev/udev.conf
+fi
+
diff --git a/hooks-addons/clean_initramfs b/hooks-addons/clean_initramfs
new file mode 100755
index 0000000..9d10fc4
--- /dev/null
+++ b/hooks-addons/clean_initramfs
@@ -0,0 +1,205 @@
+# 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 "$LIB_MULTIARCH/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
+
+