EBC Exercise 04 Mounting OneDrive

From eLinux.org
Revision as of 09:45, 10 October 2019 by Yoder (talk | contribs) (Configuring rclone)
Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder


Here are instructions on how to mount your Rose OneDrive files on your Beagle via rclone.

rclone is a command line program to sync files and directories to and from many different services, one of which is OneDrive.

Installing rclone

Install rclone on both your host and your Bone (https://rclone.org/downloads/):

bone$ curl https://rclone.org/install.sh | sudo bash
bone$ apt update
bone$ apt install fuse
host$ curl https://rclone.org/install.sh | sudo bash
bone$ apt update
host$ apt install fuse

Configuring rclone

Next configure on the machine you want to run it on. I'll show doing it on the Bone since it's a bit more involved.

bone$ rclone config
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n

We're starting a new remote, so enter n

name> onedrive

Call it whatever you want, I'm using onedrive.

Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / 1Fichier
   \ "fichier"
...
12 / Google Drive
   \ "drive"
13 / Google Photos
   \ "google photos"
...
20 / Microsoft OneDrive
  \ "onedrive"
...
Storage> 20

There are many choices, we want onedrive. Here's it's numbered 20, it may be different on yours.

Microsoft App Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id> 

Leave this blank

Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret> 

This blank too

Edit advanced config? (y/n)
y) Yes
n) No
y/n> y

We want y here

Chunk size to upload files with - must be multiple of 320k.

Above this size files will be chunked - must be multiple of 320k. Note
that the chunks will be buffered into memory.
Enter a size with suffix k,M,G,T. Press Enter for the default ("10M").
chunk_size>

Leave blank

The ID of the drive to use
Enter a string value. Press Enter for the default ("").
drive_id> 

Leave blank

The type of the drive ( personal | business | documentLibrary )
Enter a string value. Press Enter for the default ("").
drive_type> business

Enter business to get to your Rose OneDrive

Set to make OneNote files show up in directory listings.

By default rclone will hide OneNote files in directory listings because
operations like "Open" and "Update" won't work on them.  But this
behaviour may also prevent you from deleting them.  If you want to
delete OneNote files or otherwise want them to show up in directory
listing, set this option.
Enter a boolean value (true or false). Press Enter for the default ("false").
expose_onenote_files> 

Hit Enter for the default

Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> n

Here is where the host vs bone install differs. If you are on your host enter y. The Bone is headless, so enter n. Let's follow the Bone path since it's requires a bit more work.

For this to work, you will need rclone available on a machine that has a web browser available.
Execute the following on your machine (same rclone version recommended) :
	rclone authorize "onedrive"
Then paste the result below:
result> 

So, when installing on the Bone you need to run rclone authorize "onedrive" on your host. So without quitting the rclone install, run the command on your host. You will see

host$ rclone authorize "onedrive"
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=de0c54f8aa6e4694505435d0025af353
Log in and authorize rclone for access
Waiting for code...
Got code
Paste the following into your remote machine --->
{"access_token":"eyJ0eXAiOiJKV1QiLCJub25jZSI6IktlaC1iX3lxWlZNUFh0aXpYczl0bHJMQ3dwMno3TFdWVXA0NHA4MGkxOHciLCJhbGciOiJSUzI1NiIsIng1dCI6ImFQY3R3X29kdlJPb0VOZzNWb09sSWgydGlFcyIsImtpZCI6ImFQY3R3X29kdlJPb0VOZzNWb09sSWg ...
CiXlbeWkTuJIyHzz9ViTscTUTKL9mhTjagMRrFzH1y-AKc0KwKUOImMF1zObuJGUEVcjmrB7BYDwy6u0z2lz8PU092HTbh-S5GrmmVXiRDPWr2aSUUf31QLfjIAA","expiry":"2019-10-10T12:15:33.556943127-04:00"}
<---End paste

Follow the directions and copy the access_token from your host window and paste it into the rclone config window. You will see

Choose a number from below, or type in an existing value
 1 / OneDrive Personal or Business
   \ "onedrive"
 2 / Root Sharepoint site
   \ "sharepoint"
 3 / Type in driveID
   \ "driveid"
 4 / Type in SiteID
   \ "siteid"
 5 / Search a Sharepoint site
   \ "search"
Your choice> 1

Enter 1 for OneDrive. After a bit you will see

Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=b!T2RYBL90GUuk6Tj5AyfQmSswgAAexZNCm9PUX6-Q-MBzqSd8jB3aSZVF5mbW4mJw
Chose drive to use:> 0

There is only one choice, so take it. After a bit more





thumb‎ Embedded Linux Class by Mark A. Yoder