From 14c34906cd69c5f933bdb46fc69bc5be51252906 Mon Sep 17 00:00:00 2001
From: Greg Frost <gregfrost1@bigpond.com>
Date: Mon, 22 Jun 2009 07:50:20 +0930
Subject: kernel26: config for diskless. LinHES-config: add
 config_diskless_frontend.basj

---
 abs/core-testing/LinHES-config/PKGBUILD            |   1 +
 .../LinHES-config/config_diskless_frontend.bash    | 656 +++++++++++++++++++++
 abs/core-testing/kernel26/PKGBUILD                 |   8 +-
 abs/core-testing/kernel26/config                   | 106 ++--
 4 files changed, 714 insertions(+), 57 deletions(-)
 create mode 100755 abs/core-testing/LinHES-config/config_diskless_frontend.bash

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 40413ed..83b0101 100755
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -48,6 +48,7 @@ build() {
     install -m 0755 mv_webuser.py $MVDIR/bin/ 
     install -m 0755 mv_hostype.py $MVDIR/bin/ 
     install -m 0755 systemconfig.py $MVDIR/bin/ 
+    install -m 0755 config_diskless_frontend.bash $MVDIR/bin/
 
     #README file displayed on install
     install -m 0755 README $MVDIR/README
diff --git a/abs/core-testing/LinHES-config/config_diskless_frontend.bash b/abs/core-testing/LinHES-config/config_diskless_frontend.bash
new file mode 100755
index 0000000..21bf8a0
--- /dev/null
+++ b/abs/core-testing/LinHES-config/config_diskless_frontend.bash
@@ -0,0 +1,656 @@
+#!/bin/bash
+# This script configures your backend so that a diskless
+# frontend can boot from it.
+
+source /usr/local/bin/linhes_functions.bash
+
+must_be_root
+
+TITLE="Diskless FE Configuration"
+DOPTS=(--backtitle "$BT" --title "$TITLE" --trim --aspect 30 )
+
+DAEMON_LOG=/var/log/daemon.log
+BOOT_DEFAULT=/tftpboot/pxelinux.cfg/default
+
+unable_to_determine_mac_for_default_fe ()
+{
+  if dialog "${DOPTS[@]}" --yes-label "Boot FE and try again" \
+       --no-label "Delete $fe_nfsroot" \
+       --yesno "Unable to automatically determine the MAC address of
+       the current default frontend by interrogating $DAEMON_LOG.
+       This may be because you have not yet booted the diskless FE. You can
+       either boot the diskless FE and try running $0 again, or delete
+       $fe_nfsroot and re-create it later." 0 0 ; then
+    exit
+  else
+    rm -Rf $fe_nfsroot $BOOT_DEFAULT
+  fi
+  exit
+}
+
+find_existing_diskless_fes() {
+
+  unset frontend_names
+  unset frontend_nfsroots
+  unset frontend_ips
+  unset frontend_macs
+
+  for frontend_config in $(ls /tftpboot/pxelinux.cfg 2> /dev/null) ; do
+
+    frontend_name=$(basename $(
+      grep append /tftpboot/pxelinux.cfg/$frontend_config |
+      sed -e 's/.*nfsroot=//' | awk -F, '{print $1}' | awk -F/ '{print $NF}'))
+    frontend_nfsroot=$(
+      grep append /tftpboot/pxelinux.cfg/$frontend_config |
+      cut -d ':' -f 2 | cut -d ',' -f 1)
+    frontend_ip=\
+$((0x${frontend_config:0:2})).$((0x${frontend_config:2:2})).\
+$((0x${frontend_config:4:2})).$((0x${frontend_config:6:2}))
+    frontend_mac=$(
+      cat /etc/dhcpd.conf |
+      grep "host $frontend_name" |
+      sed 's/hardware ethernet /#/g' |
+      cut -d '#' -f 2 |
+      cut -d ';' -f 1)
+
+    if [ -n "$frontend_name" -a -n "$frontend_nfsroot" -a \
+         -n "$frontend_ip" -a -n "$frontend_mac" ] ; then
+      frontend_names=( "${frontend_names[@]}" $frontend_name )
+      frontend_nfsroots=( "${frontend_nfsroots[@]}" $frontend_nfsroot )
+      frontend_ips=( "${frontend_ips[@]}" $frontend_ip )
+      frontend_macs=( "${frontend_macs[@]}" $frontend_mac )
+    fi
+  done
+
+echo frontend_names="${frontend_names[@]}"
+echo frontend_nfsroots="${frontend_nfsroots[@]}"
+echo frontend_ips="${frontend_ips[@]}"
+echo frontend_macs="${frontend_macs[@]}"
+
+}
+
+check_for_default_fe () {
+  # This function looks to see if there is a diskless FE that has only been
+  # partially configured (i.e. it's MAC address has not been determined and
+  # as a result it has not been allocated a fixed IP.
+
+  if [ -e $BOOT_DEFAULT ] ; then
+      # There is a $BOOT_DEFAULT config file that has not yet been set to a
+      # fixed IP address. See if we can interrogate the log files to
+      # determine what the MAC adderss of the FE is so that we can turn it
+      # into a fixed ip node. This is the first step in allowing multiple
+      # diskless frontends.
+
+      # First determine from the default file, the nfsroot that it is for.
+
+      fe_nfsroot=$(grep append $BOOT_DEFAULT | cut -d ':' -f 2 | cut -d ',' -f 1)
+
+      if [ -z "$fe_nfsroot" ] ; then
+        echo "Unable to determine the location of the nfsroot from" \
+          $BOOT_DEFAULT
+        exit
+      fi
+
+      echo fe_nfsroot=$fe_nfsroot
+
+      # Now determine the IP address by looking for an instance in the
+      # daemon log file for which the specified nfsroot was mounted.
+
+      fe_ipaddress=$(
+        grep "authenticated mount request from " $DAEMON_LOG |
+        grep $fe_nfsroot |
+        tail -1 |
+        sed 's/authenticated mount request from /#/g' |
+        cut -d '#' -f 2 |
+        cut -d ':' -f 1)
+
+      echo fe_ipaddress=$fe_ipaddress
+
+      unset fe_macaddress
+
+      if [ ! -z "$fe_ipaddress" ] ; then
+        fe_macaddress=$(
+          grep "DHCPACK on $fe_ipaddress" $DAEMON_LOG |
+          tail -1 |
+          sed 's/DHCPACK on '$fe_ipaddress' to /#/g' |
+          cut -d '#' -f 2 |
+          cut -d ' ' -f 1)
+      fi
+
+      echo fe_macaddress=$fe_macaddress
+
+      if [ -z "$fe_macaddress" ] ; then
+        unable_to_determine_mac_for_default_fe
+      else
+        if ! dialog "${DOPTS[@]}" --yesno "By interrogating $DAEMON_LOG,
+                it appears that the $(basename $fe_nfsroot) frontend was
+                last used by a host with MAC Address of $fe_macaddress which
+                was allocated IP address $fe_ipaddress.
+                Do you wish to allocate the IP to that host (so that you
+                can configure another diskless FE)?" 0 0 ; then
+          dialog "${DOPTS[@]}" --msgbox "Boot the correct diskless FE and
+            run $0 again." 0 0
+          exit
+        fi
+
+        # Setup dhcpd.conf so that the FE's MAC address always uses a fixed
+        # ip address and the PXE configuration is fixed for that address.
+
+        hex_ip_address=$(printf "%02X%02X%02X%02X" $(echo $fe_ipaddress |
+          tr '.' ' '))
+        echo hex_ip_address=$hex_ip_address
+        mv -fv $BOOT_DEFAULT $(dirname $BOOT_DEFAULT)/$hex_ip_address
+
+        cp -f /etc/dhcpd.conf /etc/dhcpd.conf.bak
+        cat /etc/dhcpd.conf.bak |
+          grep -v "host $(basename $fe_nfsroot)" > \
+          /etc/dhcpd.conf
+        echo "\
+host $(basename $fe_nfsroot) \
+{hardware ethernet $fe_macaddress; fixed-address $fe_ipaddress;}" \
+          >> /etc/dhcpd.conf
+
+        /sbin/sv restart dhcpd
+
+        dialog "${DOPTS[@]}" --msgbox "The frontend $(basename $fe_nfsroot)
+          with a MAC address of $fe_macaddress and an nfsroot directory of
+          $fe_nfsroot has been configured with a fixed IP address of
+          $fe_ipaddress." 0 0
+        exit
+      fi
+  fi
+
+}
+
+get_network_interface() {
+  NETDEVICES="$(cat /proc/net/dev |
+    awk -F: '/ath.:|wlan.:|eth.:|tr.:/{print $1}')"
+  echo NETDEVICES=$NETDEVICES
+  NUM_DEVICES=$(echo $NETDEVICES | wc -w)
+  echo NUM_DEVICES=$NUM_DEVICES
+  if [ $NUM_DEVICES = 1 ] ; then
+    INTERFACE=$NETDEVICES
+  else
+    DEVICELIST=""
+    DEVNUM=0
+    for DEVICE in $NETDEVICES
+    do
+      DEVNUM=$(($DEVNUM + 1))
+      DEVICELIST="$DEVICELIST $DEVICE Interface${DEVNUM} "
+    done
+    echo DEVICELIST=$DEVICELIST
+    TMP=/tmp/interface
+    rm -Rf $TMP
+    dialog "${DOPTS[@]}" --menu "Which network interface?" 18 70 12 \
+      $DEVICELIST 2>$TMP || exit
+    INTERFACE=$(cat $TMP)
+  fi
+  echo INTERFACE=$INTERFACE
+}
+
+validip(){
+  echo "$1" | egrep -q -e '[0-9]+\.[0-9]+\.[0-9]+.[0-9]+'
+  return $?
+}
+
+get_network_info() {
+  BACKEND_IP=$(echo $(ifconfig $INTERFACE | grep "inet addr" | tr ':' ' ') |
+    cut -d ' ' -f 3)
+  echo BACKEND_IP=$BACKEND_IP
+  NAMESERVERS="$(awk '/^nameserver/{printf "%s ",$2}' /etc/resolv.conf)"
+  echo NAMESERVERS=$NAMESERVERS
+  GATEWAY="$(LANG=C LC_ALL=C route -n | awk '/^0\.0\.0\.0/{print $2; exit}')"
+  echo GATEWAY=$GATEWAY
+  NETWORK="${BACKEND_IP%.*}"
+  echo NETWORK=$NETWORK
+  HOST="${BACKEND_IP##*.}"
+  echo HOST=$HOST
+  NETMASK="$(LANG=C LC_ALL=C ifconfig $INTERFACE |
+    awk '/[Mm]ask/{FS="[:   ]*";$0=$0; print $8; exit}')"
+  echo NETMASK=$NETMASK
+
+  # See if we can determine the range of IP addresses currently allowed in
+  # dhcpd.conf
+
+  IPRANGE=( $(grep ^[[:space:]]*range /etc/dhcpd.conf |
+              sed 's/range//g' | tr -d ';') )
+
+  echo ${IPRANGE[@]}
+  if [ $(echo ${IPRANGE[@]} | wc -w) -eq 2 ] ; then
+    START=$(echo ${IPRANGE[0]} | tr '.' '\t' | cut -f 4)
+    END=$(echo ${IPRANGE[1]} | tr '.' '\t' | cut -f 4)
+    echo START=$START
+    echo END=$END
+  fi
+
+  # Could not
+
+  if [ -z "$START" -o -z "$END" ] ; then
+    if [ "$HOST" -lt "20" ] ; then
+      START=21
+      END=26
+    else
+      START=11
+      END=16
+    fi
+  fi
+
+  IPRANGE_FROM=""
+  IPRANGE_TO=""
+
+  while [ -z "$IPRANGE_FROM" -o -z "$IPRANGE_TO" -o -z "$IPRANGE" ]
+  do
+    IPRANGE="$NETWORK.$START $NETWORK.$END"
+    rm -f /tmp/iprange
+
+    if ! dialog "${DOPTS[@]}" --clear --inputbox "Please enter the desired
+           IP-Range of addresses that should be allocated by clients,
+           separated by a single space." 10 75 "$IPRANGE" \
+           2> /tmp/iprange ; then
+      exit
+    fi
+
+    IPRANGE=$(cat /tmp/iprange)
+    echo IPRANGE=$IPRANGE
+    IPRANGE_FROM="${IPRANGE%% *}"
+    IPRANGE_TO="${IPRANGE##* }"
+
+    for i in "$IPRANGE_FROM" "$IPRANGE_TO"
+    do
+      validip "$i" || IPRANGE=""
+    done
+  done
+}
+
+setup_dhcpd() {
+  # Generate dhcpd.conf from template
+
+  if [ ! -f /etc/dhcpd.conf.orig ] ; then
+    mv -f /etc/dhcpd.conf /etc/dhcpd.conf.orig
+  fi
+
+  ALLNAMESERVERS=""
+  for i in $NAMESERVERS; do
+    ALLNAMESERVERS="${ALLNAMESERVERS:+$ALLNAMESERVERS,} $i"
+  done
+  echo ALLNAMESERVERS=$ALLNAMESERVERS
+
+  cat >/etc/dhcpd.conf <<EOT
+# dhcpd.conf for LinHES Diskless Frontend
+
+# global settings
+## POF allow booting;
+allow bootp;
+default-lease-time 600;
+max-lease-time 7200;
+
+subnet ${NETWORK}.0 netmask ${NETMASK} {
+  next-server $BACKEND_IP;
+  filename "pxelinux.0";
+  option subnet-mask ${NETMASK};
+  range ${IPRANGE_FROM} ${IPRANGE_TO};
+  ${ALLNAMESERVERS:+option domain-name-servers $ALLNAMESERVERS;}
+  ${GATEWAY:+option routers $GATEWAY;}
+}
+EOT
+
+  for (( fe = 0 ; fe < ${#frontend_names[@]} ; fe++ )) ; do
+    echo "host ${frontend_names[$fe]} \
+{hardware ethernet ${frontend_macs[$fe]}; \
+fixed-address ${frontend_ips[$fe]};}" >> \
+      /etc/dhcpd.conf
+  done
+
+  /sbin/add_service.sh dhcpd
+  /sbin/sv restart dhcpd
+}
+
+setup_tftpd() {
+
+  /sbin/add_service.sh tftpd
+  /sbin/sv restart tftpd
+}
+
+check_delete_of_existing_nfsroot() {
+  if [ -d $NFSROOT ] ; then
+    if dialog "${DOPTS[@]}" --yesno "\
+There is already a directory $NFSROOT. Do you want to delete it and \
+rebuild it from scratch?" 10 70 ; then
+      echo Deleting $NFSROOT
+      rm -Rf $NFSROOT
+    else
+      echo "OK then, bye."
+      exit
+    fi
+  fi
+}
+
+enable_mysql_and_backend_networking() {
+  # Enable mysql networking on the backend.
+
+  /sbin/sv stop mythbackend
+
+  if grep -q ^bind-address /etc/my.cnf ; then
+    echo "Commenting out bind-address."
+    cp /etc/my.cnf /etc/my.cnf~
+    cat /etc/my.cnf~ | sed 's/^skip-networking/#skip-networking/g' > \
+      /etc/my.cnf
+    /sbin/sv restart mysql
+  else
+    echo "Already commented out skip-networking."
+  fi
+
+  # Make sure that the backend ip settings in the mythtv mysql database have
+  # the actual IP address of the backend rather than the loopback address.
+  # Otherwise the frontend will not be able to connect to the backend.
+
+  echo "Setting backend IP in mythtv's mysql settings"
+  echo "
+UPDATE settings SET data='$BACKEND_IP' WHERE value='BackendServerIP';
+UPDATE settings SET data='$BACKEND_IP' WHERE value='MasterServerIP';" |
+    mysql mythconverg
+
+  /sbin/sv start mythbackend
+}
+
+export_usr() {
+  # Ensure that the /usr directory is read-only exported.
+
+  if ! grep -q ^/usr[[:space:]] /etc/exports ; then
+    echo "Adding line for /usr in /etc/exports"
+    echo "/usr *(ro,async,no_subtree_check)" >> /etc/exports
+  else
+    echo "Already added line for /usr in /etc/exports"
+  fi
+}
+
+enable_nfs() {
+  # Enable NFS.
+
+  /sbin/add_service.sh nfsd
+
+}
+
+restart_nfs (){
+
+  /usr/sbin/exportfs -r
+}
+
+export_nfsroot() {
+  # Ensure that the NFSROOT directory is appropriately exported.
+
+  if ! grep -q ^$NFSROOT[[:space:]] /etc/exports ; then
+    echo "Adding line for $NFSROOT in /etc/exports"
+    echo "$NFSROOT *(rw,no_root_squash,async,no_subtree_check)" >> /etc/exports
+  else
+    echo "Already added line for $NFSROOT in /etc/exports"
+  fi
+}
+
+create_tftpboot_directory() {
+  # Create the directory with the tftp stuff.
+
+  echo "Creating /tftpboot directories"
+  mkdir -p /tftpboot/pxelinux.cfg
+
+  if [ ! -e /tftpboot/pxelinux.0 ] ; then
+   cp -fv /usr/lib/syslinux/pxelinux.0 /tftpboot/pxelinux.0
+  fi
+
+  if [ ! -e /tftpboot/vmlinuz26 ] ; then
+    cp -fv /boot/vmlinuz26 /tftpboot/vmlinuz26
+  fi
+
+  if [ ! -e /tftpboot/kernel26.img ] ; then
+
+    echo "Building kernel miniroot"
+    if [ -z "$(awk -F\" '$1 ~ /^MODULES=/ && $2 ~ /nfs/' /etc/mkinitcpio.conf)" ] ; then
+      cp /etc/mkinitcpio.conf /etc/mkinitcpio.conf~
+      sed -e '/^MODULES=/s/\"$/ nfs\"/' < /etc/mkinitcpio.conf~ > /etc/mkinitcpio.conf
+    fi
+    if [ -z "$(awk -F\" '$1 ~ /^HOOKS=/ && $2 ~ /net/' /etc/mkinitcpio.conf)" ] ; then
+      cp /etc/mkinitcpio.conf /etc/mkinitcpio.conf~
+      sed -e '/^HOOKS=/s/\"$/ net\"/' < /etc/mkinitcpio.conf~ > /etc/mkinitcpio.conf
+    fi
+    /sbin/mkinitcpio -g /tftpboot/kernel26.img
+  fi
+}
+
+create_default_pxelinux_entry() {
+  echo "\
+  default linux
+
+  label linux
+  kernel vmlinuz26
+  append initrd=kernel26.img rootfstype=nfs root=/dev/nfs nfsroot=$BACKEND_IP:$NFSROOT,v3,rsize=16384,wsize=16384 init=/sbin/runit ip=dhcp" \
+    > /tftpboot/pxelinux.cfg/default
+}
+
+create_new_nfsroot() {
+  # Prompt the user for the name of the NFSROOT.
+
+  FRONTEND=
+  NFSROOT=
+
+  while [ -z "$FRONTEND" ] ; do
+    if ! dialog "${DOPTS[@]}" --inputbox "Enter the hostname of the new
+           diskless FE:" 0 0 2> /tmp/frontend_hostname ; then
+      exit
+    fi
+
+    FRONTEND=$(cat /tmp/frontend_hostname)
+  done
+
+  # Prompt the user for the location of the NFSROOT.
+
+  while [ -z "$NFSROOT" ] ; do
+    NFSROOT=/nfsroot/$FRONTEND
+
+    if ! dialog "${DOPTS[@]}" --clear --inputbox "Enter the location of the
+           NFSROOT for the diskless FE:" \
+           0 0 "$NFSROOT" 2> /tmp/nfsroot_location ; then
+      exit
+    fi
+
+    NFSROOT=$(cat /tmp/nfsroot_location)
+  done
+
+  check_delete_of_existing_nfsroot
+
+  # Create the nfsroot directory that the FE will use as its root filesystem.
+
+  echo "Creating the $NFSROOT directory."
+  mkdir -p $NFSROOT
+  for DIR in /* ; do
+    if [[ "$DIR" != /myth && \
+          "$DIR" != /mnt && \
+          "$DIR" != /bin && \
+          "$DIR" != /sbin && \
+          "$DIR" != /tmp && \
+          "$DIR" != /data && \
+          "$DIR" != /usr && \
+          "$DIR" != /proc && \
+          "$DIR" != /sys && \
+          "$DIR" != /storage && \
+          "$DIR" != /var && \
+          "$DIR" != /nfsroot && \
+          "$DIR" != /tftpboot && \
+          "$DIR" != /cdrom ]]
+    then
+      echo "  Copying $DIR to $NFSROOT"
+      cp -ax $DIR $NFSROOT
+    fi
+  done
+
+  cp -alx /bin $NFSROOT
+  cp -alx /sbin $NFSROOT
+
+  cd $NFSROOT
+
+  # Exclude specific bits of /var
+
+  tar c /var \
+    --exclude=/var/lib/dhcpcd \
+    --exclude=/var/lib/locate \
+    --exclude=/var/lib/mlocate \
+    --exclude=/var/lib/named \
+    2> /dev/null | tar x 2> /dev/null
+
+  for DIR in /myth /mnt /tmp /usr /proc /sys /cdrom /var/lib/mlocate ; do
+    echo "  Creating $DIR"
+    tar c $DIR --exclude=$DIR/* 2> /dev/null | tar x 2> /dev/null
+  done
+
+
+#  chroot $NFSROOT mount -t nfs localhost:/usr /usr
+  chroot $NFSROOT /sbin/remove_service.sh dhcpd
+  chroot $NFSROOT /sbin/remove_service.sh lighttpd
+  chroot $NFSROOT /sbin/remove_service.sh mysql
+  chroot $NFSROOT /sbin/remove_service.sh mythbackend
+  chroot $NFSROOT /sbin/remove_service.sh nfsd
+  chroot $NFSROOT /sbin/remove_service.sh nmbd
+  chroot $NFSROOT /sbin/remove_service.sh smbd
+  chroot $NFSROOT /sbin/remove_service.sh tftpd
+#  chroot $NFSROOT umount /usr
+
+  # Update the fstab.
+
+  cp $NSFROOT/etc/fstab $NFSROOT/etc/fstab~
+  cat $NFSROOT/etc/fstab~ | grep -v ext3 |
+    grep -v ^UUID= > $NFSROOT/etc/fstab
+
+  echo "\
+$BACKEND_IP:/nfsroot / nfs defaults,nolock,auto,noatime 0 2
+$BACKEND_IP:/usr /usr nfs defaults,nolock,auto,noatime 0 2
+$BACKEND_IP:/myth /myth nfs defaults,nolock,auto,noatime 0 0
+" >> $NFSROOT/etc/fstab
+
+  cp $NFSROOT/etc/rc.sysinit $NFSROOT/etc/rc.sysinit~
+  sed -e '/^\/sbin\/minilogd/s/$/\n\n# Mount NFS early\n\/bin\/mount -a -t nfs/' \
+    < $NFSROOT/etc/rc.sysinit~ > $NFSROOT/etc/rc.sysinit
+
+  # Update networking
+
+  echo $FRONTEND > $NFSROOT/etc/hostname
+
+  cp $NFSROOT/etc/hosts $NFSROOT/etc/hosts~
+  echo "127.0.0.1 $FRONTEND localhost" > $NFSROOT/etc/hosts
+  cat $NFSROOT/etc/hosts~ | grep -v 127.0.0.1 >> $NFSROOT/etc/hosts
+
+  cp $NFSROOT/etc/net/ifaces/eth0/options $NFSROOT/etc/net/ifaces/eth0/options~
+  sed -e 's/^BOOTPROTO=.*/BOOTPROTO=none/' < $NFSROOT/etc/net/ifaces/eth0/options~ \
+    > $NFSROOT/etc/net/ifaces/eth0/options
+
+  # Update mysql settings
+
+  cp /usr/share/mythtv/mysql.txt $NFSROOT/home/mythtv/.mythtv/mysql.txt
+
+  if grep -q DBHostName=localhost $NFSROOT/home/mythtv/.mythtv/mysql.txt ; then
+    echo "Setting database host in frontend's mysql.txt."
+      cp $NFSROOT/home/mythtv/.mythtv/mysql.txt \
+         $NFSROOT/home/mythtv/.mythtv/mysql.txt.orig
+      cat $NFSROOT/home/mythtv/.mythtv/mysql.txt.orig |
+        sed 's/DBHostName=localhost/DBHostName='$BACKEND_IP'/g' > \
+        $NFSROOT/home/mythtv/.mythtv/mysql.txt
+  else
+    echo "Already set Database host in frontend's mysql.txt."
+  fi
+
+  chown mythtv:mythtv $NFSROOT/home/mythtv/.mythtv/mysql.txt
+
+#  echo > $NFSROOT/etc/mythtv/Cards
+
+  create_default_pxelinux_entry
+  export_nfsroot
+  restart_nfs
+
+  dialog "${DOPTS[@]}" --msgbox "Boot your diskless FE
+  and then re-run this script ($0) so that the MAC address
+  of the Diskless FE can be obtained." 0 0
+
+}
+
+
+
+##########################################
+##########################################
+##
+## MAIN BODY OF SCRIPT                  ##
+##
+##########################################
+##########################################
+
+
+
+check_for_default_fe
+find_existing_diskless_fes
+
+get_network_interface
+get_network_info
+setup_tftpd
+setup_dhcpd
+enable_mysql_and_backend_networking
+export_usr
+create_tftpboot_directory
+enable_nfs
+
+# Restart nfs so that the newly exported /usr directory can be mounted. This
+# is required to create a new frontend.
+
+restart_nfs
+
+if [ ${#frontend_names[@]} -eq 0 ] ; then
+  create_new_nfsroot
+else
+  for (( fe = 0 ; fe < ${#frontend_names[@]} ; fe++ )) ; do
+    frontend_options=( "${frontend_options[@]}" \
+      "${frontend_names[$fe]} (MAC:${frontend_macs[$fe]} \
+IP:${frontend_ips[$fe]})" "" )
+  done
+
+echo 0=${frontend_names[0]}
+echo 1=${frontend_names[1]}
+echo 2=${frontend_names[2]}
+echo 3=${frontend_names[3]}
+
+  if ! dialog "${DOPTS[@]}" --menu "Select a frontend to delete or to create
+         a new one." 0 0 0 "${frontend_options[@]}" \
+         "New Frontend" "" 2> /tmp/selected_fe; then
+    exit
+  fi
+
+  selected_option=$(cat /tmp/selected_fe)
+
+  if [ "$selected_option" = "New Frontend" ] ; then
+    create_new_nfsroot
+    exit
+  fi
+
+echo $selected_option
+echo ${frontend_options[0]}
+echo ${frontend_options[2]}
+echo ${frontend_nfsroots[@]}
+
+  for (( fe = 0 ; fe < ${#frontend_names[@]} ; fe++ )) ; do
+    if [ "$selected_option" = "${frontend_options[$(($fe*2))]}" ] ; then
+      if dialog "${DOPTS[@]}" --yesno "Do you wish to delete the frontend
+           with nfsroot ${frontend_nfsroots[$fe]}?" 0 0 ; then
+        # Delete the nfsroot directory.
+        rm -Rfv ${frontend_nfsroots[$fe]}
+
+        # Delete the tftpboot pxe boot config file.
+
+        hex_ip_address=$(printf "%02X%02X%02X%02X" \
+          $(echo ${frontend_ips[$fe]} | tr '.' ' '))
+        rm /tftpboot/pxelinux.cfg/$hex_ip_address
+
+        # Remove reference to the frontend from the dhcp.conf
+        cp -fv /etc/dhcpd.conf /etc/dhcpd.conf.bak
+        grep -v "host ${frontend_names[$fe]}" /etc/dhcpd.conf.bak > \
+          /etc/dhcpd.conf
+        /sbin/sv restart dhcpd
+      fi
+    fi
+  done
+fi
+
diff --git a/abs/core-testing/kernel26/PKGBUILD b/abs/core-testing/kernel26/PKGBUILD
index 0c28557..81873cf 100644
--- a/abs/core-testing/kernel26/PKGBUILD
+++ b/abs/core-testing/kernel26/PKGBUILD
@@ -37,12 +37,12 @@ source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$_basekernel.tar.bz2
 optdepends=('crda: to set the correct wireless channels of your country')
 md5sums=('d351e44709c9810b85e29b877f50968a'
          '6e63a5f54c142f42de7e59fc5f75eab2'
-	 '04b1413586111705ba790542c6e82350'
-         'de2e702d49e2656bd5bfe55aa68152fe'
+         '04b1413586111705ba790542c6e82350'
+         '40d5ef3b042c23b04962b7a23f9482ed'
          '959b317feb974d8906c5e15e7c76ad8f'
          'ceb38003807a5aa1a00c8d4b9f028893'
-	 '7bdfe2e1daedb324fdfdfa95ba4e2430'
-	 'd66b5cc1e1c2ce40d06d77167f36dfd9')
+         '7bdfe2e1daedb324fdfdfa95ba4e2430'
+         'd66b5cc1e1c2ce40d06d77167f36dfd9')
 
 build() {
   KARCH=x86
diff --git a/abs/core-testing/kernel26/config b/abs/core-testing/kernel26/config
index a9fa8ff..676616c 100644
--- a/abs/core-testing/kernel26/config
+++ b/abs/core-testing/kernel26/config
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.28
-# Thu Feb 12 10:17:52 2009
+# Sun Jun 21 21:20:09 2009
 #
 # CONFIG_64BIT is not set
 CONFIG_X86_32=y
@@ -508,7 +508,10 @@ CONFIG_IP_FIB_HASH=y
 CONFIG_IP_MULTIPLE_TABLES=y
 CONFIG_IP_ROUTE_MULTIPATH=y
 CONFIG_IP_ROUTE_VERBOSE=y
-# CONFIG_IP_PNP is not set
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+CONFIG_IP_PNP_RARP=y
 CONFIG_NET_IPIP=m
 CONFIG_NET_IPGRE=m
 # CONFIG_NET_IPGRE_BROADCAST is not set
@@ -1483,7 +1486,7 @@ CONFIG_TUN=m
 CONFIG_VETH=m
 CONFIG_NET_SB1000=m
 # CONFIG_ARCNET is not set
-CONFIG_PHYLIB=m
+CONFIG_PHYLIB=y
 
 #
 # MII PHY device drivers
@@ -1498,9 +1501,10 @@ CONFIG_PHYLIB=m
 # CONFIG_BROADCOM_PHY is not set
 # CONFIG_ICPLUS_PHY is not set
 # CONFIG_REALTEK_PHY is not set
+# CONFIG_FIXED_PHY is not set
 # CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
-CONFIG_MII=m
+CONFIG_MII=y
 CONFIG_HAPPYMEAL=m
 CONFIG_SUNGEM=m
 CONFIG_CASSINI=m
@@ -1509,14 +1513,14 @@ CONFIG_EL1=m
 CONFIG_EL2=m
 CONFIG_ELPLUS=m
 CONFIG_EL16=m
-CONFIG_EL3=m
+CONFIG_EL3=y
 CONFIG_3C515=m
-CONFIG_VORTEX=m
-CONFIG_TYPHOON=m
+CONFIG_VORTEX=y
+CONFIG_TYPHOON=y
 CONFIG_LANCE=m
 CONFIG_NET_VENDOR_SMC=y
 CONFIG_WD80x3=m
-CONFIG_ULTRA=m
+CONFIG_ULTRA=y
 CONFIG_SMC9194=m
 CONFIG_ENC28J60=m
 # CONFIG_ENC28J60_WRITEVERIFY is not set
@@ -1525,18 +1529,18 @@ CONFIG_NI52=m
 CONFIG_NI65=m
 CONFIG_NET_TULIP=y
 CONFIG_DE2104X=m
-CONFIG_TULIP=m
+CONFIG_TULIP=y
 # CONFIG_TULIP_MWI is not set
 # CONFIG_TULIP_MMIO is not set
 # CONFIG_TULIP_NAPI is not set
 CONFIG_DE4X5=m
-CONFIG_WINBOND_840=m
-CONFIG_DM9102=m
-CONFIG_ULI526X=m
-CONFIG_PCMCIA_XIRCOM=m
+CONFIG_WINBOND_840=y
+CONFIG_DM9102=y
+CONFIG_ULI526X=y
+CONFIG_PCMCIA_XIRCOM=y
 CONFIG_AT1700=m
 CONFIG_DEPCA=m
-CONFIG_HP100=m
+CONFIG_HP100=y
 CONFIG_NET_ISA=y
 CONFIG_E2100=m
 CONFIG_EWRK3=m
@@ -1557,37 +1561,37 @@ CONFIG_SEEQ8005=m
 # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 CONFIG_NET_PCI=y
-CONFIG_PCNET32=m
-CONFIG_AMD8111_ETH=m
+CONFIG_PCNET32=y
+CONFIG_AMD8111_ETH=y
 CONFIG_ADAPTEC_STARFIRE=m
 CONFIG_AC3200=m
 CONFIG_APRICOT=m
-CONFIG_B44=m
+CONFIG_B44=y
 CONFIG_B44_PCI_AUTOSELECT=y
 CONFIG_B44_PCICORE_AUTOSELECT=y
 CONFIG_B44_PCI=y
-CONFIG_FORCEDETH=m
+CONFIG_FORCEDETH=y
 # CONFIG_FORCEDETH_NAPI is not set
 CONFIG_CS89x0=m
-CONFIG_EEPRO100=m
-CONFIG_E100=m
+CONFIG_EEPRO100=y
+CONFIG_E100=y
 CONFIG_FEALNX=m
-CONFIG_NATSEMI=m
+CONFIG_NATSEMI=y
 CONFIG_NE2K_PCI=m
 CONFIG_8139CP=m
-CONFIG_8139TOO=m
+CONFIG_8139TOO=y
 # CONFIG_8139TOO_PIO is not set
 CONFIG_8139TOO_TUNE_TWISTER=y
 CONFIG_8139TOO_8129=y
 # CONFIG_8139_OLD_RX_RESET is not set
 CONFIG_R6040=m
-CONFIG_SIS900=m
-CONFIG_EPIC100=m
+CONFIG_SIS900=y
+CONFIG_EPIC100=y
 CONFIG_SUNDANCE=m
 # CONFIG_SUNDANCE_MMIO is not set
 CONFIG_TLAN=m
-CONFIG_VIA_RHINE=m
-# CONFIG_VIA_RHINE_MMIO is not set
+CONFIG_VIA_RHINE=y
+CONFIG_VIA_RHINE_MMIO=y
 CONFIG_SC92031=m
 CONFIG_NET_POCKET=y
 CONFIG_ATP=m
@@ -1597,26 +1601,26 @@ CONFIG_ATL2=m
 CONFIG_NETDEV_1000=y
 CONFIG_ACENIC=m
 # CONFIG_ACENIC_OMIT_TIGON_I is not set
-CONFIG_DL2K=m
+CONFIG_DL2K=y
 CONFIG_E1000=m
 CONFIG_E1000E=m
 CONFIG_IP1000=m
 CONFIG_IGB=m
 # CONFIG_IGB_LRO is not set
 CONFIG_IGB_DCA=y
-CONFIG_NS83820=m
+CONFIG_NS83820=y
 CONFIG_HAMACHI=m
 CONFIG_YELLOWFIN=m
 CONFIG_R8169=m
-# CONFIG_R8169_VLAN is not set
-CONFIG_SIS190=m
-CONFIG_SKGE=m
+CONFIG_R8169_VLAN=y
+CONFIG_SIS190=y
+CONFIG_SKGE=y
 # CONFIG_SKGE_DEBUG is not set
 CONFIG_SKY2=m
 # CONFIG_SKY2_DEBUG is not set
-CONFIG_VIA_VELOCITY=m
-CONFIG_TIGON3=m
-CONFIG_BNX2=m
+CONFIG_VIA_VELOCITY=y
+CONFIG_TIGON3=y
+CONFIG_BNX2=y
 CONFIG_QLA3XXX=m
 CONFIG_ATL1=m
 CONFIG_ATL1E=m
@@ -1715,8 +1719,6 @@ CONFIG_HOSTAP_CS=m
 CONFIG_B43=m
 CONFIG_B43_PCI_AUTOSELECT=y
 CONFIG_B43_PCICORE_AUTOSELECT=y
-CONFIG_B43_PCMCIA=y
-CONFIG_B43_PIO=y
 CONFIG_B43_LEDS=y
 CONFIG_B43_RFKILL=y
 # CONFIG_B43_DEBUG is not set
@@ -2467,14 +2469,11 @@ CONFIG_SSB_POSSIBLE=y
 #
 # Sonics Silicon Backplane
 #
-CONFIG_SSB=m
+CONFIG_SSB=y
 CONFIG_SSB_SPROM=y
-CONFIG_SSB_BLOCKIO=y
 CONFIG_SSB_PCIHOST_POSSIBLE=y
 CONFIG_SSB_PCIHOST=y
 CONFIG_SSB_B43_PCI_BRIDGE=y
-CONFIG_SSB_PCMCIAHOST_POSSIBLE=y
-CONFIG_SSB_PCMCIAHOST=y
 # CONFIG_SSB_DEBUG is not set
 CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y
 CONFIG_SSB_DRIVER_PCICORE=y
@@ -3813,24 +3812,25 @@ CONFIG_UFS_FS=m
 # CONFIG_UFS_FS_WRITE is not set
 # CONFIG_UFS_DEBUG is not set
 CONFIG_NETWORK_FILESYSTEMS=y
-CONFIG_NFS_FS=m
+CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
 CONFIG_NFS_V3_ACL=y
 CONFIG_NFS_V4=y
+CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
 CONFIG_NFSD_V2_ACL=y
 CONFIG_NFSD_V3=y
 CONFIG_NFSD_V3_ACL=y
 CONFIG_NFSD_V4=y
-CONFIG_LOCKD=m
+CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=m
-CONFIG_NFS_ACL_SUPPORT=m
+CONFIG_NFS_ACL_SUPPORT=y
 CONFIG_NFS_COMMON=y
-CONFIG_SUNRPC=m
-CONFIG_SUNRPC_GSS=m
+CONFIG_SUNRPC=y
+CONFIG_SUNRPC_GSS=y
 # CONFIG_SUNRPC_REGISTER_V4 is not set
-CONFIG_RPCSEC_GSS_KRB5=m
+CONFIG_RPCSEC_GSS_KRB5=y
 CONFIG_RPCSEC_GSS_SPKM3=m
 CONFIG_SMB_FS=m
 # CONFIG_SMB_NLS_DEFAULT is not set
@@ -4042,11 +4042,11 @@ CONFIG_CRYPTO=y
 # Crypto core or helper
 #
 CONFIG_CRYPTO_FIPS=y
-CONFIG_CRYPTO_ALGAPI=m
+CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD=m
 CONFIG_CRYPTO_AEAD2=y
-CONFIG_CRYPTO_BLKCIPHER=m
+CONFIG_CRYPTO_BLKCIPHER=y
 CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=m
 CONFIG_CRYPTO_HASH2=y
@@ -4070,7 +4070,7 @@ CONFIG_CRYPTO_SEQIV=m
 #
 # Block modes
 #
-CONFIG_CRYPTO_CBC=m
+CONFIG_CRYPTO_CBC=y
 CONFIG_CRYPTO_CTR=m
 CONFIG_CRYPTO_CTS=m
 CONFIG_CRYPTO_ECB=m
@@ -4090,7 +4090,7 @@ CONFIG_CRYPTO_XCBC=m
 CONFIG_CRYPTO_CRC32C=m
 CONFIG_CRYPTO_CRC32C_INTEL=m
 CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=m
+CONFIG_CRYPTO_MD5=y
 CONFIG_CRYPTO_MICHAEL_MIC=m
 CONFIG_CRYPTO_RMD128=m
 CONFIG_CRYPTO_RMD160=m
@@ -4113,7 +4113,7 @@ CONFIG_CRYPTO_BLOWFISH=m
 CONFIG_CRYPTO_CAMELLIA=m
 CONFIG_CRYPTO_CAST5=m
 CONFIG_CRYPTO_CAST6=m
-CONFIG_CRYPTO_DES=m
+CONFIG_CRYPTO_DES=y
 CONFIG_CRYPTO_FCRYPT=m
 CONFIG_CRYPTO_KHAZAD=m
 CONFIG_CRYPTO_SALSA20=m
@@ -4159,14 +4159,14 @@ CONFIG_VIRTIO_RING=y
 CONFIG_BITREVERSE=y
 CONFIG_GENERIC_FIND_FIRST_BIT=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
-CONFIG_CRC_CCITT=m
+CONFIG_CRC_CCITT=y
 CONFIG_CRC16=m
 CONFIG_CRC_T10DIF=m
 CONFIG_CRC_ITU_T=m
 CONFIG_CRC32=y
 CONFIG_CRC7=m
 CONFIG_LIBCRC32C=m
-CONFIG_ZLIB_INFLATE=m
+CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=m
 CONFIG_LZO_COMPRESS=m
 CONFIG_LZO_DECOMPRESS=m
-- 
cgit v0.12


From af187a23365a302485593f74f78711d35db3d5ae Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sun, 21 Jun 2009 15:28:03 -0700
Subject: Add accurate preview of silver remote.

---
 abs/core-testing/system-templates/PKGBUILD           |   2 +-
 .../templates/remotes/hauppauge-silver/preview.jpg   | Bin 45763 -> 3069 bytes
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/abs/core-testing/system-templates/PKGBUILD b/abs/core-testing/system-templates/PKGBUILD
index 741121b..5df40d9 100755
--- a/abs/core-testing/system-templates/PKGBUILD
+++ b/abs/core-testing/system-templates/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=system-templates
 pkgver=1.0
-pkgrel=21
+pkgrel=22
 conflicts=( )
 pkgdesc="Templates used for system configuration"
 depends=()
diff --git a/abs/core-testing/system-templates/templates/remotes/hauppauge-silver/preview.jpg b/abs/core-testing/system-templates/templates/remotes/hauppauge-silver/preview.jpg
index a40a1e8..19acba3 100644
Binary files a/abs/core-testing/system-templates/templates/remotes/hauppauge-silver/preview.jpg and b/abs/core-testing/system-templates/templates/remotes/hauppauge-silver/preview.jpg differ
-- 
cgit v0.12