From bcdd4da7309cf908132b5c8f5fe41870718c94ab Mon Sep 17 00:00:00 2001 From: Telmo Silva Date: Sun, 12 Apr 2020 21:52:37 -0300 Subject: [PATCH] Passing 'step' as argument --- install.py | 10 +++++++++- steps/step2.py | 3 +-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/install.py b/install.py index 47ee3ee..1c6eabd 100755 --- a/install.py +++ b/install.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -import configparser +import argparse, configparser # global variables path = "/tmp/tali.ini" @@ -11,8 +11,16 @@ def write_config_file(): config.write(config_file) def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--step", default=0) + args = parser.parse_args() + config.read(path) + if args.step != 0: # if a step was passed as an argument, use it + config["DEFAULT"] = { 'Step': args.step } + write_config_file() + if config.read(path) == []: # no config file found config["DEFAULT"] = { 'Step': '1' } write_config_file() diff --git a/steps/step2.py b/steps/step2.py index 7342364..47f2921 100755 --- a/steps/step2.py +++ b/steps/step2.py @@ -8,5 +8,4 @@ os.system("pacstrap /mnt python wget") os.system("genfstab -U /mnt >> /mnt/etc/fstab") os.system("cp -r /root/tali /mnt/tali") -os.system("cp /tmp/tali.ini /mnt/tmp") -os.system("arch-chroot /mnt python tali/install.py") +os.system("arch-chroot /mnt python tali/install.py --step 3")