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