source: lmd-client/trunk/fuentes/install/usr/share/ltsp/init-ltsp.d.diversions/05-getltsconffile.lliurex @ 512

Last change on this file since 512 was 512, checked in by mabarracus, 5 years ago

copy trusty code

File size: 1.6 KB
Line 
1# get the lts.conf via tftp
2
3# $filename comes from net-eth0.conf and is usually "/<path>/pxelinux.0".
4# If it contains a path, we want to construct "/<path>/lts.conf".
5# If it doesn't, we want just "lts.conf" without inserting a slash, as some tftp
6# servers have problems with it. Finally, if $filename isn't set, we want to
7# default to "/ltsp/i386/lts.conf".
8if [ -n "$SERVER" ]; then
9    fileonly=${filename##*/}
10    pathonly=${filename%$fileonly}
11    global_lts_conf_temp=$(mktemp)
12    local_lts_conf_temp=$(mktemp)
13    lts_conf_temp=$(mktemp)
14    flavour_name=$(basename "$NBD_ROOT_NAME")
15    #tftp "$SERVER" -c get ${pathonly:-/ltsp/i386/}lts.conf $lts_conf_temp >/dev/null
16    if [ $LTSCONF ]; then
17        tftp "$SERVER" -c get ${pathonly:-/ltsp/}${LTSCONF:-"lts.conf"} $lts_conf_temp >/dev/null
18    else
19        tftp "$SERVER" -c get ${pathonly:-/ltsp/}lts.conf $global_lts_conf_temp > /dev/null
20        EXISTLOCAL=$(tftp "$SERVER" -c get ${pathonly:-/ltsp/}${flavour_name}/lts.conf $local_lts_conf_temp | grep -q "Error code 1"; echo $?)
21        if [ "$MERGELTSCONF" != "false" ]; then
22            ltsmerger $global_lts_conf_temp $local_lts_conf_temp > $lts_conf_temp
23        else
24            if [ "$EXISTLOCAL" = "0" ]; then
25                mv $global_lts_conf_temp $lts_conf_temp
26            else
27                mv $local_lts_conf_temp $lts_conf_temp
28            fi
29        fi
30    fi
31    # only overwrite lts.conf if it has non-zero size.
32    if [ -s "$lts_conf_temp" ]; then
33        mv "$lts_conf_temp" /etc/lts.conf
34    else
35        rm "$lts_conf_temp"
36    fi
37fi
38
39# Get the lts.conf vars into the environment
40. /usr/share/ltsp/ltsp_config
Note: See TracBrowser for help on using the repository browser.