2020-04-05 17:07:02 +02:00
|
|
|
import modules.helper as helper
|
|
|
|
|
|
|
|
def download_onescript():
|
|
|
|
command = helper.new_docker_command('images/core/distr/')
|
|
|
|
command.append('alpine')
|
|
|
|
command.append('wget')
|
|
|
|
command.append('-O')
|
|
|
|
command.append('/out_files/onescript.rpm')
|
2020-09-27 15:19:39 +02:00
|
|
|
command.append('https://oscript.io/downloads/1_4_0/x64/onescript-engine-1.4.0-1.fc26.noarch.rpm')
|
2020-04-05 17:07:02 +02:00
|
|
|
return command
|
|
|
|
|
2022-06-08 09:29:36 +02:00
|
|
|
def unzip_platform_distr(is_new_path_to_platform):
|
2020-04-05 17:07:02 +02:00
|
|
|
command = helper.new_docker_command()
|
|
|
|
command.append('-v')
|
|
|
|
command.append(helper.this_path + helper.replace_sep('images/core') + ':/main_dir')
|
|
|
|
command.append('alpine')
|
|
|
|
command.append('sh')
|
2022-06-08 09:29:36 +02:00
|
|
|
if is_new_path_to_platform:
|
|
|
|
command.append('/main_dir/get_platform_from_20_ver.sh')
|
|
|
|
else:
|
|
|
|
command.append('/main_dir/get_platform_to_19_ver.sh')
|
2020-04-05 17:07:02 +02:00
|
|
|
return command
|
|
|
|
|
|
|
|
|
2022-06-08 09:29:36 +02:00
|
|
|
def add_all_before_commands(is_new_path_to_platform):
|
2020-04-05 17:07:02 +02:00
|
|
|
commands = []
|
|
|
|
commands.append(download_onescript())
|
2022-06-08 09:29:36 +02:00
|
|
|
commands.append(unzip_platform_distr(is_new_path_to_platform))
|
2020-04-05 17:07:02 +02:00
|
|
|
return commands
|
|
|
|
|
|
|
|
def delete_core_distr_files():
|
|
|
|
command = helper.new_docker_command('images/core/distr/')
|
|
|
|
command.append('alpine')
|
|
|
|
command.append('sh -c "rm -rf /out_files/*.rpm"')
|
|
|
|
return command
|
|
|
|
|
2020-04-06 17:43:54 +02:00
|
|
|
def delete_license_tools_files():
|
|
|
|
command = helper.new_docker_command('images/core/distr/')
|
|
|
|
command.append('alpine')
|
|
|
|
command.append('sh -c "rm -rf /out_files/license-tools"')
|
|
|
|
return command
|
|
|
|
|
2020-04-05 17:07:02 +02:00
|
|
|
def add_all_after_commands():
|
|
|
|
commands = []
|
|
|
|
commands.append(delete_core_distr_files())
|
2020-04-06 17:43:54 +02:00
|
|
|
commands.append(delete_license_tools_files())
|
2020-04-05 17:07:02 +02:00
|
|
|
return commands
|
|
|
|
|
|
|
|
class New():
|
|
|
|
|
|
|
|
name = ''
|
|
|
|
commands_before = []
|
|
|
|
commands_after = []
|
|
|
|
|
2022-06-08 09:29:36 +02:00
|
|
|
def __init__(self, is_new_path_to_platform):
|
2020-04-05 17:07:02 +02:00
|
|
|
self.name = 'core'
|
2022-06-08 09:29:36 +02:00
|
|
|
self.commands_before = add_all_before_commands(is_new_path_to_platform)
|
2020-04-05 17:07:02 +02:00
|
|
|
self.commands_after = add_all_after_commands()
|