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