Initial commit

This commit is contained in:
7u83 2020-09-24 13:28:34 +02:00
parent 2e389439bd
commit b552e6ec02
2 changed files with 100 additions and 0 deletions

89
manifests/init.pp Normal file
View File

@ -0,0 +1,89 @@
#
#
class wmdeit_install
(
)
{
file {'/opt/wikimedia':
ensure => directory
}
}
define wmdeit_install::program(
$program = $title,
$archfile = "${program}.zip",
$source = "puppet:///downloads/packages/${program}/${archfile}",
$svg = "${program}.svg",
$svg_source = "puppet:///downloads/packages/${program}/${svg}",
$desktop = "${program}.desktop",
$desktop_source = "puppet:///downloads/packages/${program}/${desktop}",
$extract_path = "/opt/wikimedia/$program",
$extract_dir = "$program",
$exec = "$extract_path/$extract_dir/$program",
$exec_path = "$extract_path/$extract_dir",
){
file {$extract_path:
ensure => directory
}->
file {"$extract_path/$svg":
ensure => file,
source => $svg_source,
}->
file {"$extract_path/$desktop":
ensure => file,
# source => $desktop_source,
content => template("wmdeit_install/program.desktop.erb"),
}->
archive {"/tmp/$archfile":
source => $source,
extract_path => $extract_path,
extract => true,
} ->
exec{'Install commonist':
command => "/usr/bin/desktop-file-install --rebuild-mime-info-cache ${extract_path}/${desktop}",
#creates => '/usr/share/applications/$desktop',
refreshonly => true,
subscribe => [
Archive["/tmp/$archfile"],
File["$extract_path/$desktop"]
]
}
}
class wmdeit_install::commonist
{
# commonist
file {'/opt/wikimedia/commonist':
ensure => directory,
require => File['/opt/wikimedia']}
file {'/opt/wikimedia/commonist/commonist.zip':
ensure => present,
links => follow,
source => 'puppet:///downloads/packages/commonist/commonist.zip',
require => File['/opt/wikimedia/commonist']}
file {'/opt/wikimedia/commonist/commonist.desktop':
ensure => present,
source => 'puppet:///downloads/packages/commonist/commonist.desktop',
require => File['/opt/wikimedia/commonist']}
file {'/opt/wikimedia/commonist/commonist.svg':
ensure => present,
source => 'puppet:///downloads/packages/commonist/commonist.svg',
require => File['/opt/wikimedia/commonist']}
exec{'Unzip commonist':
command => '/usr/bin/unzip -o /opt/wikimedia/commonist/commonist.zip -d /opt/wikimedia/commonist',
creates => '/opt/wikimedia/commonist/commonist',
require => File['/opt/wikimedia/commonist/commonist.zip']}
exec{'Install commonist':
command => '/usr/bin/desktop-file-install --rebuild-mime-info-cache /opt/wikimedia/commonist/commonist.desktop',
creates => '/usr/share/applications/commonist.desktop',
require => Exec['Unzip commonist']}
}

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Type=Application
Version=1.0
Name=<%= @program %>
GenericName=Upload-Werkzeug
Comment=Uploader für Wikimedia Commons
Path=<%= @exec_path %>
Exec=<%= @exec %>
Icon=<%= @extract_path %>/<%= @svg %>
Terminal=false
Categories=Network;