feat: initial commit
This commit is contained in:
commit
74295d5935
1 changed files with 65 additions and 0 deletions
65
rm-sync.sh
Executable file
65
rm-sync.sh
Executable file
|
@ -0,0 +1,65 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
user=root
|
||||||
|
host=10.11.99.1
|
||||||
|
|
||||||
|
dir="$(mktemp -d)"
|
||||||
|
|
||||||
|
pdf_fname="$1"
|
||||||
|
pdf_docname="$(basename $1 .pdf)"
|
||||||
|
document_uuid="$(uuidgen)"
|
||||||
|
|
||||||
|
cat $pdf_fname > "${dir}/${document_uuid}.pdf"
|
||||||
|
|
||||||
|
metadata_body="{
|
||||||
|
\"deleted\": false,
|
||||||
|
\"lastModified\": \"`date -u +"%s"`000\",
|
||||||
|
\"metadatamodified\": false,
|
||||||
|
\"modified\": false,
|
||||||
|
\"parent\": \"\",
|
||||||
|
\"pinned\": false,
|
||||||
|
\"synced\": true,
|
||||||
|
\"type\": \"DocumentType\",
|
||||||
|
\"version\": 1,
|
||||||
|
\"visibleName\": \"${pdf_docname}\"
|
||||||
|
}"
|
||||||
|
|
||||||
|
content_body="{
|
||||||
|
\"extraMetadata\": {
|
||||||
|
},
|
||||||
|
\"fileType\": \"pdf\",
|
||||||
|
\"fontName\": \"\",
|
||||||
|
\"lastOpenedPage\": 0,
|
||||||
|
\"lineHeight\": -1,
|
||||||
|
\"margins\": 100,
|
||||||
|
\"orientation\": \"portrait\",
|
||||||
|
\"pageCount\": 1,
|
||||||
|
\"pages\": [
|
||||||
|
],
|
||||||
|
\"textScale\": 1,
|
||||||
|
\"transform\": {
|
||||||
|
\"m11\": 1,
|
||||||
|
\"m12\": 0,
|
||||||
|
\"m13\": 0,
|
||||||
|
\"m21\": 0,
|
||||||
|
\"m22\": 1,
|
||||||
|
\"m23\": 0,
|
||||||
|
\"m31\": 0,
|
||||||
|
\"m32\": 0,
|
||||||
|
\"m33\": 1
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
|
||||||
|
pagedata_body=""
|
||||||
|
|
||||||
|
echo "$metadata_body" > "${dir}/${document_uuid}.metadata"
|
||||||
|
echo "$content_body" > "${dir}/${document_uuid}.content"
|
||||||
|
echo "$pagedata_body" > "${dir}/${document_uuid}.pagedata"
|
||||||
|
|
||||||
|
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
|
Loading…
Reference in a new issue