File: ltsp-update-kernels

package info (click to toggle)
ltsp 0.99debian11
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 976 kB
  • ctags: 103
  • sloc: sh: 1,320; python: 485; ansic: 436; lex: 152; makefile: 129; yacc: 58
file content (59 lines) | stat: -rw-r--r-- 1,675 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh

set -e

if [ -f /etc/ltsp/ltsp-update-kernels.conf ]; then
    . /etc/ltsp/ltsp-update-kernels.conf
fi

TFTPDIR=${TFTPDIR:-"/var/lib/tftpboot"}
TFTPBOOT=${TFTPBOOT:-"$TFTPDIR/ltsp"}
BASE=${BASE:-"/opt/ltsp"}
COPYTFTP=${COPYTFTP:-"true"}

if [ "$TFTPDIR" = "$BASE" ]; then
    COPYTFTP="false"
    TFTPBOOT="$TFTPDIR"
fi

if [ ! -d $TFTPDIR ] ; then
    mkdir -p $TFTPDIR
fi

ALL_CHROOTS="$@"
ALL_CHROOTS=${ALL_CHROOTS:-"$(find $BASE -mindepth 1 -maxdepth 1 -type d)"}

for CHROOT in $ALL_CHROOTS ; do
    if [ -x $CHROOT/bin/true ]; then
        echo "Updating tftp directories for chroot: $CHROOT"

        export CHROOT_NAME="$(basename $CHROOT)"

        # check for compatible (i.e. chrootable) architecture
        if chroot $CHROOT /bin/true ; then
            # update kernels for the chroot
            if [ -x "$CHROOT/usr/lib/ltsp/update-kernels" ]; then
                chroot "$CHROOT" /usr/lib/ltsp/update-kernels
            fi
        fi

        if [ "$COPYTFTP" = "true" ]; then
            mkdir -p $TFTPBOOT/$CHROOT_NAME
            cp -a -v $CHROOT/boot/. $TFTPBOOT/$CHROOT_NAME/
        fi

        if [ -f $CHROOT/boot/yaboot ]; then
            if [ -f $CHROOT/boot/yaboot.conf ]; then
                # yaboot requires the files in a specific location,
                # link them so they appear there.
                ln -s $TFTPBOOT/$CHROOT/boot/yaboot $TFTPDIR
                ln -s $TFTPBOOT/$CHROOT/boot/yaboot.conf $TFTPDIR
            else
                echo "WARNING: yaboot present but not configured."
            fi
        fi  
    else
        # not a valid chroot
        echo "Skipping invalid chroot: $CHROOT"
    fi
done