Build LTSP thin client

# OPTIONAL: update debootstrap first
http://www.panticz.de/update_debootstrap

# build thin client image
# ltsp-build-client --arch=i386 --dist=trusty
# ltsp-build-client --dist=xenial --base /opt/ltsp/amd64-xenial
ltsp-build-client

# disable encryption
#cat <> /var/lib/tftpboot/ltsp/i386/lts.conf

cat <> /var/lib/tftpboot/ltsp/amd64/lts.conf
[default]
LDM_DIRECTX=True
LDM_SESSION="gnome-session --session=gnome-fallback"
EOF

# local apps (nvidia, virtualbox and firefox)
export LTSP_HANDLE_DAEMONS=false
ltsp-chroot -p -a amd64
LANG=en_US.UTF-8
apt-get update
apt-get dist-upgrade
echo "root:terceS" | chpasswd

# local browser
apt-get install -y firefox firefox-locale-de flashplugin-installer
apt-get install -y evince --no-install-recommends

# JAVA mozilla plugin
http://www.panticz.de/ubuntu_install_java_jre

# virtualbox
http://www.panticz.de/Install-VirtualBox
apt-get install -y linux-headers-$(uname -r)
/etc/init.d/vboxdrv setup

# wine
# http://www.panticz.de/install_wine
dpkg --add-architecture i386
apt-get update

# local wine
debconf-set-selections <<\EOF
msttcorefonts msttcorefonts/defoma note
ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula boolean true
ttf-mscorefonts-installer msttcorefonts/present-mscorefonts-eula note
EOF
apt-get install -y wine

# nvidia

# local cups
apt-get install -y cups

apt-get clean
apt-get autoremove

#umount /proc
exit

echo "LOCAL_APPS_MENU=True" >> /var/lib/tftpboot/ltsp/amd64/lts.conf
echo "MOUNT_LOCAL_MEDIA=True" >> /var/lib/tftpboot/ltsp/amd64/lts.conf
echo "LOCAL_APPS_EXTRAMOUNTS=/media,/opt" >> /var/lib/tftpboot/ltsp/amd64/lts.conf

# OPTIONAL: set password on ltsp client
export LTSP_HANDLE_DAEMONS=false
#chroot /opt/ltsp/i386/
chroot /opt/ltsp/amd64/
mount -t proc proc /proc
echo "root:t00r" | chpasswd
#umount /proc
exit

ltsp-update-image --arch=i386
ltsp-update-image #-a i386-nvidia-304

# LINKS
http://wiki.ubuntuusers.de/LTSP/lts.conf
https://wiki.ubuntu.com/DebugLocalDev
https://help.ubuntu.com/community/UbuntuLTSP/LTSP-Cluster

# dcim
cp /opt/ltsp/i386.org/etc/udev/rules.d/70-persistent-dcim.rules /opt/ltsp/i386/etc/udev/rules.d/
cp /opt/ltsp/i386.org/usr/sbin/mvdcim.sh /opt/ltsp/i386/usr/sbin/

cat <> /var/lib/tftpboot/ltsp/i386/lts.conf
[asuspc]
X_CONF = /etc/X11/ion.xorg.conf
EOF

#
# UPDATE
#
# backup
mv /opt/ltsp/i386/ /home/ltsp/i386.$(date -I)
mv /var/lib/tftpboot/ltsp/i386/ /var/lib/tftpboot/ltsp/i386.$(date -I)

# build
#ltsp-build-client --arch=i386 --dist=oneiric
ltsp-build-client --arch=i386 --dist=precise

# chroot
export LTSP_HANDLE_DAEMONS=false
chroot /opt/ltsp/i386/
mount -t proc proc /proc
apt-get update
apt-get -y dist-upgrade
#umount /proc
exit

# pxe boot file (boot from other tftpserver)
scp root@ts:/var/lib/tftpboot/ltsp/i386/vmlinuz-3.2.0-8-generic /var/lib/tftpboot/ltsp/vmlinuz
scp root@ts:/var/lib/tftpboot/ltsp/i386/initrd.img-3.2.0-8-generic /var/lib/tftpboot/ltsp/initrd.img

cat /var/lib/tftpboot/pxelinux.cfg/ltsp.conf
LABEL linux
MENU LABEL LTSP
kernel /ltsp/vmlinuz
append ro initrd=/ltsp/initrd.img nbdname=ltsp_i386 nbdserver=192.168.1.15 quiet splash

# Links
https://help.ubuntu.com/community/UbuntuLTSP
https://help.ubuntu.com/community/UbuntuLTSP/AMDE-350

# build precise boot image with trusty ltsp-client
ltsp-build-client --arch=i386 --dist=precise
# add repository
deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu trusty-security main restricted universe multiverse

# chroot
apt-get install ltsp-client ltsp-client-core ltspfsd ltspfsd-core

# OPTIONAL: clone amd64 dir
rm -r /opt/ltsp/amd64-nvidia.old /opt/ltsp/images/amd64-nvidia.img.old
mv /opt/ltsp/amd64-nvidia/ /opt/ltsp/amd64-nvidia.old
mv /opt/ltsp/images/amd64-nvidia.img /opt/ltsp/images/amd64-nvidia.img.old
cp -a /opt/ltsp/amd64/ /opt/ltsp/amd64-nvidia

# nvidia support
# http://wiki.ubuntuusers.de/Grafikkarten/Nvidia/nvidia
#ltsp-build-client --base /opt/ltsp --arch=i386 --dist=precise --chroot i386-nvidia-173
# ltsp-build-client --base /opt/ltsp --chroot amd64-nvidia
#sudo cp /etc/apt/sources.list /opt/ltsp/i386-nvidia-173/etc/apt/sources.list
export LTSP_HANDLE_DAEMONS=false
#chroot /opt/ltsp/amd64-nvidia/
#mount -t proc proc /proc
ltsp-chroot -p -a amd64-nvidia
LANG=en_US.UTF-8
apt-get update
apt-get dist-upgrade

# apt-get install -y linux-headers-$(uname -r)
# todo
# apt-get install -y linux-headers-3.13.0-35-generic
apt-get install -y linux-headers-generic
#apt-get install --reinstall nvidia-173

apt-get install -y wget build-essential
#apt-get install -y nvidia-173
apt-get install -y nvidia-304
#apt-get install -y nvidia-current
#apt-get install -y nvidia-current-updates
#apt-get install -y nvidia-331
#umount /proc
exit

ltsp-update-image amd64-nvidia
ltsp-update-kernels amd64-nvidia

# copy ltsp config to amd64-nvidia
[ ! -f /var/lib/tftpboot/ltsp/amd64-nvidia/lts.conf ] && ln /var/lib/tftpboot/ltsp/amd64/lts.conf /var/lib/tftpboot/ltsp/amd64-nvidia/lts.conf

# backup ltsp client image
mv /opt/ltsp/i386/ /opt/ltsp/i386.old
mv /opt/ltsp/images/i386.img /opt/ltsp/images/i386.img.old
mv /var/lib/tftpboot/ltsp/i386/ /var/lib/tftpboot/ltsp/i386.old

# Links
https://help.ubuntu.com/community/UbuntuLTSP/AtomIon