File: ltsp-info

package info (click to toggle)
ltsp 5.2.4-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 4,932 kB
  • ctags: 271
  • sloc: sh: 5,267; ansic: 1,048; perl: 225; python: 211; lex: 152; makefile: 112; yacc: 59
file content (179 lines) | stat: -rwxr-xr-x 5,197 bytes parent folder | download
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#!/bin/sh

#  Copyright (c) 2006-2009 Vagrant Cascadian <vagrant@freegeek.org>

#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License as
#  published by the Free Software Foundation; either version 2 of the
#  License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, you can find it on the World Wide
#  Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
#  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
#  MA 02110-1301, USA.

if [ -e /etc/sysconfig/ltspdist ]; then
    . /etc/sysconfig/ltspdist
    VENDOR=$VENDORDEF
else
    VENDOR=$(lsb_release --id --short | tr " " "_")
fi
export BASE=${BASE:-/opt/ltsp}                       # LTSP base directory

# generic functions
find_chroots() {
    find $BASE -mindepth 1 -maxdepth 1 -type d
}

find_lts_conf() {
    chroot=$1
    chroot_name=$(basename $chroot)
    lts_conf_dirs="$chroot/etc /var/lib/tftpboot/ltsp/$chroot_name /srv/tftp/ltsp/$chroot_name /tftpboot/ltsp/$chroot_name"
    for lts_conf_dir in $lts_conf_dirs ; do
        lts_conf=$lts_conf_dir/lts.conf
        if [ -f "$lts_conf" ]; then
            echo found: "$lts_conf"
            if [ "$verbose" = "true" ]; then
                cat "$lts_conf"
            fi
            echo
        fi
    done
}

find_images() {
    if [ -d "$BASE/images" ]; then
        for image in $(find $BASE/images/ -type f -name '*.img' ); do
            echo found image: $image
            if [ "$verbose" = "true" ] && [ -x /usr/bin/file ]; then
                file $image 
            fi
            echo
        done
    fi     
}

lsb_server_info() {
    echo server information:
    lsb_release --all
    echo
}


# distro specific functions
Debian_server_packages() {
    echo server packages:
    COLUMNS=200 dpkg -l 'ltsp*' 'ldm*' | awk '/ltsp|ldm/{print $1,$2,$3}'
    echo
}

Debian_chroot_packages() {
    chroot=$1
    if [ -f $chroot/var/lib/dpkg/status ]; then
        echo "packages in chroot: $chroot"
        COLUMNS=200 dpkg --root=$chroot -l 'ltsp*' 'ldm*' | awk '/ltsp-client|ldm|ltspfs/{print $1,$2,$3}'
        echo
    fi
}

Debian_chroot_release() {
    if [ -x $chroot/usr/bin/lsb_release ]; then
        echo "chroot information: $chroot"
        ROOT=$chroot ltsp-chroot lsb_release --all
        echo
    fi
}

Gentoo_server_packages() {
    echo server packages:
    Gentoo_packages
    echo
}

Gentoo_packages() {
    chroot=$1
    cat $chroot/var/db/pkg/net-misc/ltsp*/PF
    cat $chroot/var/db/pkg/sys-fs/ltspfs-*/PF
    cat $chroot/var/db/pkg/*/ldm*/PF
}

Gentoo_chroot_packages() {
    chroot=$1
    if [ -d $chroot/var/db/pkg ]; then
        echo "packages in chroot: $chroot"
        Gentoo_packages $chroot
        echo
    fi
}

for opt in $@ ; do
    case $opt in
        --no-server-info) server_info="false" ;;
        --verbose|-v) verbose="true" ;;
    esac
done

case $VENDOR in
    Debian|Ubuntu)
        if [ "$server_info" != "false" ]; then
            lsb_server_info
            Debian_server_packages
        fi
        for chroot in $(find_chroots) ; do
            chroot_name=$(basename $chroot)
            if [ "$verbose" = "true" ]; then
                Debian_chroot_release
            fi
            Debian_chroot_packages $chroot
            find_lts_conf $chroot
        done
        find_images
        ;;
    Gentoo)
        if [ "$server_info" != "false" ]; then
            lsb_server_info
            Gentoo_server_packages
        fi
        for chroot in $(find_chroots) ; do
            chroot_name=$(basename $chroot)
            Gentoo_chroot_packages $chroot
            find_lts_conf $chroot
        done
        find_images
        ;;
    SUSE_LINUX)
       if [ x"$USER" != x"root" ]; then
            echo "You have to be root to run this script"
            exit 1
       fi
       echo "-------------------------------------------------------------"
       echo "Please paste the following information on http://pastebin.com"
       echo "post the resulting link to the mailing list or IRC channel"
       echo "-------------------------------------------------------------"
       echo "LSB information:"
       lsb_release --all
       echo "Package information:"
       rpm -qa "*kiwi*"
       rpm -qa "*ltsp*"
       rpm -qa "*ldm*"
       echo "Network information:"
       ip addr
       echo "kiwi-ltsp configuration:"
       cat /etc/sysconfig/kiwi-ltsp | grep -v \#
       kiwi-ltsp-setup -c || true
       echo "DHCPD configuration:"
       cat /etc/dhcpd.conf | grep -v \#
       echo "contents of lts.conf:"
       cat /srv/tftpboot/KIWI/lts.conf | grep -v \#
       echo "pxelinux.cfg/default contents:"
       cat /srv/tftpboot/pxelinux.cfg/default
       echo "kiwi's config.default:"
       cat /srv/tftpboot/KIWI/config.default
       ;;
esac