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