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