installer-feature-ltsp-0.7.6/000075500000000000000000000000001211665557300161435ustar00rootroot00000000000000installer-feature-ltsp-0.7.6/Makefile000064400000000000000000000004121211665557300176000ustar00rootroot00000000000000install2_dir=$(datadir)/install2 install: install -d $(install2_dir) [ -d initinstall.d ] && cp -a initinstall.d $(install2_dir) ||: [ -d preinstall.d ] && cp -a preinstall.d $(install2_dir) ||: [ -d postinstall.d ] && cp -a postinstall.d $(install2_dir) ||: installer-feature-ltsp-0.7.6/postinstall.d/000075500000000000000000000000001211665557300207415ustar00rootroot00000000000000installer-feature-ltsp-0.7.6/postinstall.d/71-network-shares-nfssec-REVERT.sh000075500000000000000000000002571211665557300267710ustar00rootroot00000000000000#!/bin/sh -efu exit 0 . install2-init-functions nfsconf='/etc/sysconfig/nfs' [ ! -f "$destdir$nfsconf" ] || sed -i 's/SECURE_NFS=yes/# SECURE_NFS=yes/' "$destdir$nfsconf" installer-feature-ltsp-0.7.6/postinstall.d/90-chroot-passwd.sh000075500000000000000000000003711211665557300243240ustar00rootroot00000000000000#!/bin/sh # transfer system root password to just-built terminal chroot # (too early to do at the chroot build time) . install2-init-functions SHADOW=etc/tcb/root/shadow cd "$destdir" for f in var/lib/ltsp/*/$SHADOW; do cat $SHADOW > "$f" done installer-feature-ltsp-0.7.6/preinstall.d/000075500000000000000000000000001211665557300205425ustar00rootroot00000000000000installer-feature-ltsp-0.7.6/preinstall.d/98-eth000075500000000000000000000045261211665557300215150ustar00rootroot00000000000000#!/bin/sh # hardwire eth0 at 192.168.0.1/24 . install2-init-functions cd /sys/class/net # yes if none, it's intended (for preconfiguration with no driver) single_iface() { [ "`echo eth* | wc -w`" = 1 ]; } # preserve errorlevel just in case it's ever needed test_speed() { [ -d "$1" ] && { . "$1/device/uevent" if [ "$DRIVER" = virtio_net ]; then echo 1 # a token speed else if ip link set up dev "$1"; then cat "$1/speed" else echo 0 # at least it's there fi fi } } # 3 seconds is a result of a haggle with netch@ test_dhcp() { dhcpcd -t 3 -T -q $i >&2; } # try to save what's there already copy_rules() { local f=/etc/udev/rules.d/70-persistent-net.rules [ -s "$f" ] && cp -a "$f" "$destdir$f" # ...or return non-zero } # persistence isn't futile write_rule() { copy_rules && return [ -d "$1" ] || return INTERFACE="$1" \ MATCHADDR="`cat "$1/address"`" \ chroot "$destdir" /lib/udev/write_net_rules } # the heuristic is: # - choose the fastest of interfaces getting DHCP replies for INET_ETH; # - choose the fastest of the rest for LTSP_ETH; # - do NOT configure any of DHCP interfaces for LTSP_IP # since our dhcpd will sit there LTSP_SPEED=-1 INET_SPEED=-1 if single_iface; then test_dhcp eth0 && INET_ETH=eth0 || LTSP_ETH=eth0 else for i in eth*; do SPEED="`test_speed "$i"`" if test_dhcp "$i"; then if [ "$SPEED" -gt "$INET_SPEED" ]; then INET_SPEED="$SPEED" INET_ETH="$i" fi else if [ "$SPEED" -gt "$LTSP_SPEED" ]; then LTSP_SPEED="$SPEED" LTSP_ETH="$i" fi fi done fi # last effort if [ -z "$LTSP_ETH$INET_ETH" ]; then test_dhcp eth0 && NO="# DHCP detected, disable ours\n#" LTSP_ETH=eth0 fi # this default is hardwired in several more places at the moment, # see also http://www.altlinux.org/LTSP/Network LTSP_IP="192.168.0.1/24" IFACEDIR="$destdir/etc/net/ifaces" if [ -n "$LTSP_ETH" ]; then write_rule "$LTSP_ETH" mkdir -p "$IFACEDIR/$LTSP_ETH" echo -e "$NO$LTSP_IP" > "$IFACEDIR/$LTSP_ETH/ipv4address" cat > "$IFACEDIR/$LTSP_ETH/options" <<-EOF ${LTSP_SPEED:+# speed: $LTSP_SPEED} TYPE=eth BOOTPROTO=static NM_CONTROLLED=no DISABLED=no EOF fi if [ -n "$INET_ETH" ]; then write_rule "$INET_ETH" mkdir -p "$IFACEDIR/$INET_ETH" cat > "$IFACEDIR/$INET_ETH/options" <<-EOF ${INET_SPEED:+# speed: $INET_SPEED} TYPE=eth BOOTPROTO=dhcp NM_CONTROLLED=no DISABLED=no EOF fi installer-feature-ltsp-0.7.6/preinstall.d/98-ltsp000075500000000000000000000111211211665557300217040ustar00rootroot00000000000000#!/bin/sh # first shot at setting up LTSP5 # see alsp http://www.freesource.info/wiki/Dokumentacija/LTSP5 # # currently depends on postinstall.d/06-pxe.sh for tftp/rpcbind fixes # # TODO: move this script into a feature subpackage, see also # http://www.freesource.info/wiki/TZ/AltLinux/WhiteLabel # # 2007, 2008, 2009, 2010 Michael Shigorin . install2-init-functions [ -z "$AUTOINSTALL" ] || exit 0 MOUNTED= LBCCONF="$destdir/etc/ltsp/ltsp-build-client.conf" cdrom_stage3="${cdrom_stage3:-/media/cdrom}" # where l-b-c expects it mount_image() { MOUNTED="$destdir/$cdrom_stage3" mkdir -p "$MOUNTED" mount -o bind /image "$MOUNTED" || MOUNTED= } case "$METHOD" in cdrom|nfs) mount_image;; *) echo "$0: installation method '$METHOD' not supported" >&2 echo "$0: you might have to ltsp-build-client yourself" >&2 exit 0;; # would have to pass custom sources.list down then esac # FIXME: probably ltsp-build-client should be fixed not to interfere # with system apt configuration and caches cp -a $destdir/var/lib/apt/lists/ $destdir/tmp/ # obsolete module might still be mentioned -- replace it subst 's,r1000,r8168,' "$LBCCONF" ||: # use installation media, not ftp.altlinux.org subst 's,MIRROR=.*,MIRROR="rpm file:/media/cdrom ALTLinux main",' "$LBCCONF" ||: # use thin client flavour with patches against nfs swap deadlocks #grep ^KERNEL= "$LBCCONF" || echo 'KERNEL="kernel-image-tmc-tc"' >> "$LBCCONF" # FIXME: kludge (std-def won't boot on 32M x86_64 thin client btw) #if [ "`arch`" = i686 ]; then # echo 'KERNEL="kernel-image-ltsp-client"' >> "$LBCCONF" #else # echo 'KERNEL="kernel-image-std-def"' >> "$LBCCONF" #fi #echo 'KERNEL_MODULES="alsa compcache drm fglrx nvidia"' >> "$LBCCONF" echo 'KERNEL_MODULES="alsa drm sound"' >> "$LBCCONF" # mc :( nx :) echo 'LATE_PACKAGES="mc ltsp-client-nxsession"' >> "$LBCCONF" mkdir -p $destdir/root/.ltsp-log/ ||: # exec_chroot doesn't suppress stdout *and* resets environment #exec_chroot ltsp-build-client 2>&1 | tee $destdir/root/.ltsp-log/ltsp-build-client.log # don't do env *-i* env PATH="/sbin:/usr/sbin:$PATH" HOME="/root" TMPDIR="/tmp" chroot "$destdir" ltsp-build-client 2>&1 \ | tee $destdir/root/.ltsp-log/ltsp-build-client.log # FIXME: /dev/console somehow gets lost :-( # very much likely that something's overly eager with cleanup cp -a /dev/console $destdir/var/lib/ltsp/i586/dev/console ||: # configure base services for 192.168.0.1/24 on some interface # FIXME: LTSP network prefix should become configurable some day... cp -a $destdir/etc/ltsp/dhcpd.conf $destdir/etc/dhcp ||: subst 's/only_from = 127.0.0.1/only_from = 192.168.0.0\/24/' $destdir/etc/xinetd.conf ||: subst 's/-port -1 //' $destdir/etc/sysconfig/xfs ||: subst 's/ -nolisten tcp//' $destdir/etc/X11/xinit/xserverrc ||: # enable XDMCP for kdmrc in $destdir/etc/X11/kdm{,4}/kdmrc; do [ -f "$kdmrc" ] && sed -ir 's/^Enable=false/Enable=true/' "$kdmrc" ||: done # gdm [ -f "$destdir/etc/control.d/facilities/gdm_xdmcp" ] \ && run_chroot control gdm/xdmcp enabled ||: # lightdm CONF="$destdir/etc/lightdm/lightdm.conf" [ -f "$CONF" ] && sed -i -e '/^\[XDMCPServer\]/aenabled=true' "$CONF" ||: # chkconfig&restart services needed # tftp is xinetd-based, service has nothing to do there # NB: also done in 06-pxe.sh run_chroot chkconfig dm on ||: run_chroot chkconfig xfs on ||: run_chroot chkconfig tftp on ||: run_chroot chkconfig dhcpd on ||: run_chroot chkconfig xinetd on ||: run_chroot chkconfig rpcbind on ||: run_chroot chkconfig nfs on ||: # add localdev support -- we're on hardware not in VE okay? grep -q ^fuse $destdir/etc/modules || echo fuse >> $destdir/etc/modules run_chroot control fusermount public ||: # FIXME: all hardwired, but a lot of stuff needs to be reconfigured either # (when ltsp network is going to be configurable); so: # care for resolving in the most crude manner possible grep -q ^192.168.0.1 $destdir/etc/hosts || echo "192.168.0.1 server server.ltsp" >> $destdir/etc/hosts grep -q ^192.168.0.250 $destdir/etc/hosts || { for i in `seq 20 250`; do echo "192.168.0.$i ws$i ws$i.ltsp" >> $destdir/etc/hosts done } run_chroot update_chrooted conf # ask syslog to accept thin clients' logs sed -i "s,^SYSLOGD_OPTIONS=',&-r ," $destdir/etc/sysconfig/syslogd # prepare mini CD image to boot PXE-less thin clients run_chroot ltsp-mkbootiso -o /opt/ltsp-boot.iso ||: # FIXME: workaround for tricky aptwork in ltsp-build-client, part II rm -f $destdir/var/cache/apt/*.bin ||: rm -f $destdir/var/cache/apt/gen{src,pkg}list/* ||: rm -rf $destdir/var/lib/apt/lists/ ||: mv $destdir/tmp/lists/ $destdir/var/lib/apt ||: [ -n "$MOUNTED" ] && umount "$MOUNTED" ||: installer-feature-ltsp-0.7.6/preinstall.d/98-startup000075500000000000000000000071571211665557300224420ustar00rootroot00000000000000#!/bin/sh # bloody hack to speed up and clean up terminals' boot # should be fixed properly by passing "fastboot" in kernel args # and then enhanced by adding "diskless" support in startup . install2-init-functions [ -z "$AUTOINSTALL" ] || exit 0 ltspdir=$destdir/var/lib/ltsp/i586 mv $ltspdir/etc/rc.d/rc.sysinit{,-default} cat > $ltspdir/etc/rc.d/rc.sysinit-ltsp << "__EOF__" #!/bin/sh # # /etc/rc.d/rc.sysinit - run once at boot time # # Taken in part from Miquel van Smoorenburg's bcheckrc. # Taken to parts for diskless LTSP clients. # trap '' SIGPIPE WITHOUT_RC_COMPAT=1 # Source function library . /etc/init.d/functions # Fix console loglevel dmesg -n "$LOGLEVEL" HOSTNAME=`hostname` if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; then hostname localhost fi # Set system font ExecIfExecutable /sbin/setsysfont >/dev/null 2>&1 && SETSYSFONT_DONE=1 || SETSYSFONT_DONE= PrintMargin() { if [ "$BOOTUP" != serial ]; then local n n=`echo -n "$*" |wc -c` 2>/dev/null && tput hpa $(( (COLUMNS - n)/2 )) fi } # Print a banner. ;) WELCOME="Welcome to " BANNER="ALT Linux" PrintMargin "$WELCOME$BANNER" echo -n "$WELCOME" SETCOLOR_INFO echo -n "$BANNER" SETCOLOR_NORMAL echo # Mount /proc (done here so volume labels can work with fsck) action "Mounting proc filesystem:" mount -n -t proc proc /proc chgrp proc /proc >/dev/null 2>&1 ||: # Mount /sys where appropriate if grep -wqs sysfs /proc/filesystems; then action "Mounting sys filesystem:" mount -n -t sysfs sysfs /sys fi # Load modules /etc/rc.d/scripts/load_modules RUN_UDEV= udevd_exe=/etc/init.d/udevd [ ! -x "$udevd_exe" ] || grep -iwqs noudev /proc/cmdline || RUN_UDEV=1 # Start udev if [ -n "$RUN_UDEV" ]; then RUN_FROM_SYSINIT=1 "$udevd_exe" start [ -c /dev/rtc ] || modprobe rtc >/dev/null 2>&1 fi # Remount the root filesystem read-write action "Remounting root filesystem in read/write mode:" ${REMOUNT_ROOTFS_RW_COMMAND:-mount -n -o remount,rw /} # The root filesystem is now read-write, so we can now log via syslog() directly [ -z "$IN_INITLOG" ] || IN_INITLOG= # Configure kernel parameters action "Configuring kernel parameters:" sysctl -e -p /etc/sysctl.conf if [ -z "$RUN_UDEV" ]; then sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1 sysctl -w kernel.hotplug="/sbin/hotplug" >/dev/null 2>&1 fi OLD_COLUMNS="$COLUMNS" # Load framebuffer device settings /etc/rc.d/scripts/framebuffer_init # Set system font again, if required if [ "$OLD_COLUMNS" != "$COLUMNS" ]; then ExecIfExecutable /sbin/setsysfont >/dev/null 2>&1 && SETSYSFONT_DONE=1 || SETSYSFONT_DONE= fi # Mount all other filesystems (except for NFS and /proc, which is already # mounted). Contrary to standard usage, # filesystems are NOT unmounted in single user mode # (pixel) also do not mount loopback, will be done later action 'Mounting local filesystems:' mount -a -t nocifs,davfs,ftpfs,loop,ncp,ncpfs,nfs,panfs,proc,smbfs,sshfs -O no_netdev # Set system font again, if required [ -n "$SETSYSFONT_DONE" ] || ExecIfExecutable /sbin/setsysfont >/dev/null 2>&1 # Do the following while waiting for an 'I' from the user... { # Now turn on swap again (in case we swap to files) action "Activating swap space:" swapon -a # Initialize the serial ports ExecIfExecutable /etc/rc.d/rc.serial # Now that we have all of our basic modules loaded and the kernel going, # let's dump the syslog ring somewhere so we can find it later dmesg >/var/log/dmesg kill -TERM `pidof getkey` >/dev/null 2>&1 } & if [ -n "$PROMPT" ]; then getkey i || PROMPT= fi wait if [ -n "$PROMPT" ]; then touch /var/run/confirm fi __EOF__ chmod +x $ltspdir/etc/rc.d/rc.sysinit-ltsp ln -s rc.sysinit-ltsp $ltspdir/etc/rc.d/rc.sysinit :