]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/motd/templates/motd.erb
496b5dde6e608cfc6fb4e5a11beaaf8944597a78
[dsa-puppet.git] / modules / motd / templates / motd.erb
1
2 This device is for authorized users only.  All traffic on this device
3 is monitored and will be used as evidence for prosecutions.  By using
4 this machine you agree to abide by the Debian Machines Usage Policies
5 <URL:http://www.debian.org/devel/dmup>.
6
7 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8
9 <%=
10 def wrap(s, width=78)
11       s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n")
12 end
13
14 def markup(l)
15   l = l.gsub(/\[\[(.*?)\|(.*?)\]\]/, '\2')
16   l = l.gsub(/\[\[(\*|-)?(.*?)\]\]/, '\2')
17   return l
18 end
19
20 purp = ''
21 if nodeinfo.has_key?('nameinfo')
22   purp += wrap(nodeinfo['nameinfo']) + "\n\n"
23 end
24
25 purp += 'Welcome to ' + fqdn
26 if (nodeinfo['ldap'].has_key?('purpose'))
27   if nodeinfo['ldap']['purpose'].include?('buildd')
28     purp += ", the Debian "
29     if nodeinfo['ldap'].has_key?('architecture')
30       purp += nodeinfo['ldap']['architecture'][0]
31     end
32     purp += " build daemon\n"
33   elsif nodeinfo['ldap']['purpose'].include?('porterbox')
34     purp += ", the Debian "
35     if nodeinfo['ldap'].has_key?('architecture')
36       purp += nodeinfo['ldap']['architecture'][0]
37     end
38     purp += " porterbox\n"
39     purp += "\n"
40     purp += "See 'dchroot -l' or 'schroot -l' for a list of available chroots.\n"
41     if nodeinfo['ldap'].has_key?('admin')
42       purp += "Please contact #{nodeinfo['ldap']['admin'][0]} for install requests,\n"
43       purp += "following the recommendations in <URL:http://dsa.debian.org/doc/install-req/>.\n"
44     end
45   else
46     purp += ", used for the following services:\n"
47     nodeinfo['ldap']['purpose'].sort.each do |l|
48       l = markup(l)
49       purp += "\t" + l + "\n"
50     end
51   end
52 else
53   purp += "\n"
54 end
55
56 if (nodeinfo['ldap'].has_key?('physicalHost'))
57   purp += "\nThis virtual server runs on the physical host #{nodeinfo['ldap']['physicalHost'][0]}.\n"
58 end
59
60
61 vms = []
62 allnodeinfo.keys.sort.each do |node|
63   if allnodeinfo[node]['physicalHost'] and allnodeinfo[node]['physicalHost'].include?(fqdn)
64     vms << node
65   end
66 end
67 unless vms.empty?
68   purp += "\nThe following virtual machines run on this system:\n"
69   vms.each do |node|
70     purp += "\t- #{node}"
71     if allnodeinfo[node]['purpose']
72       purp += ":\n"
73       allnodeinfo[node]['purpose'].sort.each do |l|
74         l = markup(l)
75         purp += "\t    " + l + "\n"
76       end
77     else
78       purp += "\n"
79     end
80   end
81 end
82
83
84 if nodeinfo.has_key?('footer')
85   purp += "\n" + wrap(nodeinfo['footer']) + "\n"
86 end
87 purp
88 -%>
89
90 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
91
92 <%
93 # vim:set et:
94 # vim:set sts=2 ts=2:
95 # vim:set shiftwidth=2:
96 -%>