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