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