-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathRakefile
37 lines (32 loc) · 1.02 KB
/
Rakefile
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
require "yast/rake"
Yast::Tasks.configuration do |conf|
# lets ignore license check for now
conf.skip_license_check << /.*/
end
# this special part allows using the "yupdate" script with this package,
# the location in the inst-sys is different than in the built RPM package
# so the usual "rake install" would not work here
# running in the inst-sys?
if File.exist?("/.packages.initrd")
task :install do
destdir = ENV["DESTDIR"] || "/"
control = "/control.xml"
# backup the original file
FileUtils.cp(control, "#{control}.bak") if File.exist?(control)
# install the new file
FileUtils.cp("control/control.leanos.xml", File.join(destdir, control))
end
end
desc "Validate the XML"
task :"test:validate" do
schema = "/usr/share/YaST2/control/control.rng".freeze
xml = "control/control.leanos.xml".freeze
begin
# prefer using jing for validation
sh "jing", schema, xml
puts "OK"
rescue Errno::ENOENT
# fallback to xmllint
sh "xmllint", "--noout", "--relaxng", schema, xml
end
end