Disable and remove not required xscreensaver.
[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                 'iceweasel',
38                 'iceweasel-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                 notify => Exec['fix-desktop-leafpad'],
83         }
84
85         exec { 'fix-desktop-leafpad':
86                 refreshonly => true,
87                 command => '/bin/sed -i "/^Name/ s/=.*/=Notes/;" /etc/skel/Desktop/leafpad.desktop',
88                 unless => '/bin/grep -q "^Name=Notes" /etc/skel/Desktop/leafpad.desktop',
89         }
90
91         file { '/etc/skel/Desktop/galculator.desktop':
92                 source => '/usr/share/applications/galculator.desktop',
93                 replace => false,
94                 require => [
95                         Package['lxde'],
96                         File['/etc/skel/Desktop'],
97                 ],
98                 notify => Exec['fix-desktop-galculator'],
99         }
100
101         exec { 'fix-desktop-galculator':
102                 refreshonly => true,
103                 command => '/bin/sed -i "/^Name/ s/=.*/=Calculator/;" /etc/skel/Desktop/galculator.desktop',
104                 unless => '/bin/grep -q "^Name.*=Calculator" /etc/skel/Desktop/galculator.desktop',
105         }
106
107         file { '/etc/skel/Desktop/chromium-l10n.desktop':
108                 source => '/usr/share/applications/chromium.desktop',
109                 require => [
110                         Package['chromium'],
111                         File['/etc/skel/Desktop'],
112                 ],
113         }
114         
115         file { '/etc/skel/Desktop/florence.desktop':
116                 source => '/usr/share/applications/florence.desktop',
117                 replace => false,
118                 require => [
119                         Package['florence'],
120                         File['/etc/skel/Desktop'],
121                 ],
122                 notify => Exec['fix-desktop-florence'],
123         }
124
125         exec { 'fix-desktop-florence':
126                 refreshonly => true,
127                 command => '/bin/sed -i "/^Name/ s/=.*/=Keyboard/;" /etc/skel/Desktop/florence.desktop',
128                 unless => '/bin/grep -q "^Name.*=Keyboard" /etc/skel/Desktop/florence.desktop',
129         }
130
131         file { '/etc/skel/Desktop/pcmanfm.desktop':
132                 source => '/usr/share/applications/pcmanfm.desktop',
133                 replace => false,
134                 require => [
135                         Package['pcmanfm'],
136                         File['/etc/skel/Desktop'],
137                 ],
138                 notify => Exec['fix-desktop-pcmanfm'],
139         }
140
141         exec { 'fix-desktop-pcmanfm':
142                 refreshonly => true,
143                 command => '/bin/sed -i "/^Name/ s/=.*/=Filemanager/;" /etc/skel/Desktop/pcmanfm.desktop',
144                 unless => '/bin/grep -q "^Name.*=Filemanager" /etc/skel/Desktop/pcmanfm.desktop',
145         }
146
147         file { '/etc/skel/Desktop/iceweasel.desktop':
148                 source => '/usr/share/applications/iceweasel.desktop',
149                 replace => false,
150                 require => [
151                         Package['iceweasel'],
152                         File['/etc/skel/Desktop'],
153                 ],
154                 notify => Exec['fix-desktop-iceweasel'],
155         }
156
157         exec { 'fix-desktop-iceweasel':
158                 refreshonly => true,
159                 command => '/bin/sed -i "/^Name/ s/=.*/=Webbrowser/;" /etc/skel/Desktop/iceweasel.desktop',
160                 unless => '/bin/grep -q "^Name.*=Webbrowser" /etc/skel/Desktop/iceweasel.desktop',
161         }
162
163
164         file { '/etc/iceweasel/profile/prefs.js':
165                 source => 'puppet:///modules/desktop/etc/iceweasel/profile/prefs.js',
166                 require => [
167                         Package['iceweasel'],
168                 ],
169         }
170
171         group { 'guest':
172                 ensure => 'present'
173         }
174
175         user { 'guest':
176                 uid => 5000,
177                 home => '/run/user/5000/home',
178                 # password: guest
179                 password => '$6$pheeghohphaikuka$lJodCaTfZG4IhXw9.htxDsMDAiQrhOsXyJR.nvCdWc2EHgmstkTrpn/8LWi83e9Ac.WFDfzmQ1phpDII/npl/0',
180                 managehome => false,
181                 gid => 'guest',
182                 groups => [
183                                 'plugdev',
184                                 'cdrom',
185                                 'audio',
186                                 'video',
187                         ],
188                 shell => '/bin/bash',
189                 require => Group['guest'],
190                 ensure => 'present',
191         }
192
193         $packages_i386 = [
194                 'libc6:i386',
195                 'libqt4-dbus:i386',
196                 'libqt4-network:i386',
197                 'libqt4-xml:i386',
198                 'libqtcore4:i386',
199                 'libqtgui4:i386',
200                 'libqtwebkit4:i386',
201                 'libstdc++6:i386',
202                 'libx11-6:i386',
203                 'libxext6:i386',
204                 'libxss1:i386',
205                 'libxv1:i386',
206                 'libssl1.0.0:i386',
207                 'libpulse0:i386',
208                 'libasound2-plugins:i386',
209         ]
210
211         package { $packages_i386:
212                 ensure => installed,
213                 require => [
214                                 Exec['add-architecture-i386'],
215                                 Exec['apt_update'],
216                         ],
217         }
218
219         exec { 'download-skype':
220                 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',
221                 creates => '/var/cache/skype-install.deb',
222         }
223
224         package { 'skype':
225                 provider => dpkg,
226                 ensure => latest,
227                 source => '/var/cache/skype-install.deb',
228                 require => [
229                         Exec['download-skype'],
230                         Package['libc6:i386'],
231                         ],      
232         }
233
234         file { '/etc/skel/Desktop/skype.desktop':
235                 source => '/usr/share/applications/skype.desktop',
236                 require => [
237                         Package['skype'],
238                         File['/etc/skel/Desktop'],
239                 ],
240         }
241
242         exec { 'enable-guestx11':
243                 command => '/bin/systemctl enable guestx11.service',
244                 refreshonly => true,
245         }
246                 
247         exec { 'start-guestx11':
248                 command => '/bin/systemctl start guestx11.service',
249                 refreshonly => true,
250         }
251
252         file { '/usr/local/sbin/x11login':
253                 source => 'puppet:///modules/desktop/usr/local/sbin/x11login',
254                 mode => 'a=rx',
255                 ensure => file,
256         }
257
258         file { '/etc/skel':
259                 source => 'puppet:///modules/desktop/etc/skel',
260                 recurse => true,
261         }
262
263         file { '/etc/systemd/system/guestx11.service':
264                 source => 'puppet:///modules/desktop/etc/systemd/system/guestx11.service',
265                 mode => 'a=rx',
266                 require => [
267                                 Package['lxde'],
268                                 File['/etc/skel/Desktop'],
269                                 File['/usr/local/sbin/x11login'],
270                                 File['/etc/skel'],
271                         ],
272                 notify => [
273                                 Exec['enable-guestx11'],
274                                 Exec['start-guestx11'],
275                         ],
276                 ensure => file,
277         }
278         
279 }