#!/usr/bin/env ruby

# check if production install
if __FILE__.include?('sbin')
  UTILS_PATH='/usr/share/katello'
else
  UTILS_PATH=File.expand_path('..', __FILE__)
end

require File.join(UTILS_PATH, 'restore.rb')

katello_restore = KatelloUtilities::Restore.new("capsule", "satellite", ["satellite", "capsule"])

puts "DEPRECATION WARNING: satellite-restore and katello-restore will be removed in Satellite 6.4, " \
     "where they will be replaced by foreman-maintain\n"

if katello_restore.accepted_scenarios.include? katello_restore.last_scenario
  katello_restore.run
else
  STDOUT.puts katello_restore.error_message
end
