#!/bin/bash mkdir -p /raid5/nobackup/fe2root mkdir -p /mnt/ubiso [ -e /raid5/dobackup/home/storage/Exclude_from_backup/ubuntu-7.10-server-i386.iso ] || ( echo "can\'t find ISO image" && exit ) mount -t iso9660 -o ro,loop=/dev/loop0 /raid5/dobackup/home/storage/Exclude_from_backup/ubuntu-7.10-server-i386.iso /mnt/ubiso/ debootstrap --arch i386 gutsy /raid5/nobackup/fe2root file:/mnt/ubiso umount /mnt/ubiso rmdir /mnt/ubiso cat > /raid5/nobackup/fe2root/etc/fstab <<-delim via.xperim.be:/raid5/nobackup/fe2root / nfs rsize=8192,wsize=8192,nfsvers=3,actimeo=0,tcp,intr 0 0 tmpfs /tmp tmpfs size=128m,mode=1777 0 0 proc /proc proc defaults 0 0 sys /sys sysfs defaults 0 0 via.xperim.be:/raid5/nobackup/mythtv /var/lib/mythtv nfs rsize=8192,wsize=8192,nfsvers=3,actimeo=0,tcp,intr,noauto 0 0 via.xperim.be:/home/storage/Audio /home/storage/Audio nfs rsize=8192,wsize=8192,nfsvers=3,actimeo=0,tcp,intr,noauto 0 0 delim cat > /raid5/nobackup/fe2root/etc/network/interfaces <<-delim # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo eth0 iface lo inet loopback # The primary network interface iface eth0 inet static address 192.168.1.20 netmask 255.255.255.0 broadcast 192.168.1.255 network 192.168.1.0 gateway 192.168.1.5 delim echo fe2 > /raid5/nobackup/fe2root/etc/hostname echo http_proxy=http://via.xperim.be:3128 >> /raid5/nobackup/fe2root/etc/bash.bashrc cat /etc/apt/sources.list > /raid5/nobackup/fe2root/etc/apt/sources.list cat > /raid5/nobackup/fe2root/etc/hosts <<-delim 127.0.0.1 localhost 127.0.1.1 fe2.xperim.be fe2 # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts delim cat > /raid5/nobackup/fe2root/etc/resolv.conf <<-delim search xperim.be nameserver 192.168.15.1 delim echo LANG=\"en_US.UTF-8\" >> /raid5/nobackup/fe2root/etc/environment echo LANG=\"en_US.UTF-8\" > /raid5/nobackup/fe2root/etc/default/locale echo en_US.UTF-8 UTF-8 > /raid5/nobackup/fe2root/var/lib/locales/supported.d/local #cp -a /etc/alternatives/* /raid5/nobackup/fe2root/etc/alternatives echo export VISUAL=/usr/bin/vi >> /raid5/nobackup/fe2root/etc/profile cp /boot/memtest86* /raid5/nobackup/fe2root/boot mkdir -p /raid5/nobackup/fe2root/boot/pxelinux.cfg cp /usr/lib/syslinux/pxelinux.0 /raid5/nobackup/fe2root/boot cat > /raid5/nobackup/fe2root/boot/pxelinux.cfg/default <<-delim default Linux label Linux kernel /vmlinuz-2.6.22-14-generic append root=/dev/nfs nfsroot=192.168.1.11:/raid5/nobackup/fe2root initrd=/initrd.img-2.6.22-14-generic.fe2 ip=dhcp ro quiet splash label Linux (recovery mode) kernel /vmlinuz-2.6.22-14-generic append root=/dev/nfs nfsroot=192.168.1.11:/raid5/nobackup/fe2root initrd=/initrd.img-2.6.22-14-generic.fe2 ip=dhcp ro single label memtest86+ kernel /memtest86+.bin append quiet delim chmod 666 /raid5/nobackup/fe2root/boot/pxelinux.0 chmod 666 /raid5/nobackup/fe2root/boot/pxelinux.cfg/* cat > /raid5/nobackup/fe2root/dobootstrap <<-delim #!/bin/bash mount /proc mount /sys dpkg-reconfigure locales #dpkg-reconfigure console-setup adduser blah echo 'blah ALL=(ALL) ALL' >> /etc/sudoers chmod 0440 /etc/sudoers apt-key update apt-get -u update apt-get -y install localepurge apt-get -y install linux-image-generic linux-restricted-modules syslinux memtest86+ openssh-server nfs-client echo ext3 >> /etc/initramfs-tools/modules update-initramfs -u cd /bin && rm sh && ln -s /bin/bash /bin/sh dpkg-reconfigure tzdata apt-get -u update apt-get upgrade umount /sys umount /proc delim chmod +x /raid5/nobackup/fe2root/dobootstrap chroot /raid5/nobackup/fe2root /dobootstrap cat > /raid5/nobackup/fe2root/etc/motd.tail <<-delim Welcome to fe2.xperim.be. Unauthorised use prohibited. delim cat > /raid5/nobackup/fe2root/installapps <<-delim #!/bin/bash # mount /proc # mount /sys apt-get update apt-get upgrade apt-get -y install ntp vim-full apcupsd wget traceroute man-db lm-sensors htop debian-helper-scripts cpufrequtils sysstat yes | sensors-detect wget -q http://packages.medibuntu.org/medibuntu-key.gpg -O- | apt-key add - apt-get update apt-get -y install ubuntu-desktop mythbuntu-desktop mythbuntu-lirc-generator apt-get -y install xserver-xorg-video-openchrome x-ttcidfont-conf libviaxvmc1 libviaxvmcpro1 apt-get -y install ffmpeg libavcodec1d libavformat1d libavutil1d libpostproc1d libswscale1d libdvdcss2 libdvdcss2-dev apt-get -y install mythtv-backend mythtv-frontend # apt-get -y --force-yes install ubuntu-desktop mythbuntu-desktop xserver-xorg-video-openchrome mythtv-backend mythtv-frontend ffmpeg libavcodec1d libavformat1d libavutil1d libpostproc1d libswscale1d libdvdcss2 libdvdcss2-dev x-ttcidfont-conf mythbuntu-lirc-generator chown root.mythtv /etc/mythtv/mysql.txt apt-get -y --force-yes install webmin mv /etc/webmin/config /etc/webmin/config.orig grep -v referers_none < /etc/webmin/config.orig > /etc/webmin/config ### TODO: Check if DMA is enabled on DVD drive ### TODO: Check if Myth Transcoding Deamon is installed ### TODO: X config ### TODO: RNG driver ### TODO: remote setup ### DO THIS AT THE END cat \$0 > /root/timestamp.appsinstall chmod a-wx /root/timestamp.appsinstall echo Now log in using X and run mythtv-setup delim chmod +x /raid5/nobackup/fe2root/installapps #chroot /raid5/nobackup/fe2root /installapps cat > /raid5/nobackup/fe2root/etc/ntp.conf <<-delim driftfile /var/lib/ntp/ntp.drift statsdir /var/log/ntpstats/ logfile /var/log/ntp.log server via.xperim.be iburst disable auth delim mkdir -p /raid5/nobackup/fe2root/etc/apcupsd cat > /raid5/nobackup/fe2root/etc/apcupsd/apcupsd.conf <<-delim ## apcupsd.conf v1.1 ## UPSNAME belowtv UPSCABLE usb UPSTYPE usb DEVICE LOCKFILE /var/lock ONBATTERYDELAY 6 BATTERYLEVEL 5 MINUTES 5 TIMEOUT 0 ANNOY 300 ANNOYDELAY 60 NOLOGON disable KILLDELAY 0 NETSERVER on NISIP 0.0.0.0 NISPORT 3551 EVENTSFILE /var/log/apcupsd.events EVENTSFILEMAX 10 UPSCLASS standalone UPSMODE disable STATTIME 0 STATFILE /var/log/apcupsd.status LOGSTATS off DATATIME 0 delim mv /raid5/nobackup/fe2root/etc/default/apcupsd /raid5/nobackup/fe2root/etc/default/apcupsd.orig grep -v "ISCONFIGURED=no" < /raid5/nobackup/fe2root/etc/default/apcupsd.orig > /raid5/nobackup/fe2root/etc/default/apcupsd echo "ISCONFIGURED=yes" >> /raid5/nobackup/fe2root/etc/default/apcupsd mkdir -p /raid5/nobackup/fe2root/etc/mythtv cp /etc/mythtv/mysql.txt /raid5/nobackup/fe2root/etc/mythtv/mysql.txt cp /root/updateSystem /raid5/nobackup/fe2root/root/ cp /usr/bin/ntpStatus /raid5/nobackup/fe2root/usr/bin echo "*.info;mail.none;news.none;authpriv.none;cron.none;local0.none @via.xperim.be" >> /raid5/nobackup/fe2root/etc/syslog.conf chmod a+rw /raid5/nobackup/fe2root/dev/null cat > /raid5/nobackup/fe2root/etc/mythtv/mysql.txt <<-delim DBHostName=via.xperim.be # By default, Myth tries to ping the DB host to see if it exists. # If your DB host or network doesn't accept pings, set this to no: # DBHostPing=no DBUserName=mythtv DBPassword=whatever DBName=mythconverg DBType=QMYSQL3 # Set the following if you want to use something other than this # machine's real hostname for identifying settings in the database. # This is useful if your hostname changes often, as otherwise you # will need to reconfigure mythtv (or futz with the DB) every time. # TWO HOSTS MUST NOT USE THE SAME VALUE # #LocalHostName=my-unique-identifier-goes-here # If you want your frontend to be able to wake your MySQL server # using WakeOnLan, have a look at the following settings: # # # The time the frontend waits (in seconds) between reconnect tries. # This should be the rough time your MySQL server needs for startup # #WOLsqlReconnectWaitTime=0 # # # This is the number of retries to wake the MySQL server # until the frontend gives up # #WOLsqlConnectRetry=5 # # # This is the command executed to wake your MySQL server. # #WOLsqlCommand=echo 'WOLsqlServerCommand not set' delim # The following needs to be added to xorg.conf #Section "Module" # Disable "glx" # Disable "xtrap" # Disable "record" # Disable "GLcore" # Disable "dri" #EndSection mv /raid5/nobackup/fe2root/etc/rc.local /raid5/nobackup/fe2root/etc/rc.local.orig grep -v "exit 0" < /raid5/nobackup/fe2root/etc/rc.local.orig > /raid5/nobackup/fe2root/etc/rc.local echo "mount /var/lib/mythtv" >> /raid5/nobackup/fe2root/etc/rc.local echo "mount /home/storage/Audio" >> /raid5/nobackup/fe2root/etc/rc.local echo "setpci -v -d *:* latency_timer=b0" >> /raid5/nobackup/fe2root/etc/rc.local echo "setpci -v -s 00:0f.1 latency_timer=ff" >> /raid5/nobackup/fe2root/etc/rc.local echo "setpci -v -s 00:11.5 latency_timer=ff" >> /raid5/nobackup/fe2root/etc/rc.local echo "setpci -v -s 00:13.0 latency_timer=ff" >> /raid5/nobackup/fe2root/etc/rc.local echo "setpci -v -s 01:00.0 latency_timer=ff" >> /raid5/nobackup/fe2root/etc/rc.local echo "setpci -v -s 00:0e.0 latency_timer=ff" >> /raid5/nobackup/fe2root/etc/rc.local echo "/usr/bin/mtd --daemon" >> /raid5/nobackup/fe2root/etc/rc.local echo "ln -s /dev/hdb /dev/dvd" >> /raid5/nobackup/fe2root/etc/rc.local # See https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.15/+bug/26998 # In order to be able to enable DMA on the DVD drive, ide-generic must be # kept from loading. ### DO THIS AT THE END cat $0 > /raid5/nobackup/fe2root/root/timestamp.baseinstall chmod a-wx /raid5/nobackup/fe2root/root/timestamp.baseinstall service tftpd-hpa restart echo "Now PXEboot the machine, log in as blah, set a root password," echo "log in as root, and execute /installapps"