blob: 317ad4fe8eb972484cb7aa7f0f44602e54eb6774 (
plain)
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
|
#!/bin/sh
#
# Collect sytem information and pass it on to the sitesummary server
# using HTTP put.
# https://svn.revolutionlinux.com/MILLE/XTERM/trunk/mille-xterm-getltscfg/src/getltscfg.script
set -e
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
# Make sure the output from programs is well known.
LC_ALL=C
export LC_ALL
# Make sure to store files in a ramfs backed
# storage area on diskless clients, so use /tmp/.
tmpdir=/tmp/sitesummary-$$
log() {
msg="$@"
echo "$msg"
logger -p user.info -t sitesummary-client "$msg"
}
error() {
msg="$@"
log "error: $msg"
}
# Check or get GPG key, return false if it is unavailable
get_gpg_key_if_missing() {
url="$1"
true
}
gpg_encrypt_for_url() {
url="$1"
infile="$2"
outfile="$2"
return
GPGOPTS="--no-default-keyring --keyring $urlkeyring"
gpg $GPGOPTS -e $infile > $outfile
}
# Read the package default
[ -f /usr/share/sitesummary/sitesummary-client.conf ] && \
. /usr/share/sitesummary/sitesummary-client.conf
for confdir in \
/usr/share/sitesummary/config.d \
/etc/sitesummary/config.d
do
[ -d $confdir ] || continue
for config in $confdir/* ; do
[ -f $config ] && . $config
done
done
mkdir $tmpdir && cd $tmpdir
for fragdir in $fragdirs ; do
[ -d $fragdir ] || continue
for frag in $fragdir/*; do
[ -x $frag ] && $frag || true
done
done
# Wrap up the package
hostsummaryfile=$tmpdir.tar.gz
tar zcf $hostsummaryfile .
for url in $serverurls ; do
if [ "$gpgencrypt" != false ] ; then
if get_gpg_key_if_missing $url ; then
error "gpg key for '$url' is unavailable. refusing to submit."
continue
fi
gpg_encrypt_for_url $url "$hostsummaryfile" "$hostsummaryfile.gpg"
hostsummaryfile="$hostsummaryfile.gpg"
fi
#WGETOPTS="--no-check-certificate"
if sitesummary-upload -u $url -f $hostsummaryfile -d; then
:
else
error "unable to submit to '$url'"
fi
done
rm $hostsummaryfile
rm -r $tmpdir
|