unison tuning
This commit is contained in:
parent
d312aeeaa4
commit
2cf9ce38d1
@ -3,29 +3,7 @@
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
mergeNmConnections = pkgs.writeShellApplication {
|
||||
name = "merge-nmconnections";
|
||||
text = ''
|
||||
CURRENT1="$1"
|
||||
CURRENT2="$2"
|
||||
NEW="$3"
|
||||
NEW1="$4"
|
||||
NEW2="$5"
|
||||
|
||||
sed -i -E '/^(uuid|interface-name)=/d' "$CURRENT1"
|
||||
sed -i -E '/^(uuid|interface-name)=/d' "$CURRENT2"
|
||||
|
||||
if cmp "$1" "$2"; then
|
||||
mv "$CURRENT1" "$NEW"
|
||||
else
|
||||
mv "$CURRENT1" "$NEW1"
|
||||
mv "$CURRENT2" "$NEW2"
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
};
|
||||
in {
|
||||
}: {
|
||||
options.mj.services.wifibackup = with lib.types; {
|
||||
enable = lib.mkEnableOption "enable wifi code backups to M-Active";
|
||||
fromPath = lib.mkOption {
|
||||
@ -55,12 +33,14 @@ in {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
SuccessExitStatus = [0 1];
|
||||
ExecStart = ''
|
||||
${pkgs.unison}/bin/unison \
|
||||
};
|
||||
script = ''
|
||||
sed -i -E '/^(uuid|interface-name)=/d' ${fromPath}/*.nmconnection
|
||||
|
||||
exec ${pkgs.unison}/bin/unison \
|
||||
-sshcmd ${pkgs.openssh}/bin/ssh \
|
||||
-sshargs "-i /etc/ssh/ssh_host_ed25519_key" \
|
||||
-sshargs "-i /etc/ssh/ssh_host_ed25519_key -o KnownHostsCommand=\"${pkgs.coreutils}/bin/cat /etc/ssh/ssh_host_ed25519_key.pub\"" \
|
||||
-batch \
|
||||
-merge "Name *.nmconnection -> ${mergeNmConnections}/bin/merge-nmconnections CURRENT1 CURRENT2 NEW NEW1 NEW2" \
|
||||
-backuploc local \
|
||||
-backup "Name *" \
|
||||
${fromPath} \
|
||||
@ -68,5 +48,4 @@ in {
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user