feat: add default.nix
This commit is contained in:
parent
74295d5935
commit
0d69a0616f
2 changed files with 14 additions and 5 deletions
9
default.nix
Normal file
9
default.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ writeShellApplication, coreutils, openssh}:
|
||||
|
||||
writeShellApplication {
|
||||
name = "rm-sync";
|
||||
|
||||
runtimeInputs = [ coreutils openssh ];
|
||||
|
||||
text = builtins.readFile ./rm-sync.sh;
|
||||
}
|
10
rm-sync.sh
10
rm-sync.sh
|
@ -7,14 +7,14 @@ host=10.11.99.1
|
|||
dir="$(mktemp -d)"
|
||||
|
||||
pdf_fname="$1"
|
||||
pdf_docname="$(basename $1 .pdf)"
|
||||
pdf_docname="$(basename "$1" .pdf)"
|
||||
document_uuid="$(uuidgen)"
|
||||
|
||||
cat $pdf_fname > "${dir}/${document_uuid}.pdf"
|
||||
cat "$pdf_fname" > "${dir}/${document_uuid}.pdf"
|
||||
|
||||
metadata_body="{
|
||||
\"deleted\": false,
|
||||
\"lastModified\": \"`date -u +"%s"`000\",
|
||||
\"lastModified\": \"$(date -u +"%s")000\",
|
||||
\"metadatamodified\": false,
|
||||
\"modified\": false,
|
||||
\"parent\": \"\",
|
||||
|
@ -61,5 +61,5 @@ for subdir in "" ".cache" ".highlight" ".textconversion" ".thumbnails"; do
|
|||
mkdir "$dir/$document_uuid$subdir"
|
||||
done
|
||||
|
||||
scp -rp $dir/$document_uuid.* $user@$host:/home/root/.local/share/remarkable/xochitl/
|
||||
ssh $user@$host systemctl restart xochitl
|
||||
scp -rp "$dir/$document_uuid".* $user@$host:/home/root/.local/share/remarkable/xochitl/
|
||||
ssh "$user@$host" systemctl restart xochitl
|
||||
|
|
Loading…
Reference in a new issue