mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-29 07:21:27 +00:00
feat: Add system reboot after NixOS build during flake migration
This commit is contained in:
parent
431165ca74
commit
c7f9909209
|
@ -4,8 +4,10 @@ import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
import tarfile
|
import tarfile
|
||||||
import shutil
|
import shutil
|
||||||
|
import time
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from selfprivacy_api.jobs import JobStatus, Jobs
|
from selfprivacy_api.jobs import JobStatus, Jobs
|
||||||
|
import selfprivacy_api.actions.system as system_actions
|
||||||
|
|
||||||
from selfprivacy_api.migrations.migration import Migration
|
from selfprivacy_api.migrations.migration import Migration
|
||||||
|
|
||||||
|
@ -249,7 +251,7 @@ class MigrateToFlakes(Migration):
|
||||||
)
|
)
|
||||||
print("================================")
|
print("================================")
|
||||||
print(
|
print(
|
||||||
"NixOS built. You may reboot now! Creating a notification for the app"
|
"NixOS built. Rebooting soon!"
|
||||||
)
|
)
|
||||||
print("================================")
|
print("================================")
|
||||||
|
|
||||||
|
@ -257,11 +259,15 @@ class MigrateToFlakes(Migration):
|
||||||
name="NixOS upgrade to 23.11",
|
name="NixOS upgrade to 23.11",
|
||||||
type_id="migrations.migrate_to_flakes",
|
type_id="migrations.migrate_to_flakes",
|
||||||
status=JobStatus.FINISHED,
|
status=JobStatus.FINISHED,
|
||||||
status_text="New system built. Reboot your server to apply.",
|
status_text="New system built. Check your server API version: if it is 3.0.0 or higher, you've successfully migrated",
|
||||||
progress=100,
|
progress=100,
|
||||||
description="Migration to the modular SelfPrivacy system",
|
description="Migration to the modular SelfPrivacy system",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
system_actions.reboot_system()
|
||||||
|
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
os.chdir(current_working_directory)
|
os.chdir(current_working_directory)
|
||||||
print("Error")
|
print("Error")
|
||||||
|
|
Loading…
Reference in a new issue