agama/service/bin/agama-autoyast
Imobach González Sosa 48df2608c4
[service] Replace Yast2::Popup with an Agama specific class
* It uses the questions service to display the messages.
* By now it is just a PoC that needs to be extended.
2024-02-06 06:52:30 +00:00

50 lines
1.4 KiB
Ruby
Executable file

#!/usr/bin/env ruby
# frozen_string_literal: true
#
# Copyright (c) [2024] SUSE LLC
#
# All Rights Reserved.
#
# 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.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, contact SUSE LLC.
#
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.
# TEMPORARY overwrite of Y2DIR to use DBus for communication with dependent yast modules
require "yast"
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
# Set the PATH to a known value
ENV["PATH"] = "/sbin:/usr/sbin:/usr/bin:/bin"
require "rubygems"
# find Gemfile when D-Bus activates a git checkout
Dir.chdir(__dir__) do
require "bundler/setup"
end
require "agama/autoyast/converter"
if ARGV.length != 2
warn "Usage: #{$PROGRAM_NAME} URL DIRECTORY"
exit 1
end
begin
url, directory = ARGV
converter = Agama::AutoYaST::Converter.new(url)
converter.to_agama(directory)
rescue RuntimeError => e
warn "Could not load the profile from #{url}: #{e}"
exit 2
end