Schedule full Android message media backups
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
gmcliArchiveRoot = "/home/imalison/Backups/gmcli/git-sync";
|
gmcliArchiveRoot = "/home/imalison/Backups/gmcli/git-sync";
|
||||||
gmcliArchiveOutput = "${gmcliArchiveRoot}/archive";
|
gmcliArchiveOutput = "${gmcliArchiveRoot}/archive";
|
||||||
gmcliTelephonyOutput = "${gmcliArchiveRoot}/telephony";
|
gmcliTelephonyOutput = "${gmcliArchiveRoot}/telephony";
|
||||||
|
gmcliTelephonyFullOutput = "/home/imalison/Backups/gmcli/android-telephony-full";
|
||||||
gmcliBackupLock = "/home/imalison/.local/state/gmcli/backup.lock";
|
gmcliBackupLock = "/home/imalison/.local/state/gmcli/backup.lock";
|
||||||
exportGmcliArchive = pkgs.writeShellScript "export-gmcli-archive" ''
|
exportGmcliArchive = pkgs.writeShellScript "export-gmcli-archive" ''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
@@ -29,6 +30,14 @@
|
|||||||
--force --include-part-data=false
|
--force --include-part-data=false
|
||||||
${gmcliPackage}/bin/gmcli android verify-telephony --dir ${lib.escapeShellArg gmcliTelephonyOutput}
|
${gmcliPackage}/bin/gmcli android verify-telephony --dir ${lib.escapeShellArg gmcliTelephonyOutput}
|
||||||
'';
|
'';
|
||||||
|
exportGmcliTelephonyFullArchive = pkgs.writeShellScript "export-gmcli-telephony-full-archive" ''
|
||||||
|
set -euo pipefail
|
||||||
|
${gmcliPackage}/bin/gmcli android export-telephony \
|
||||||
|
--adb ${pkgs.android-tools}/bin/adb \
|
||||||
|
--out ${lib.escapeShellArg gmcliTelephonyFullOutput} \
|
||||||
|
--force --include-part-data=true
|
||||||
|
${gmcliPackage}/bin/gmcli android verify-telephony --dir ${lib.escapeShellArg gmcliTelephonyFullOutput}
|
||||||
|
'';
|
||||||
refreshGmcliArchiveUnlocked = pkgs.writeShellScript "refresh-gmcli-archive-unlocked" ''
|
refreshGmcliArchiveUnlocked = pkgs.writeShellScript "refresh-gmcli-archive-unlocked" ''
|
||||||
set -uo pipefail
|
set -uo pipefail
|
||||||
status=0
|
status=0
|
||||||
@@ -90,6 +99,7 @@
|
|||||||
'';
|
'';
|
||||||
refreshGmcliArchive = withGmcliBackupLock "refresh-gmcli-archive" refreshGmcliArchiveUnlocked;
|
refreshGmcliArchive = withGmcliBackupLock "refresh-gmcli-archive" refreshGmcliArchiveUnlocked;
|
||||||
backfillGmcliArchive = withGmcliBackupLock "backfill-gmcli-archive" backfillGmcliArchiveUnlocked;
|
backfillGmcliArchive = withGmcliBackupLock "backfill-gmcli-archive" backfillGmcliArchiveUnlocked;
|
||||||
|
backupGmcliTelephonyFull = withGmcliBackupLock "backup-gmcli-telephony-full" exportGmcliTelephonyFullArchive;
|
||||||
mkGitSyncTrayOverrides = icon: {
|
mkGitSyncTrayOverrides = icon: {
|
||||||
Service = {
|
Service = {
|
||||||
Environment = lib.mkMerge [
|
Environment = lib.mkMerge [
|
||||||
@@ -182,6 +192,14 @@ in {
|
|||||||
TimeoutStartSec = "3h";
|
TimeoutStartSec = "3h";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
gmcli-telephony-full-backup = {
|
||||||
|
Unit.Description = "Back up complete Android SMS/MMS history and media";
|
||||||
|
Service = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = backupGmcliTelephonyFull;
|
||||||
|
TimeoutStartSec = "3h";
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -204,6 +222,16 @@ in {
|
|||||||
};
|
};
|
||||||
Install.WantedBy = ["timers.target"];
|
Install.WantedBy = ["timers.target"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.user.timers.gmcli-telephony-full-backup = {
|
||||||
|
Unit.Description = "Weekly full Android SMS/MMS and media backup";
|
||||||
|
Timer = {
|
||||||
|
OnCalendar = "Sun *-*-* 08:00:00";
|
||||||
|
Persistent = true;
|
||||||
|
RandomizedDelaySec = "2h";
|
||||||
|
};
|
||||||
|
Install.WantedBy = ["timers.target"];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager.users.kat = {config, ...}: {
|
home-manager.users.kat = {config, ...}: {
|
||||||
|
|||||||
Reference in New Issue
Block a user