diff options
Diffstat (limited to 'abs/core-testing')
-rw-r--r-- | abs/core-testing/diskless-legacy/PKGBUILD | 2 | ||||
-rwxr-xr-x | abs/core-testing/diskless-legacy/config_diskless_frontend.bash | 105 |
2 files changed, 75 insertions, 32 deletions
diff --git a/abs/core-testing/diskless-legacy/PKGBUILD b/abs/core-testing/diskless-legacy/PKGBUILD index 6b7cea7..d5359a8 100644 --- a/abs/core-testing/diskless-legacy/PKGBUILD +++ b/abs/core-testing/diskless-legacy/PKGBUILD @@ -7,10 +7,8 @@ pkgdesc="Script for configuring a diskless mythtv frontends using NFS root." arch=i686 depends=(tftp-hpa dhcp) source=(config_diskless_frontend.bash) -md5sums=('825fbc61ef209dc47f17dbaab5829779') build() { install -D -m755 ${srcdir}/config_diskless_frontend.bash \ ${pkgdir}/usr/local/bin/config_diskless_frontend.bash } -md5sums=('825fbc61ef209dc47f17dbaab5829779') diff --git a/abs/core-testing/diskless-legacy/config_diskless_frontend.bash b/abs/core-testing/diskless-legacy/config_diskless_frontend.bash index ffd1afd..73f2a1e 100755 --- a/abs/core-testing/diskless-legacy/config_diskless_frontend.bash +++ b/abs/core-testing/diskless-legacy/config_diskless_frontend.bash @@ -319,13 +319,10 @@ fixed-address ${frontend_ips[$fe]};}" >> \ 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() { @@ -386,13 +383,37 @@ export_mounts() { else echo "Already added line for /data/var/cache/pacman in /etc/exports" fi + + # Ensure that the montpoints that are used as storage groups are exported. + + for storage_mount in ${storage_mounts[@]} ; do + + if ! grep -q ^${storage_mount}[[:space:]] /etc/exports ; then + echo "Adding line for ${storage_mount} in /etc/exports" + echo "${storage_mount} *(rw,async,no_subtree_check)" >> /etc/exports + else + echo "Already added line for ${storage_mount} in /etc/exports" + fi + done } -enable_nfs() { - # Enable NFS. +find_storage_mounts() { + unset storage_mounts + for group in $(mysql -sB mythconverg -e \ + "select dirname from storagegroup where hostname = '$(hostname)'") ; do - /sbin/add_service.sh nfsd + group_mount=$group + while ! mountpoint -q $group_mount ; do + group_mount=$(dirname $group_mount) + done + echo Storage group $group mountpoint is $group_mount + storage_mounts=( "${storage_mounts[@]}" $group_mount ) + done +} + +enable_nfs() { + /sbin/add_service.sh nfsd } restart_nfs (){ @@ -427,10 +448,10 @@ create_tftpboot_directory() { 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 ~ /^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 @@ -485,29 +506,28 @@ create_new_nfsroot() { echo "Creating the $NFSROOT directory." mkdir -p $NFSROOT for DIR in /* ; do - if [[ "$DIR" != /myth && \ - "$DIR" != /mnt && \ - "$DIR" != /bin && \ - "$DIR" != /sbin && \ - "$DIR" != /tmp && \ + if [[ "$DIR" != /mnt && \ "$DIR" != /data && \ "$DIR" != /media && \ - "$DIR" != /proc && \ - "$DIR" != /sys && \ + "$DIR" != /tmp && \ + "$DIR" != /etc.old && \ "$DIR" != /storage && \ "$DIR" != /var && \ "$DIR" != /nfsroot && \ "$DIR" != /tftpboot && \ "$DIR" != /cdrom ]] then - echo " Copying $DIR to $NFSROOT" - cp -ax $DIR $NFSROOT + if mountpoint -q $DIR && [ "$DIR" != "/dev" ] ; then + echo " Making mountpoint dir $DIR" + cd $NFSROOT + tar c $DIR --exclude=$DIR/* 2> /dev/null | tar x 2> /dev/null + else + echo " Copying $DIR to $NFSROOT" + cp -ax $DIR $NFSROOT + fi fi done - cp -alx /bin $NFSROOT - cp -alx /sbin $NFSROOT - cd $NFSROOT # Exclude specific bits of /var @@ -519,7 +539,7 @@ create_new_nfsroot() { --exclude=/var/lib/named \ 2> /dev/null | tar x 2> /dev/null - for DIR in /myth /mnt /data /tmp /proc /media /sys /cdrom /var/lib/mlocate ; do + for DIR in /mnt /data /tmp /media /cdrom /var/lib/mlocate ; do echo " Creating $DIR" tar c $DIR --exclude=$DIR/* 2> /dev/null | tar x 2> /dev/null done @@ -538,7 +558,7 @@ create_new_nfsroot() { # Update the fstab. cp $NSFROOT/etc/fstab $NFSROOT/etc/fstab~ - cat $NFSROOT/etc/fstab~ | grep -v ext3 | + cat $NFSROOT/etc/fstab~ | grep -v ext[34] | grep -v xfs | grep -v ^UUID= > $NFSROOT/etc/fstab echo "\ @@ -547,6 +567,12 @@ $BACKEND_IP:/myth /myth nfs defaults,nolock,auto,noatime 0 0 $BACKEND_IP:/data/var/cache/pacman /data/var/cache/pacman nfs defaults,nolock,auto,noatime 0 0 " >> $NFSROOT/etc/fstab + for storage_mount in ${storage_mounts[@]} ; do + echo "\ +$BACKEND_IP:${storage_mount} ${storage_mount} nfs auto,noatime,nolock,rsize=32768,wsize=32768 0 0" \ + >> $NFSROOT/etc/fstab + done + 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 @@ -580,7 +606,30 @@ $BACKEND_IP:/data/var/cache/pacman /data/var/cache/pacman nfs defaults,nolock,au chown mythtv:mythtv $NFSROOT/home/mythtv/.mythtv/mysql.txt -# echo > $NFSROOT/etc/mythtv/Cards + # Personal tweak for the author: + + if [[ $NFSROOT = /nfsroot/fedell || \ + $NFSROOT = /nfsroot/feevo ]] ; then + + # Change the X resolution for the frontend. + + sed -i 's/^[[:space:]]*Modes.*$/\tModes "1440x900"/g' \ + $NFSROOT/etc/X11/xorg.conf + + # Swap to the legacy 96xx nvidia driver . + + chroot $NFSROOT mount /data/var/cache/pacman + chroot $NFSROOT pacman --noconfirm -R nvidia vdpinfo + chroot $NFSROOT pacman --noconfirm -Sf nvidia-96xx + chroot $NFSROOT umount /data/var/cache/pacman + + # Change the remote to dvico. + + sed -i 's/mceusb/dvico/g' $NFSROOT/etc/systemconfig + chroot $NFSROOT /usr/MythVantage/bin/systemconfig.sh ir + + sed -i 's/UseMythWelcome="1"/UseMythWelcome="0"/g' $NFSROOT/etc/systemconfig + fi create_default_pxelinux_entry export_nfsroot @@ -589,11 +638,8 @@ $BACKEND_IP:/data/var/cache/pacman /data/var/cache/pacman nfs defaults,nolock,au 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 - } - - ########################################## ########################################## ## @@ -602,8 +648,6 @@ $BACKEND_IP:/data/var/cache/pacman /data/var/cache/pacman nfs defaults,nolock,au ########################################## ########################################## - - check_for_default_fe find_existing_diskless_fes @@ -612,6 +656,7 @@ get_network_info setup_tftpd setup_dhcpd enable_mysql_and_backend_networking +find_storage_mounts export_mounts create_tftpboot_directory enable_nfs |