]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/motd/templates/motd.erb
Try new motd
[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   p = nodeinfo['ldap']['purpose'].clone()
28   extra = ''
29
30   if p.delete('buildd')
31     purp += ", the Debian "
32     if nodeinfo['ldap'].has_key?('architecture')
33       purp += nodeinfo['ldap']['architecture'][0]
34     end
35     purp += " build daemon\n"
36   end
37
38   if p.delete('porterbox')
39     purp += ", the Debian "
40     if nodeinfo['ldap'].has_key?('architecture')
41       purp += nodeinfo['ldap']['architecture'][0]
42     end
43     purp += " porterbox\n"
44     extra += "\n"
45     extra += "See 'dchroot -l' or 'schroot -l' for a list of available chroots.\n"
46     if nodeinfo['ldap'].has_key?('admin')
47       extra += "Please contact #{nodeinfo['ldap']['admin'][0]} for install requests,\n"
48       extra += "following the recommendations in <URL:http://dsa.debian.org/doc/install-req/>.\n"
49     end
50   end
51
52   if p.size() > 0
53     purp += ", used for the following services:\n"
54     nodeinfo['ldap']['purpose'].sort.each do |l|
55       l = markup(l)
56       purp += "\t" + l + "\n"
57     end
58   else
59     purp += ".\n"
60   end
61
62   purp += extra
63 else
64   purp += ".\n"
65 end
66
67 if (nodeinfo['ldap'].has_key?('physicalHost'))
68   purp += wrap("This virtual server runs on the physical host #{nodeinfo['ldap']['physicalHost'][0]}." +
69                "It is hosted at #{nodeinfo['hoster']['longname']}."
70                )
71 elsif nodeinfo['hoster']['name']
72   purp += wrap("This server is hosted at #{nodeinfo['hoster']['longname']}.")
73 end
74
75
76 vms = []
77 allnodeinfo.keys.sort.each do |node|
78   if allnodeinfo[node]['physicalHost'] and allnodeinfo[node]['physicalHost'].include?(fqdn)
79     vms << node
80   end
81 end
82 unless vms.empty?
83   purp += "\nThe following virtual machines run on this system:\n"
84   vms.each do |node|
85     purp += "\t- #{node}"
86     if allnodeinfo[node]['purpose']
87       purp += ":\n"
88       allnodeinfo[node]['purpose'].sort.each do |l|
89         l = markup(l)
90         purp += "\t    " + l + "\n"
91       end
92     else
93       purp += "\n"
94     end
95   end
96 end
97
98
99 if nodeinfo.has_key?('footer')
100   purp += "\n" + wrap(nodeinfo['footer']) + "\n"
101 end
102 purp
103 -%>
104
105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
106
107 <%
108 # vim:set et:
109 # vim:set sts=2 ts=2:
110 # vim:set shiftwidth=2:
111 -%>