Cleanup.
[inetstation.git] / modules / desktop / manifests / init.pp
1 class desktop {
2
3         file { '/etc/skel/Desktop':
4                 ensure => directory,
5         }
6
7         package { 'xinit':
8                 ensure => installed,
9         }
10
11         package { 'lxde':
12                 ensure => installed,
13                 require => Package['xinit'],
14         }
15
16         $dms = [
17                 'lightdm*',
18                 'kdm',
19                 'gdm3',
20                 'nodm',
21                 'wdm',
22                 'xdm',
23                 'slim',
24         ]
25
26         package { $dms:
27                 ensure => absent,
28                 require => Package['lxde'],
29         }
30
31         package { 'xscreensaver':
32                 ensure => absent,
33         }
34
35         $packages = [
36                 'pcmanfm',
37                 'firefox-esr',
38                 'firefox-esr-l10n-*',
39                 'gstreamer1.0-libav',
40                 'gstreamer1.0-plugins-good',
41                 'flashplugin-nonfree',
42                 'chromium',
43                 'chromium-l10n',
44                 'libreoffice',
45 #               'libreoffice-help-*',
46 #               'libreoffice-l10n-*',
47                 'ttf-mscorefonts-installer',
48                 'ttf-liberation',
49                 'fonts-crosextra-carlito',
50                 'fonts-crosextra-caladea',
51                 'florence',
52
53         ]
54   
55         package { $packages:
56                 ensure => installed,
57         }
58
59         file { '/etc/skel/Desktop/libreoffice-startcenter.desktop':
60                 source => '/usr/share/applications/libreoffice-startcenter.desktop',
61                 require => [
62                         Package['libreoffice'],
63                         File['/etc/skel/Desktop'],
64                 ],
65         }
66
67         file { '/etc/skel/Desktop/lxde-logout.desktop':
68                 source => '/usr/share/applications/lxde-logout.desktop',
69                 require => [
70                         Package['lxde'],
71                         File['/etc/skel/Desktop'],
72                 ],
73         }
74
75         file { '/etc/skel/Desktop/leafpad.desktop':
76                 source => '/usr/share/applications/leafpad.desktop',
77                 replace => false,
78                 require => [
79                         Package['lxde'],
80                         File['/etc/skel/Desktop'],
81                 ],
82         }
83
84         exec { 'fix-desktop-leafpad':
85                 command => '/bin/sed -i "/^Name/ s/=.*/=Notes/;" /etc/skel/Desktop/leafpad.desktop',
86                 unless => '/bin/grep -q "^Name=Notes" /etc/skel/Desktop/leafpad.desktop',
87                 require => File['/etc/skel/Desktop/leafpad.desktop'],
88         }
89
90         file { '/etc/skel/Desktop/galculator.desktop':
91                 source => '/usr/share/applications/galculator.desktop',
92                 replace => false,
93                 require => [
94                         Package['lxde'],
95                         File['/etc/skel/Desktop'],
96                 ],
97         }
98
99         exec { 'fix-desktop-galculator':
100                 command => '/bin/sed -i "/^Name/ s/=.*/=Calculator/;" /etc/skel/Desktop/galculator.desktop',
101                 unless => '/bin/grep -q "^Name.*=Calculator" /etc/skel/Desktop/galculator.desktop',
102                 require => File['/etc/skel/Desktop/galculator.desktop'],
103         }
104
105         file { '/etc/skel/Desktop/chromium-l10n.desktop':
106                 source => '/usr/share/applications/chromium.desktop',
107                 require => [
108                         Package['chromium'],
109                         File['/etc/skel/Desktop'],
110                 ],
111         }
112         
113         file { '/etc/skel/Desktop/florence.desktop':
114                 source => '/usr/share/applications/florence.desktop',
115                 replace => false,
116                 require => [
117                         Package['florence'],
118                         File['/etc/skel/Desktop'],
119                 ],
120         }
121
122         exec { 'fix-desktop-florence':
123                 command => '/bin/sed -i "/^Name/ s/=.*/=Keyboard/;" /etc/skel/Desktop/florence.desktop',
124                 unless => '/bin/grep -q "^Name.*=Keyboard" /etc/skel/Desktop/florence.desktop',
125                 require => File['/etc/skel/Desktop/florence.desktop'],
126         }
127
128         file { '/etc/skel/Desktop/pcmanfm.desktop':
129                 source => '/usr/share/applications/pcmanfm.desktop',
130                 replace => false,
131                 require => [
132                         Package['pcmanfm'],
133                         File['/etc/skel/Desktop'],
134                 ],
135         }
136
137         exec { 'fix-desktop-pcmanfm':
138                 command => '/bin/sed -i "/^Name/ s/=.*/=Filemanager/;" /etc/skel/Desktop/pcmanfm.desktop',
139                 unless => '/bin/grep -q "^Name.*=Filemanager" /etc/skel/Desktop/pcmanfm.desktop',
140                 require => File['/etc/skel/Desktop/pcmanfm.desktop'],
141         }
142
143         file { '/etc/skel/Desktop/firefox-esr.desktop':
144                 source => '/usr/share/applications/firefox-esr.desktop',
145                 replace => false,
146                 require => [
147                         Package['firefox-esr'],
148                         File['/etc/skel/Desktop'],
149                 ],
150         }
151
152         exec { 'fix-desktop-firefox-esr':
153                 command => '/bin/sed -i "/^Name/ s/=.*/=Webbrowser/;" /etc/skel/Desktop/firefox-esr.desktop',
154                 unless => '/bin/grep -q "^Name.*=Webbrowser" /etc/skel/Desktop/firefox-esr.desktop',
155                 require => File['/etc/skel/Desktop/firefox-esr.desktop'],
156         }
157
158         file { '/etc/firefox-esr/profile/prefs.js':
159                 source => 'puppet:///modules/desktop/etc/firefox-esr/profile/prefs.js',
160                 require => [
161                         Package['firefox-esr'],
162                 ],
163         }
164
165         group { 'guest':
166                 ensure => 'present'
167         }
168
169         user { 'guest':
170                 uid => 5000,
171                 home => '/run/user/5000/home',
172                 # password: guest
173                 password => '$6$pheeghohphaikuka$lJodCaTfZG4IhXw9.htxDsMDAiQrhOsXyJR.nvCdWc2EHgmstkTrpn/8LWi83e9Ac.WFDfzmQ1phpDII/npl/0',
174                 managehome => false,
175                 gid => 'guest',
176                 groups => [
177                                 'plugdev',
178                                 'cdrom',
179                                 'audio',
180                                 'video',
181                         ],
182                 shell => '/bin/bash',
183                 require => Group['guest'],
184                 ensure => 'present',
185         }
186
187         $packages_i386 = [
188                 'libc6:i386',
189                 'libqt4-dbus:i386',
190                 'libqt4-network:i386',
191                 'libqt4-xml:i386',
192                 'libqtcore4:i386',
193                 'libqtgui4:i386',
194                 'libqtwebkit4:i386',
195                 'libstdc++6:i386',
196                 'libx11-6:i386',
197                 'libxext6:i386',
198                 'libxss1:i386',
199                 'libxv1:i386',
200                 'libssl1.0.0:i386',
201                 'libpulse0:i386',
202                 'libasound2-plugins:i386',
203         ]
204
205         package { $packages_i386:
206                 ensure => installed,
207                 require => [
208                                 Exec['add-architecture-i386'],
209                                 Exec['apt_update'],
210                         ],
211         }
212
213         exec { 'download-skype':
214                 command => '/usr/bin/wget -qO/var/cache/.skype-install.deb.part http://www.skype.com/go/getskype-linux-deb && /bin/mv /var/cache/.skype-install.deb.part /var/cache/skype-install.deb',
215                 creates => '/var/cache/skype-install.deb',
216         }
217
218         package { 'skype':
219                 provider => dpkg,
220                 ensure => latest,
221                 source => '/var/cache/skype-install.deb',
222                 require => [
223                         Exec['download-skype'],
224                         Package['libc6:i386'],
225                         ],      
226         }
227
228         file { '/etc/skel/Desktop/skype.desktop':
229                 source => '/usr/share/applications/skype.desktop',
230                 require => [
231                         Package['skype'],
232                         File['/etc/skel/Desktop'],
233                 ],
234         }
235
236         exec { 'enable-guestx11':
237                 command => '/bin/systemctl enable guestx11.service',
238                 refreshonly => true,
239         }
240                 
241         exec { 'start-guestx11':
242                 command => '/bin/systemctl start guestx11.service',
243                 refreshonly => true,
244         }
245
246         file { '/usr/local/sbin/x11login':
247                 source => 'puppet:///modules/desktop/usr/local/sbin/x11login',
248                 mode => 'a=rx',
249                 ensure => file,
250         }
251
252         file { '/etc/skel':
253                 source => 'puppet:///modules/desktop/etc/skel',
254                 recurse => true,
255         }
256
257         file { '/etc/systemd/system/guestx11.service':
258                 source => 'puppet:///modules/desktop/etc/systemd/system/guestx11.service',
259                 mode => 'a=rx',
260                 require => [
261                                 Package['lxde'],
262                                 File['/etc/skel/Desktop'],
263                                 File['/usr/local/sbin/x11login'],
264                                 File['/etc/skel'],
265                         ],
266                 notify => [
267                                 Exec['enable-guestx11'],
268                                 Exec['start-guestx11'],
269                         ],
270                 ensure => file,
271         }
272         
273 }