Skip to content

Commit

Permalink
disable vnc, shh,... installation if it is not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Sep 28, 2017
1 parent 5a9aa08 commit 263e9bc
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions library/general/src/modules/Linuxrc.rb
Expand Up @@ -31,6 +31,9 @@

module Yast
class LinuxrcClass < Module

include Yast::Logger

# Disables filesystem snapshots (fate#317973)
# Possible values: all, post, pre, single
DISABLE_SNAPSHOTS = "disable_snapshots".freeze
Expand Down Expand Up @@ -239,6 +242,32 @@ def value_for(feature_key)
ret
end

# Reset settings for vnc, ssh,... in install.inf which have been made
# by linuxrc settings.
#
# @param [Array<String>] list of services which will be disabled.
def disable_remote(services)
return if !services || services.empty?
log.warn "Disabling #{services} due missing packages."
services.each do |service|
case service
when "vnc"
SCR.Write(path(".etc.install_inf.VNC"), 0)
SCR.Write(path(".etc.install_inf.VNCPassword"), "")
when "ssh"
SCR.Write(path(".etc.install_inf.UseSSH"), 0)
when "braille"
SCR.Write(path(".etc.install_inf.Braille"), 0)
when "display-ip"
SCR.Write(path(".etc.install_inf.DISPLAY_IP"), 0)
else
log.error "#{service} not supported"
end
end
SCR.Write(path(".etc.install_inf"), nil) # Flush the cache
ResetInstallInf()
end

publish function: :ResetInstallInf, type: "void ()"
publish function: :InstallInf, type: "string (string)"
publish function: :manual, type: "boolean ()"
Expand All @@ -253,6 +282,7 @@ def value_for(feature_key)
publish function: :SaveInstallInf, type: "boolean (string)"
publish function: :keys, type: "list <string> ()"
publish function: :value_for, type: "string (string)"
publish function: :disable_remote, type: "list <string> ()"

private

Expand Down

0 comments on commit 263e9bc

Please sign in to comment.