Remove iceweasel desktop icon.
[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/iceweasel.desktop':
144                 ensure => absent,
145         }
146
147         file { '/etc/skel/Desktop/firefox-esr.desktop':
148                 source => '/usr/share/applications/firefox-esr.desktop',
149                 replace => false,
150                 require => [
151                         Package['firefox-esr'],
152                         File['/etc/skel/Desktop'],
153                 ],
154         }
155
156         exec { 'fix-desktop-firefox-esr':
157                 command => '/bin/sed -i "/^Name/ s/=.*/=Webbrowser/;" /etc/skel/Desktop/firefox-esr.desktop',
158                 unless => '/bin/grep -q "^Name.*=Webbrowser" /etc/skel/Desktop/firefox-esr.desktop',
159                 require => File['/etc/skel/Desktop/firefox-esr.desktop'],
160         }
161
162         file { '/etc/firefox-esr/prefs.js':
163                 source => 'puppet:///modules/desktop/etc/firefox-esr/prefs.js',
164                 require => [
165                         Package['firefox-esr'],
166                 ],
167         }
168
169         group { 'guest':
170                 ensure => 'present'
171         }
172
173         user { 'guest':
174                 uid => 5000,
175                 home => '/run/user/5000/home',
176                 # password: guest
177                 password => '$6$pheeghohphaikuka$lJodCaTfZG4IhXw9.htxDsMDAiQrhOsXyJR.nvCdWc2EHgmstkTrpn/8LWi83e9Ac.WFDfzmQ1phpDII/npl/0',
178                 managehome => false,
179                 gid => 'guest',
180                 groups => [
181                                 'plugdev',
182                                 'cdrom',
183                                 'audio',
184                                 'video',
185                         ],
186                 shell => '/bin/bash',
187                 require => Group['guest'],
188                 ensure => 'present',
189         }
190
191         $packages_i386 = [
192                 'libc6:i386',
193                 'libqt4-dbus:i386',
194                 'libqt4-network:i386',
195                 'libqt4-xml:i386',
196                 'libqtcore4:i386',
197                 'libqtgui4:i386',
198                 'libqtwebkit4:i386',
199                 'libstdc++6:i386',
200                 'libx11-6:i386',
201                 'libxext6:i386',
202                 'libxss1:i386',
203                 'libxv1:i386',
204                 'libssl1.0.0:i386',
205                 'libpulse0:i386',
206                 'libasound2-plugins:i386',
207         ]
208
209         package { $packages_i386:
210                 ensure => installed,
211                 require => [
212                                 Exec['add-architecture-i386'],
213                                 Exec['apt_update'],
214                         ],
215         }
216
217         exec { 'download-skype':
218                 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',
219                 creates => '/var/cache/skype-install.deb',
220         }
221
222         package { 'skype':
223                 provider => dpkg,
224                 ensure => latest,
225                 source => '/var/cache/skype-install.deb',
226                 require => [
227                         Exec['download-skype'],
228                         Package['libc6:i386'],
229                         ],      
230         }
231
232         file { '/etc/skel/Desktop/skype.desktop':
233                 source => '/usr/share/applications/skype.desktop',
234                 require => [
235                         Package['skype'],
236                         File['/etc/skel/Desktop'],
237                 ],
238         }
239
240         exec { 'enable-guestx11':
241                 command => '/bin/systemctl enable guestx11.service',
242                 refreshonly => true,
243         }
244                 
245         exec { 'start-guestx11':
246                 command => '/bin/systemctl start guestx11.service',
247                 refreshonly => true,
248         }
249
250         file { '/usr/local/sbin/x11login':
251                 source => 'puppet:///modules/desktop/usr/local/sbin/x11login',
252                 mode => 'a=rx',
253                 ensure => file,
254         }
255
256         file { '/etc/skel':
257                 source => 'puppet:///modules/desktop/etc/skel',
258                 recurse => true,
259         }
260
261         file { '/etc/systemd/system/guestx11.service':
262                 source => 'puppet:///modules/desktop/etc/systemd/system/guestx11.service',
263                 mode => 'a=rx',
264                 require => [
265                                 Package['lxde'],
266                                 File['/etc/skel/Desktop'],
267                                 File['/usr/local/sbin/x11login'],
268                                 File['/etc/skel'],
269                         ],
270                 notify => [
271                                 Exec['enable-guestx11'],
272                                 Exec['start-guestx11'],
273                         ],
274                 ensure => file,
275         }
276         
277 }