unison tuning
This commit is contained in:
parent
d312aeeaa4
commit
2cf9ce38d1
@ -3,29 +3,7 @@
|
|||||||
config,
|
config,
|
||||||
pkgs,
|
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; {
|
options.mj.services.wifibackup = with lib.types; {
|
||||||
enable = lib.mkEnableOption "enable wifi code backups to M-Active";
|
enable = lib.mkEnableOption "enable wifi code backups to M-Active";
|
||||||
fromPath = lib.mkOption {
|
fromPath = lib.mkOption {
|
||||||
@ -55,12 +33,14 @@ in {
|
|||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
User = "root";
|
User = "root";
|
||||||
SuccessExitStatus = [0 1];
|
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 \
|
-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 \
|
-batch \
|
||||||
-merge "Name *.nmconnection -> ${mergeNmConnections}/bin/merge-nmconnections CURRENT1 CURRENT2 NEW NEW1 NEW2" \
|
|
||||||
-backuploc local \
|
-backuploc local \
|
||||||
-backup "Name *" \
|
-backup "Name *" \
|
||||||
${fromPath} \
|
${fromPath} \
|
||||||
@ -68,5 +48,4 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user