summaryrefslogtreecommitdiffstats
path: root/abs/core/diskless-legacy
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2010-08-30 22:24:02 (GMT)
committerJames Meyer <james.meyer@operamail.com>2010-08-30 22:24:02 (GMT)
commitc4bd4457b5d640e1c8f5afbca7cd54c53691e5fc (patch)
treef4e4f7a91e1d9d90033fd99d89e5e26a2c144528 /abs/core/diskless-legacy
parent0e7b327a1ae444233f1308a95420f70540ad74a3 (diff)
downloadlinhes_pkgbuild-c4bd4457b5d640e1c8f5afbca7cd54c53691e5fc.zip
linhes_pkgbuild-c4bd4457b5d640e1c8f5afbca7cd54c53691e5fc.tar.gz
linhes_pkgbuild-c4bd4457b5d640e1c8f5afbca7cd54c53691e5fc.tar.bz2
RSYNC CORE:
resync core-testing -> core Signed-off-by: James Meyer <james.meyer@operamail.com>
Diffstat (limited to 'abs/core/diskless-legacy')
-rw-r--r--abs/core/diskless-legacy/PKGBUILD4
-rwxr-xr-xabs/core/diskless-legacy/config_diskless_frontend.bash110
2 files changed, 69 insertions, 45 deletions
diff --git a/abs/core/diskless-legacy/PKGBUILD b/abs/core/diskless-legacy/PKGBUILD
index 6b7cea7..85cfc3a 100644
--- a/abs/core/diskless-legacy/PKGBUILD
+++ b/abs/core/diskless-legacy/PKGBUILD
@@ -2,15 +2,13 @@
# Maintainer: Greg Frost <gregfrost1@bigpond.com>
pkgname=diskless-legacy
pkgver=1
-pkgrel=1
+pkgrel=3
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/diskless-legacy/config_diskless_frontend.bash b/abs/core/diskless-legacy/config_diskless_frontend.bash
index ffd1afd..24d5fc1 100755
--- a/abs/core/diskless-legacy/config_diskless_frontend.bash
+++ b/abs/core/diskless-legacy/config_diskless_frontend.bash
@@ -3,21 +3,18 @@
# frontend can boot from it.
function backtitle() { # no arguments.
- BT="${0##*/}"
- KMV_F1='/KNOPPIX/KnoppMyth-version'
- KMV_F2='/etc/LinHES-release'
- if [ -f "$KMV_F1" ]; then
- BT="-= $(cat $KMV_F1) $BT =-"
- elif [ -f "$KMV_F2" ]; then
- BT="-= $(cat $KMV_F2) $BT =-"
- fi
+ BT="${0##*/}"
+ KMV='/etc/LinHES-release'
+ if [ -f "$KMV" ]; then
+ BT="-= $(cat $KMV) $BT =-"
+ fi
}
function must_be_root() { # no arguments.
- test $(id -u) == 0 && return
- MSG="\Z1ERROR\Zn: This script \Z4should\Zn be run by \Z1root\Zn."
- dialog --backtitle "$BT" --colors --msgbox "$MSG" 5 45
- exit 4
+ test $(id -u) == 0 && return
+ MSG="\Z1ERROR\Zn: This script \Z4should\Zn be run by \Z1root\Zn."
+ dialog --backtitle "$BT" --colors --msgbox "$MSG" 5 45
+ exit 4
}
backtitle
@@ -319,13 +316,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 +380,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 +445,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 +503,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 +536,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
@@ -534,11 +551,12 @@ create_new_nfsroot() {
chroot $NFSROOT /sbin/remove_service.sh nmbd
chroot $NFSROOT /sbin/remove_service.sh smbd
chroot $NFSROOT /sbin/remove_service.sh tftpd
+ chroot $NFSROOT /sbin/remove_service.sh avahi
# 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 +565,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 +604,13 @@ $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
+ # Check if the user has a diskless_tweak.<frontend_name> file in root's
+ # home directory. If they do, run it inside the chroot of the NFS root.
+
+ if [[ -x ~/diskless_tweak.$FRONTEND ]] ; then
+ echo Running tweak file ~/diskless_tweak.$FRONTEND
+ chroot $NFSROOT bash -v ~/diskless_tweak.$FRONTEND
+ fi
create_default_pxelinux_entry
export_nfsroot
@@ -589,11 +619,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 +629,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 +637,7 @@ get_network_info
setup_tftpd
setup_dhcpd
enable_mysql_and_backend_networking
+find_storage_mounts
export_mounts
create_tftpboot_directory
enable_nfs