2017-09-10 17:25:29 +05:30
|
|
|
module SystemCheck
|
|
|
|
module App
|
|
|
|
class InitScriptUpToDateCheck < SystemCheck::BaseCheck
|
|
|
|
SCRIPT_PATH = '/etc/init.d/gitlab'.freeze
|
|
|
|
|
|
|
|
set_name 'Init script up-to-date?'
|
|
|
|
set_skip_reason 'skipped (omnibus-gitlab has no init script)'
|
|
|
|
|
|
|
|
def skip?
|
2018-03-17 18:26:18 +05:30
|
|
|
return true if omnibus_gitlab?
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
unless init_file_exists?
|
|
|
|
self.skip_reason = "can't check because of previous errors"
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
true
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def check?
|
|
|
|
recipe_path = Rails.root.join('lib/support/init.d/', 'gitlab')
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
recipe_content = File.read(recipe_path)
|
|
|
|
script_content = File.read(SCRIPT_PATH)
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
recipe_content == script_content
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def show_error
|
|
|
|
try_fixing_it(
|
|
|
|
'Re-download the init script'
|
|
|
|
)
|
|
|
|
for_more_information(
|
|
|
|
see_installation_guide_section 'Install Init Script'
|
|
|
|
)
|
|
|
|
fix_and_rerun
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def init_file_exists?
|
|
|
|
File.exist?(SCRIPT_PATH)
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|