mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-05 23:54:19 +00:00
some logging
This commit is contained in:
parent
f2c73853bc
commit
ac220c6968
|
@ -5,6 +5,7 @@ from selfprivacy_api.migrations.migration import Migration
|
|||
|
||||
|
||||
class MigrateToSelfprivacyChannel(Migration):
|
||||
"""Migrate to selfprivacy Nix channel."""
|
||||
def get_migration_name(self):
|
||||
return "migrate_to_selfprivacy_channel"
|
||||
|
||||
|
@ -13,11 +14,14 @@ class MigrateToSelfprivacyChannel(Migration):
|
|||
|
||||
def is_migration_needed(self):
|
||||
try:
|
||||
print("Checking if migration is needed")
|
||||
output = subprocess.check_output(
|
||||
["nix-channel", "--list"], start_new_session=True
|
||||
)
|
||||
output = output.decode("utf-8")
|
||||
print(output)
|
||||
first_line = output.split("\n", maxsplit=1)[0]
|
||||
print(first_line)
|
||||
return first_line.startswith("nixos") and (
|
||||
first_line.endswith("nixos-21.11") or first_line.endswith("nixos-21.05")
|
||||
)
|
||||
|
@ -30,6 +34,7 @@ class MigrateToSelfprivacyChannel(Migration):
|
|||
# Also, go to /etc/nixos directory and make a git pull
|
||||
current_working_directory = os.getcwd()
|
||||
try:
|
||||
print("Changing channel")
|
||||
os.chdir("/etc/nixos")
|
||||
subprocess.check_output(
|
||||
[
|
||||
|
|
Loading…
Reference in a new issue