├── README.md ├── install.sh ├── sync.sh └── update_config.py /README.md: -------------------------------------------------------------------------------- 1 | # [obsidian](https://obsidian.md) ios sync 2 | 3 | ## Note 4 | - [The iSH will ask for the location permisson to run in background. It does not log or monitor anyone's location](https://github.com/ish-app/ish/wiki/Running-in-background) 5 | - To be more secure please try to use your own Google Drive API keys 6 | - Create a pull request to contribute 7 | 8 | ## TODO 9 | - [ ] Add sync.sh in to [OpenRC](https://wiki.alpinelinux.org/wiki/OpenRC) init system to run on start-up. [Read more](https://github.com/ish-app/ish/wiki/How-To-Enable-OpenRC-&-Start-Services-When-iSH-App-Starts). 10 | - [ ] Fix the iSH app freeze issue after sometime ( it works but still sometimes freezes. I think it depends on the processor of your device. I only have an iPad. Please test and let me know your results) 11 | 12 | ## Setup 13 | 14 | 1. Install [iSH](https://apps.apple.com/us/app/ish-shell/id1436902243) on your ios device 15 | 16 | 2. Run this in iSH 17 | 18 | ```shell 19 | apk update 20 | 21 | apk upgrade 22 | 23 | apk add git 24 | 25 | git clone https://github.com/starfreck/obsidian-ios-sync.git 26 | 27 | mv obsidian-ios-sync/* . 28 | 29 | rm -rf obsidian-ios-sync 30 | 31 | chmod 777 -R . 32 | 33 | ./install.sh 34 | ``` 35 | 3. Once you are done setting up 'rclone', We will update paths in config.py 36 | 37 | 4. python3 update_config.py "pathA" "pathB" 38 | 39 | ```shell 40 | # Create a folder name 'Obsidian' in root of your Cloud Storage 41 | # Replcae 'gdive' in below command with your given name i.e. 'mega' etc. 42 | # Do not change '/root/Obsidian' because we have already mounted the right folder on that path via Script 43 | 44 | python3 update_config.py "gdrive:Obsidian" "/root/Obsidian" 45 | 46 | # if you mess up then just use "syncrclone --new config.py" to create new config.py 47 | ``` 48 | 49 | 5. Run ./sync.sh and it will sync your Obsidian automatically. :) 50 | 51 | ## Referance 52 | - https://rclone.org 53 | - https://rclone.org/drive/ 54 | - https://rclone.org/mega/ 55 | - https://github.com/ish-app/ish/wiki 56 | - https://github.com/Jwink3101/syncrclone 57 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ############################################################ 4 | # ascii # 5 | ############################################################ 6 | ascii_logo() 7 | { 8 | # Display Help 9 | echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%**@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%%%****@@@@@@@@@@@@@@@@@@@@@@@@@@ 13 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%%%%%%%******@@@@@@@@@@@@@@@@@@@@@@@@ 14 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%%%%%%%%%%%(*******@@@@@@@@@@@@@@@@@@@@@@@ 15 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%%%%%%%%%%%%%(////*******@@@@@@@@@@@@@@@@@@@@@ 16 | @@@@@@@@@@@@@@@@@@@@@@@@@@&%%%%%%%%%%%%%%%%%////////////*****@@@@@@@@@@@@@@@@@@@ 17 | @@@@@@@@@@@@@@@@@@@@@@@@&&&%%%%%%%%%%%%%%///////////////////***@@@@@@@@@@@@@@@@@ 18 | @@@@@@@@@@@@@@@@@@@@@@@&&&&&%%%%%%%%%%//////////////////////////@@@@@@@@@@@@@@@@ 19 | @@@@@@@@@@@@@@@@@@@@@@&&&&&&%%%%%%%/////////////////////////////@@@@@@@@@@@@@@@@ 20 | @@@@@@@@@@@@@@@@@@@@@&&&&&&&&%%#///////////////////////////////@@@@@@@@@@@@@@@@@ 21 | @@@@@@@@@@@@@@@@@@@@&&&&&&&&&#///////////////////////////////((@@@@@@@@@@@@@@@@@ 22 | @@@@@@@@@@@@@@@@@@@&&&&&&&&&&%%/////////////////////////((((((&@@@@@@@@@@@@@@@@@ 23 | @@@@@@@@@@@@@@@@@@&&&&&&&&&&&%%%/////////////////(((((((((((((@@@@@@@@@@@@@@@@@@ 24 | @@@@@@@@@@@@@@@@@&&&&&&&&&&&&&%%%//////////(((((((((((((((((((@@@@@@@@@@@@@@@@@@ 25 | @@@@@@@@@@@@@@@@@@&&&&&&&&&&&&%%%%(///(((((((((((((((((((((((@@@@@@@@@@@@@@@@@@@ 26 | @@@@@@@@@@@@@@@@@@@&&&&&&&&&&&%%%%%%(((((((((((((((((((((((((@@@@@@@@@@@@@@@@@@@ 27 | @@@@@@@@@@@@@@@@@@@@&&&&&&&&&&%%%%%%%(((((((((((((((((((((((@@@@@@@@@@@@@@@@@@@@ 28 | @@@@@@@@@@@@@@@@@@@@@@&&&&&&&&%%%%%%%%((((((((((((((((((((((@@@@@@@@@@@@@@@@@@@@ 29 | @@@@@@@@@@@@@@@@@@@@@@@&&&&&&&%%%%%%%%%(((((((((((((((((((((@@@@@@@@@@@@@@@@@@@@ 30 | @@@@@@@@@@@@@@@@@@@@@@@@&&&&&&%%%%%%%%%%(((((((((((((((((((@@@@@@@@@@@@@@@@@@@@@ 31 | @@@@@@@@@@@@@@@@@@@@@@@@@&&&&&&%%%%%%%%%%%(((((((((((((((((@@@@@@@@@@@@@@@@@@@@@ 32 | @@@@@@@@@@@@@@@@@@@@@@@@@@&&&&&%%%%%%%%%%%%(((((((((((((((@@@@@@@@@@@@@@@@@@@@@@ 33 | @@@@@@@@@@@@@@@@@@@@@@@@@@@&&&&%%%%%%%%%%%%%((((((((((((((@@@@@@@@@@@@@@@@@@@@@@ 34 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@&&&%%%%%%%%%%%%%%((((((((((((&@@@@@@@@@@@@@@@@@@@@@@ 35 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&%%%%%%%%%%%%%%%#((((((((((@@@@@@@@@@@@@@@@@@@@@@@ 36 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&%%%%%%%%%%%%%%%%%(((((((((@@@@@@@@@@@@@@@@@@@@@@@ 37 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%%%%%%%%%%%%(((((((@@@@@@@@@@@@@@@@@@@@@@@@ 38 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%%%%%%(((((@@@@@@@@@@@@@@@@@@@@@@@@@ 39 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%(((@@@@@@@@@@@@@@@@@@@@@@@@@@ 40 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" 41 | 42 | } 43 | ############################################################ 44 | # Development Aid # 45 | ############################################################ 46 | development_setup() 47 | { 48 | # Install Development Tools 49 | echo "Set a root password for your system:" 50 | passwd 51 | echo "Root password chanaged...!" 52 | 53 | echo "Installing OpenSSH..." 54 | apk add openssh 55 | echo "Generating Key..." 56 | ssh-keygen -A 57 | echo "Activating remote login..." 58 | echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config 59 | apk add openrc --no-cache 60 | rc-update add sshd 61 | echo "Starting OpenSSH Server..." 62 | /etc/init.d/sshd start 63 | } 64 | ############################################################ 65 | # Setup # 66 | ############################################################ 67 | setup() 68 | { 69 | # Update 70 | apk update 71 | 72 | # Install Required Packages 73 | apk add python3 py3-pip nano fuse git 74 | 75 | # Do not install rclone from apk packge manager, it has old version 76 | # Installing from the offcial repo 77 | wget https://downloads.rclone.org/rclone-current-linux-386.zip 78 | unzip rclone-current-linux-386.zip 79 | cp rclone-v*-linux-386/rclone /bin/rclone 80 | rm -rf rclone-v*-linux-386 81 | # Create a Directory 82 | mkdir Obsidian 83 | 84 | echo "Please Select the Obsidian Folder" 85 | 86 | # Mount a directory TODO: Add Fix 87 | mount -t ios null Obsidian 88 | 89 | # Install syncrclone 90 | python3 -m pip install git+https://github.com/Jwink3101/syncrclone 91 | 92 | # Create syncrclone 93 | syncrclone --new config.py 94 | } 95 | ############################################################ 96 | ############################################################ 97 | # Main program # 98 | ############################################################ 99 | ############################################################ 100 | 101 | # Running in background 102 | cat /dev/location > /dev/null & 103 | 104 | ascii_logo 105 | development_setup # Comments this line if you want to skip development enviroment set-up 106 | setup 107 | rclone config # This will run rclone config (https://rclone.org/commands/rclone_config/) 108 | rclone mkdir gdrive:Obsidian # You can Change gdrive with your own set-up i.e. mega 109 | python3 update_config.py gdrive:Obsidian /root/Obsidian 110 | -------------------------------------------------------------------------------- /sync.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ############################################################ 4 | # ascii # 5 | ############################################################ 6 | ascii_logo() 7 | { 8 | echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%**@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%%%****@@@@@@@@@@@@@@@@@@@@@@@@@@ 12 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%%%%%%%******@@@@@@@@@@@@@@@@@@@@@@@@ 13 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%%%%%%%%%%%(*******@@@@@@@@@@@@@@@@@@@@@@@ 14 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%%%%%%%%%%%%%(////*******@@@@@@@@@@@@@@@@@@@@@ 15 | @@@@@@@@@@@@@@@@@@@@@@@@@@&%%%%%%%%%%%%%%%%%////////////*****@@@@@@@@@@@@@@@@@@@ 16 | @@@@@@@@@@@@@@@@@@@@@@@@&&&%%%%%%%%%%%%%%///////////////////***@@@@@@@@@@@@@@@@@ 17 | @@@@@@@@@@@@@@@@@@@@@@@&&&&&%%%%%%%%%%//////////////////////////@@@@@@@@@@@@@@@@ 18 | @@@@@@@@@@@@@@@@@@@@@@&&&&&&%%%%%%%/////////////////////////////@@@@@@@@@@@@@@@@ 19 | @@@@@@@@@@@@@@@@@@@@@&&&&&&&&%%#///////////////////////////////@@@@@@@@@@@@@@@@@ 20 | @@@@@@@@@@@@@@@@@@@@&&&&&&&&&#///////////////////////////////((@@@@@@@@@@@@@@@@@ 21 | @@@@@@@@@@@@@@@@@@@&&&&&&&&&&%%/////////////////////////((((((&@@@@@@@@@@@@@@@@@ 22 | @@@@@@@@@@@@@@@@@@&&&&&&&&&&&%%%/////////////////(((((((((((((@@@@@@@@@@@@@@@@@@ 23 | @@@@@@@@@@@@@@@@@&&&&&&&&&&&&&%%%//////////(((((((((((((((((((@@@@@@@@@@@@@@@@@@ 24 | @@@@@@@@@@@@@@@@@@&&&&&&&&&&&&%%%%(///(((((((((((((((((((((((@@@@@@@@@@@@@@@@@@@ 25 | @@@@@@@@@@@@@@@@@@@&&&&&&&&&&&%%%%%%(((((((((((((((((((((((((@@@@@@@@@@@@@@@@@@@ 26 | @@@@@@@@@@@@@@@@@@@@&&&&&&&&&&%%%%%%%(((((((((((((((((((((((@@@@@@@@@@@@@@@@@@@@ 27 | @@@@@@@@@@@@@@@@@@@@@@&&&&&&&&%%%%%%%%((((((((((((((((((((((@@@@@@@@@@@@@@@@@@@@ 28 | @@@@@@@@@@@@@@@@@@@@@@@&&&&&&&%%%%%%%%%(((((((((((((((((((((@@@@@@@@@@@@@@@@@@@@ 29 | @@@@@@@@@@@@@@@@@@@@@@@@&&&&&&%%%%%%%%%%(((((((((((((((((((@@@@@@@@@@@@@@@@@@@@@ 30 | @@@@@@@@@@@@@@@@@@@@@@@@@&&&&&&%%%%%%%%%%%(((((((((((((((((@@@@@@@@@@@@@@@@@@@@@ 31 | @@@@@@@@@@@@@@@@@@@@@@@@@@&&&&&%%%%%%%%%%%%(((((((((((((((@@@@@@@@@@@@@@@@@@@@@@ 32 | @@@@@@@@@@@@@@@@@@@@@@@@@@@&&&&%%%%%%%%%%%%%((((((((((((((@@@@@@@@@@@@@@@@@@@@@@ 33 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@&&&%%%%%%%%%%%%%%((((((((((((&@@@@@@@@@@@@@@@@@@@@@@ 34 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&%%%%%%%%%%%%%%%#((((((((((@@@@@@@@@@@@@@@@@@@@@@@ 35 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&%%%%%%%%%%%%%%%%%(((((((((@@@@@@@@@@@@@@@@@@@@@@@ 36 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%%%%%%%%%%%%(((((((@@@@@@@@@@@@@@@@@@@@@@@@ 37 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%%%%%%(((((@@@@@@@@@@@@@@@@@@@@@@@@@ 38 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%(((@@@@@@@@@@@@@@@@@@@@@@@@@@ 39 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" 40 | 41 | } 42 | 43 | ascii_logo 44 | 45 | syncrclone config.py 46 | -------------------------------------------------------------------------------- /update_config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | import sys 4 | 5 | print(sys.argv) 6 | 7 | argv = sys.argv[1:] 8 | 9 | remoteA = argv[0] 10 | remoteB = argv[1] 11 | 12 | with open("config.py", "rt") as file: 13 | x = file.read() 14 | 15 | with open("config.py", "wt") as file: 16 | x = x.replace('remoteA = \"<>\"',f'remoteA = "{remoteA}/"') 17 | x = x.replace('remoteB = \"<>\"',f'remoteB = "{remoteB}"') 18 | file.write(x) 19 | --------------------------------------------------------------------------------