]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/motd/templates/motd.erb
try it like this
[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   if l =~ /\[\[(\*|-)?(.*?)\]\]/
16     l = $2
17   end
18   if l =~ /\[\[(.*?)\|(.*?)\]\]/
19     l = $2
20   end
21   return l
22 end
23
24 purp = ''
25 if nodeinfo.has_key?('nameinfo')
26   purp += wrap(nodeinfo['nameinfo']) + "\n\n"
27 end
28
29 purp += 'Welcome to ' + fqdn
30 if (nodeinfo['ldap'].has_key?('purpose'))
31   if nodeinfo['ldap']['purpose'].include?('buildd')
32     purp += ", the Debian "
33     if nodeinfo['ldap'].has_key?('architecture')
34       purp += nodeinfo['ldap']['architecture'][0]
35     end
36     purp += " build daemon\n"
37   elsif nodeinfo['ldap']['purpose'].include?('porterbox')
38     purp += ", the Debian "
39     if nodeinfo['ldap'].has_key?('architecture')
40       purp += nodeinfo['ldap']['architecture'][0]
41     end
42     purp += " porterbox\n"
43     purp += "\n"
44     purp += "See 'dchroot -l' for a list of available chroots.\n"
45     if nodeinfo['ldap'].has_key?('admin')
46       purp += "Please contact #{nodeinfo['ldap']['admin'][0]} for install requests,\n"
47       purp += "following the recommendations in <URL:http://dsa.debian.org/doc/install-req/>.\n"
48     end
49   else
50     purp += ", used for the following services:\n"
51     nodeinfo['ldap']['purpose'].sort.each do |l|
52       l = markup(l)
53       purp += "\t" + l + "\n"
54     end
55   end
56 else
57   purp += "\n"
58 end
59
60 if (nodeinfo['ldap'].has_key?('physicalHost'))
61   purp += "\nThis virtual server runs on the physical host #{nodeinfo['ldap']['physicalHost'][0]}.\n"
62 end
63
64
65 vms = []
66 allnodeinfo.keys.sort.each do |node|
67   if allnodeinfo[node]['physicalHost'] and allnodeinfo[node]['physicalHost'].include?(fqdn)
68     vms << node
69   end
70 end
71 unless vms.empty?
72   purp += "\nThe following virtual machines run on this system:\n"
73   vms.each do |node|
74     purp += "\t- #{node}"
75     if allnodeinfo[node]['purpose']
76       purp += ":\n"
77       allnodeinfo[node]['purpose'].sort.each do |l|
78         l = markup(l)
79         purp += "\t    " + l + "\n"
80       end
81     else
82       purp += "\n"
83     end
84   end
85 end
86
87
88 if nodeinfo.has_key?('footer')
89   purp += "\n" + wrap(nodeinfo['footer']) + "\n"
90 end
91 purp
92 -%>
93
94 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
95
96 <%
97 # vim:set et:
98 # vim:set sts=2 ts=2:
99 # vim:set shiftwidth=2:
100 -%>