summaryrefslogtreecommitdiffstats
path: root/puppet/modules/mesa3d/manifests/windows.pp
blob: 655f8591b2f2d086cf6ac130266d485d3cbc182c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
class mesa3d::windows {
    # FIXME: this module is incomplete for 64-bit Windows.
    # It only installs a 32-bit version of the mesa DLL.

    $tempdir = $baselayout::tempdir
    $gitdir = $::architecture ? {
        x64 => "C:\\Program Files (x86)\\Git",
        default => "C:\\Program Files\\Git"
    }
    $opengl_library = "opengl32.dll"
    $windows_system32 = "c:\\Windows\\system32"
    $windows_dlldir32 = $::architecture ? {
        x64 => "C:\\Windows\\SysWOW64",
        default => $windows_system32
    }
    $cmd = "$windows_system32\\cmd.exe"
    $mesa3ddll = "mesa3d_opengl.dll"

    exec { prepare_for_opengl32_replace:
        command  =>  "$cmd /C \
            \
            takeown /f $windows_dlldir32\\$opengl_library & \
            icacls $windows_dlldir32\\$opengl_library /grant Administrators:F & \
            \"$gitdir\\bin\\curl.exe\" -o $tempdir\\$mesa3ddll $input/mesa3d/windows/$opengl_library\
            \
        ",
        creates => "$tempdir\\$mesa3ddll",
        require => File[$tempdir],
        logoutput => true,
    }

    file { "$windows_dlldir32\\opengl32.dll":
        ensure => present,
        backup => main,
        owner => Administrators,
        mode => 0775,
        replace => true,
        source => "$tempdir\\$mesa3ddll",
        require => Exec["prepare_for_opengl32_replace"],
    }
}