Skip to content

Commit dcbb2bc

Browse files
committed
Add example sync script
1 parent 399a309 commit dcbb2bc

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ The above makes sense if you are using J-Pilot on your desktop, and don't want t
1414

1515
J-Pilot operates on the very same `MemoDB.pdb`, `ToDoDB.pdb`, `DatebookDB.pdb`, `AddressDB.pdb` files you have on your Palm. Which means you can edit the records, then save them back to the device.
1616

17+
See `pimsync.example.sh` for an example sync script.
18+
1719
## Thanks
1820

1921
* Alexander Pruss for [MyInstall](https://www.pruss.mobi/dl/) with its VFS code.

pimsync.example.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/sh
2+
3+
# DISCLAIMER: This script comes without any warranty.
4+
# It works for me but may not work for you. Back your data up first!
5+
6+
CARD_DIR="/run/media/$USER/palmOne 128"
7+
JPILOT_DIR="$HOME/.jpilot"
8+
9+
ps_dir="$CARD_DIR/PIMSync"
10+
11+
for i in AddressDB DatebookDB MemoDB ToDoDB; do
12+
pdb_file="$i".pdb
13+
pc3_file="$i".pc3
14+
15+
# Check if local changes are present in J-Pilot
16+
if [ -f "$JPILOT_DIR"/$pc3_file ] && [ -s "$JPILOT_DIR"/$pc3_file ]; then
17+
18+
# Back up local and card PDBs
19+
mkdir -p "$JPILOT_DIR"/pimsync_backup_local
20+
mkdir -p "$JPILOT_DIR"/pimsync_backup_card
21+
22+
cp "$JPILOT_DIR"/$pdb_file "$JPILOT_DIR"/pimsync_backup_local
23+
cp "$JPILOT_DIR"/$pc3_file "$JPILOT_DIR"/pimsync_backup_local
24+
25+
cp "$ps_dir"/$pdb_file "$JPILOT_DIR"/pimsync_backup_card
26+
27+
# Merge local changes into card versions
28+
echo -e "\nMerging $pdb_file:"
29+
jpilot-merge "$ps_dir"/$pdb_file "$JPILOT_DIR"/$pc3_file \
30+
"$JPILOT_DIR"/$pdb_file
31+
rm "$JPILOT_DIR"/$pc3_file
32+
33+
# Overwrite card versions with merged databases
34+
echo "Overwriting card $pdb_file"
35+
cp "$JPILOT_DIR"/$pdb_file "$ps_dir"/$pdb_file
36+
37+
else
38+
echo "Overwriting local $pdb_file"
39+
cp "$ps_dir"/$pdb_file "$JPILOT_DIR"/$pdb_file
40+
fi
41+
42+
done
43+
44+
echo "Done"
45+

0 commit comments

Comments
 (0)