Added apt-get update before upgrade.
[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                 'vlc',
53                 'browser-plugin-vlc',
54                 'youtube-dl',
55         ]
56   
57         package { $packages:
58                 ensure => installed,
59         }
60
61         file { '/etc/skel/Desktop/libreoffice-startcenter.desktop':
62                 source => '/usr/share/applications/libreoffice-startcenter.desktop',
63                 require => [
64                         Package['libreoffice'],
65                         File['/etc/skel/Desktop'],
66                 ],
67         }
68
69         file { '/etc/skel/Desktop/lxde-logout.desktop':
70                 source => '/usr/share/applications/lxde-logout.desktop',
71                 require => [
72                         Package['lxde'],
73                         File['/etc/skel/Desktop'],
74                 ],
75         }
76
77         file { '/etc/skel/Desktop/leafpad.desktop':
78                 source => '/usr/share/applications/leafpad.desktop',
79                 replace => false,
80                 require => [
81                         Package['lxde'],
82                         File['/etc/skel/Desktop'],
83                 ],
84         }
85
86         exec { 'fix-desktop-leafpad':
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                 require => File['/etc/skel/Desktop/leafpad.desktop'],
90         }
91
92         file { '/etc/skel/Desktop/galculator.desktop':
93                 source => '/usr/share/applications/galculator.desktop',
94                 replace => false,
95                 require => [
96                         Package['lxde'],
97                         File['/etc/skel/Desktop'],
98                 ],
99         }
100
101         exec { 'fix-desktop-galculator':
102                 command => '/bin/sed -i "/^Name/ s/=.*/=Calculator/;" /etc/skel/Desktop/galculator.desktop',
103                 unless => '/bin/grep -q "^Name.*=Calculator" /etc/skel/Desktop/galculator.desktop',
104                 require => File['/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         }
123
124         exec { 'fix-desktop-florence':
125                 command => '/bin/sed -i "/^Name/ s/=.*/=Keyboard/;" /etc/skel/Desktop/florence.desktop',
126                 unless => '/bin/grep -q "^Name.*=Keyboard" /etc/skel/Desktop/florence.desktop',
127                 require => File['/etc/skel/Desktop/florence.desktop'],
128         }
129
130         file { '/etc/skel/Desktop/pcmanfm.desktop':
131                 source => '/usr/share/applications/pcmanfm.desktop',
132                 replace => false,
133                 require => [
134                         Package['pcmanfm'],
135                         File['/etc/skel/Desktop'],
136                 ],
137         }
138
139         exec { 'fix-desktop-pcmanfm':
140                 command => '/bin/sed -i "/^Name/ s/=.*/=Filemanager/;" /etc/skel/Desktop/pcmanfm.desktop',
141                 unless => '/bin/grep -q "^Name.*=Filemanager" /etc/skel/Desktop/pcmanfm.desktop',
142                 require => File['/etc/skel/Desktop/pcmanfm.desktop'],
143         }
144
145         file { '/etc/skel/Desktop/iceweasel.desktop':
146                 ensure => absent,
147         }
148
149         file { '/etc/skel/Desktop/firefox-esr.desktop':
150                 source => '/usr/share/applications/firefox-esr.desktop',
151                 replace => false,
152                 require => [
153                         Package['firefox-esr'],
154                         File['/etc/skel/Desktop'],
155                 ],
156         }
157
158         exec { 'fix-desktop-firefox-esr':
159                 command => '/bin/sed -i "/^Name/ s/=.*/=Webbrowser/;" /etc/skel/Desktop/firefox-esr.desktop',
160                 unless => '/bin/grep -q "^Name.*=Webbrowser" /etc/skel/Desktop/firefox-esr.desktop',
161                 require => File['/etc/skel/Desktop/firefox-esr.desktop'],
162         }
163
164         file { '/etc/firefox-esr/prefs.js':
165                 source => 'puppet:///modules/desktop/etc/firefox-esr/prefs.js',
166                 require => [
167                         Package['firefox-esr'],
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 }