modules: misc: Add a class to install a copr repo
This commit is contained in:
@@ -27,12 +27,14 @@
|
|||||||
# additional permission if he deems it necessary to achieve the goals of this
|
# additional permission if he deems it necessary to achieve the goals of this
|
||||||
# additional permission.
|
# additional permission.
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
import "golang"
|
import "golang"
|
||||||
import "golang/strings" as golang_strings
|
import "golang/strings" as golang_strings
|
||||||
import "iter"
|
import "iter"
|
||||||
import "local"
|
import "local"
|
||||||
import "net"
|
import "net"
|
||||||
import "os"
|
import "os"
|
||||||
|
import "strings"
|
||||||
import "world/collect"
|
import "world/collect"
|
||||||
|
|
||||||
# ssh_keygen creates an ssh key pair in the user's home directory if the private
|
# ssh_keygen creates an ssh key pair in the user's home directory if the private
|
||||||
@@ -359,3 +361,27 @@ class systemd_daemon_reload($name) {
|
|||||||
ifshell => "/usr/bin/bash",
|
ifshell => "/usr/bin/bash",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Instead of running `dnf copr enable purpleidea/foo` you can use
|
||||||
|
# `purpleidea/foo` as the $name here to accomplish the same thing.
|
||||||
|
class copr_enable($name) {
|
||||||
|
# example: sudo dnf copr enable gsauthof/dracut-sshd
|
||||||
|
# /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:gsauthof:dracut-sshd.repo
|
||||||
|
$sp = strings.split($name, "/")
|
||||||
|
$user = $sp[0]
|
||||||
|
$repo = $sp[1]
|
||||||
|
$p = fmt.printf("/etc/yum.repos.d/_copr:copr.fedorainfracloud.org:%s:%s.repo", $user, $repo)
|
||||||
|
|
||||||
|
# TODO: If we wanted to be more thorough, we could template the file
|
||||||
|
# instead or running this copr enable command.
|
||||||
|
exec "dnf-copr-enable-${name}" {
|
||||||
|
cmd => "/usr/bin/dnf",
|
||||||
|
args => [
|
||||||
|
"copr",
|
||||||
|
"enable",
|
||||||
|
"${name}",
|
||||||
|
],
|
||||||
|
creates => $p,
|
||||||
|
user => "root",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user