-
Notifications
You must be signed in to change notification settings - Fork 19
/
install_ssl_certificates
executable file
·48 lines (42 loc) · 1.57 KB
/
install_ssl_certificates
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
42
43
44
45
46
47
48
#! /usr/bin/env ruby
# ------------------------------------------------------------------------------
# Copyright (c) 2019 SUSE LLC
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of version 2 of the GNU General Public License as published by the
# Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# ------------------------------------------------------------------------------
#
# This is a helper script which to import the SSL certificates into inst-sys
# during installation. (But is should work also in installed system.)
#
# It is intended for user convenience, this script just call the YaST
# functions, it not used by YaST itself.
require "English"
require "yast"
require "registration/ssl_certificate"
dir = Registration::SslCertificate::INSTSYS_CERT_DIR
if Dir.empty?(dir)
puts "ERROR: Empty #{dir} directory, put your SSL certificate there."
exit 1
end
# in installed system just call the update-ca-certificates script
if ENV["YAST_IS_RUNNING"] != "instsys"
puts "Updating the installed SSL certificates..."
system("/usr/sbin/update-ca-certificates")
puts $CHILD_STATUS.success? ? "Done" : "Failed!"
exit $CHILD_STATUS.exitstatus
end
# import into the inst-sys
puts "Updating the inst-sys SSL certificates..."
if Registration::SslCertificate.update_instsys_ca
puts "Done"
else
puts "Failed!"
exit 1
end