Improiving on git branch switching

This commit is contained in:
Anton Hvornum 2019-11-13 22:46:41 +00:00
parent d08f9835a2
commit 9627e2079b
1 changed files with 9 additions and 7 deletions

View File

@ -336,13 +336,15 @@ def update_git(branch='master'):
# if(num_changes): # if(num_changes):
if branch != 'master': if branch != 'master':
print(f'[N] Changing branch to {branch}') on_branch = simple_command('(cd /root/archinstall; git branch | grep "*" | cut -d\' \' -f 2)')
output = simple_command(f'(cd /root/archinstall; git checkout {branch}; git pull)') if on_branch.strip().lower() != branch.strip().lower():
print('[N] Rebooting the new branch') print(f'[N] Changing branch to {branch}')
if not 'rebooted' in args: output = simple_command(f'(cd /root/archinstall; git checkout {branch}; git pull)')
os.execv('/usr/bin/python3', ['archinstall.py'] + sys.argv + ['--rebooted','--rerun']) print('[N] Rebooting the new branch')
else: if not 'rebooted' in args:
os.execv('/usr/bin/python3', ['archinstall.py'] + sys.argv + ['--rerun',]) os.execv('/usr/bin/python3', ['archinstall.py'] + sys.argv + ['--rebooted','--rerun'])
else:
os.execv('/usr/bin/python3', ['archinstall.py'] + sys.argv + ['--rerun',])
if not 'rebooted' in args: if not 'rebooted' in args:
## Reboot the script (in same context) ## Reboot the script (in same context)