Skip to content

Commit

Permalink
Merge pull request #1051 from spiccinini/safe_upgrade_add_bootstrap_f…
Browse files Browse the repository at this point in the history
…orce

Add force option to safe-upgrade bootstrap cmd
  • Loading branch information
G10h4ck authored Sep 15, 2023
2 parents d001cb7 + 9a9b8c6 commit 8071b44
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/safe-upgrade/files/usr/sbin/safe-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,14 @@ function su.preserve_files_to_new_partition(args)
end

local function bootstrap(args)
--TODO: add --force option to upgrade SU
if is_su_installed() then
print(string.format("safe-upgrade version '%s' is already installed, aborting",
get_su_version()))
os.exit(su.EXIT_STATUS_ALREADY_INSTALLED)
if args.force then
print("Forcing the bootstrap.")
else
print(string.format("safe-upgrade version '%s' is already installed, aborting",
get_su_version()))
os.exit(su.EXIT_STATUS_ALREADY_INSTALLED)
end
end


Expand Down Expand Up @@ -421,8 +424,8 @@ local function parse_args()
parser:command('confirm', ('Confirm the current partition. Use when after an upgrade ' ..
'or after running "test-other-partition".'))

parser:command('bootstrap', 'Install the safe-upgrade mechanism')

local bootstrap = parser:command('bootstrap', 'Install the safe-upgrade mechanism')
bootstrap:flag("--force", "Install even it is already installed.")
parser:command('test-other-partition', 'Mark the other partition as testing partition.')

parser:command('board-supported', 'Exits with 0 if board is supported')
Expand Down

0 comments on commit 8071b44

Please sign in to comment.