[debian-lan-devel] [SCM] Debian-LAN development and packaging branch, master, updated. 0.6-32-g21f7955

Andreas B. Mundt andi at debian.org
Tue Aug 28 11:33:15 UTC 2012


The following commit has been merged in the master branch:
commit fc25011ce1f2c1da0176f98a359bbdb93ac9edb4
Author: Andreas B. Mundt <andi at debian.org>
Date:   Tue Aug 28 12:38:48 2012 +0200

    Rework diskless clients and nbd-swapping.

diff --git a/fai/config/debconf/DISKLESS_CLIENT b/fai/config/debconf/DISKLESS_CLIENT
index 106dc74..bfdbf93 100644
--- a/fai/config/debconf/DISKLESS_CLIENT
+++ b/fai/config/debconf/DISKLESS_CLIENT
@@ -10,6 +10,8 @@ xserver-xorg xserver-xorg/autodetect_video_card boolean true
 nbd-client nbd-client/killall boolean false
 nbd-client nbd-client/device string /dev/nbd0
 nbd-client nbd-client/host string swapserver
-nbd-client nbd-client/port string 9572
+nbd-client nbd-client/port string 10809
 nbd-client nbd-client/type select swap
+## FIXME: workaround #685610
+nbd-client nbd-client/extra string -Nswap
 nbd-client nbd-client/number string 1
diff --git a/fai/config/files/etc/nbd-server/conf.d/swap.conf/DISKLESS_SERVER b/fai/config/files/etc/nbd-server/conf.d/swap.conf/DISKLESS_SERVER
new file mode 100644
index 0000000..5c98e0f
--- /dev/null
+++ b/fai/config/files/etc/nbd-server/conf.d/swap.conf/DISKLESS_SERVER
@@ -0,0 +1,4 @@
+[swap]
+exportname = /tmp/nbd-swap/%s
+prerun = nbdswapd %s
+postrun = rm -f %s
diff --git a/fai/config/files/usr/sbin/nbdswapd/DISKLESS_SERVER b/fai/config/files/usr/sbin/nbdswapd/DISKLESS_SERVER
index 6e169ae..ef22379 100755
--- a/fai/config/files/usr/sbin/nbdswapd/DISKLESS_SERVER
+++ b/fai/config/files/usr/sbin/nbdswapd/DISKLESS_SERVER
@@ -2,15 +2,16 @@
 #
 #  Inspired by nbdswapd from the ltsp-server package.
 
-## swap file and size (in MB):
-SWAP=$(mktemp)
-SIZE="64"
+set -e
 
-## create swap file:
-dd if=/dev/zero of=$SWAP bs=1024k count=0 seek=$SIZE 2> /dev/null
+## swap size (in MB):
+SIZE="128"
+
+SWAP="$1"
+SWAPDIR=${SWAP%/*}
 
-## start nbd-server:
-nbd-server 0 $SWAP -C /dev/null > /dev/null 2>&1
+test -d $SWAPDIR || mkdir -p $SWAPDIR
 
-## remove swap file:
-rm -f $SWAP
+## create swap file:
+dd if=/dev/zero of=$SWAP bs=1M count=0 seek="$SIZE" 2> /dev/null
+chmod 600 $SWAP
diff --git a/fai/config/package_config/DISKLESS_CLIENT b/fai/config/package_config/DISKLESS_CLIENT
index c390249..1e8ee1d 100644
--- a/fai/config/package_config/DISKLESS_CLIENT
+++ b/fai/config/package_config/DISKLESS_CLIENT
@@ -2,22 +2,25 @@ PACKAGES aptitude
 nbd-client
 libpam-script
 
-## minimal gnome+lxde desktop:
+## minimal gnome+lxde+xfce desktop:
 lxde
 lxtask
 desktop-base
 gnome-session
 gnome-applets
-
-## standard gnome desktop:
-#gnome-desktop-environment
+xfce4
 
 ## gnome desktop:
+#task-gnome-desktop
 #gnome
 
+## xfce desktop:
+#xfce4-goodies
+#task-xfce4-desktop
 
 ## other packages:
-gdm3
+lightdm policykit-1
+#gdm3
 menu
 eog
 evince
diff --git a/fai/config/scripts/DISKLESS_CLIENT/10-misc b/fai/config/scripts/DISKLESS_CLIENT/10-misc
index 10d5297..86c7549 100755
--- a/fai/config/scripts/DISKLESS_CLIENT/10-misc
+++ b/fai/config/scripts/DISKLESS_CLIENT/10-misc
@@ -7,6 +7,9 @@ set -e
 
 fcopy -v /etc/hosts
 
+## use hostname offered by dhcp server:
+rm -fv $target/etc/hostname
+
 ## fetch template and fill in nameserver's IP address:
 fcopy -v /etc/resolv.conf
 IP=`host ns | tail -n 1 | awk '{print $NF}'`
@@ -19,3 +22,11 @@ cp -f /usr/share/zoneinfo/${TIMEZONE} $target/etc/localtime
 # create keyboard layout table
 $ROOTCMD bash -c "echo 'console-data console-data/keymap/full select $KEYMAP' | debconf-set-selections"
 $ROOTCMD install-keymap $KEYMAP || true
+
+## Configure PAM to add users to the dialout group:
+ainsl -q /etc/security/group.conf "*;*;*;Al0000-2400;dialout"
+ainsl -q /etc/pam.d/common-auth "auth    optional        pam_group.so"
+
+## Choose the default desktop:
+#$ROOTCMD update-alternatives --set x-session-manager /usr/bin/startlxde
+$ROOTCMD update-alternatives --set x-session-manager /usr/bin/startxfce4
diff --git a/fai/config/scripts/DISKLESS_SERVER/10-setup b/fai/config/scripts/DISKLESS_SERVER/10-setup
index 464addb..17d16a6 100755
--- a/fai/config/scripts/DISKLESS_SERVER/10-setup
+++ b/fai/config/scripts/DISKLESS_SERVER/10-setup
@@ -4,8 +4,6 @@
 #
 
 fcopy -m root,root,0755 /usr/sbin/nbdswapd
+fcopy /etc/nbd-server/conf.d/swap.conf
 
-$ROOTCMD update-inetd --add "9572 stream tcp nowait nobody /usr/sbin/tcpd /usr/sbin/nbdswapd"
-
-ainsl /etc/exports     "/opt              ${SUBNETMASK}(async,ro,no_subtree_check,no_root_squash)"
-ainsl /etc/hosts.allow "nbdswapd: ALL: keepalive"
+ainsl /etc/exports "/opt              ${SUBNETMASK}(async,ro,no_subtree_check,no_root_squash)"

-- 
Debian-LAN development and packaging



More information about the debian-lan-devel mailing list