linux:sharepoint
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
linux:sharepoint [2021/11/22 02:28] – created Wulf Rajek | linux:sharepoint [2023/05/29 11:55] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 40: | Line 40: | ||
</ | </ | ||
+ | ====== Use in fstab ====== | ||
- | #to use in fstab, create wrapper using: | + | to use in fstab, create wrapper using: |
< | < | ||
sudo ln -s / | sudo ln -s / | ||
Line 47: | Line 48: | ||
then it can be used in fstab like: | then it can be used in fstab like: | ||
< | < | ||
- | whatevername: | + | whatevername: |
</ | </ | ||
+ | |||
+ | or better use rclonefspy script | ||
+ | https:// | ||
+ | <code - / | ||
+ | # | ||
+ | from os import environ | ||
+ | from time import sleep | ||
+ | import sys | ||
+ | from subprocess import check_call, check_output, | ||
+ | |||
+ | def write_to_journal(string): | ||
+ | check_output([' | ||
+ | |||
+ | write_to_journal(' | ||
+ | |||
+ | # Save passed arguments | ||
+ | remote_mount = sys.argv[1] | ||
+ | local_mount = sys.argv[2] | ||
+ | sys_args = sys.argv[4].split(',' | ||
+ | |||
+ | # Must add path to environment in order for rclone mount to work | ||
+ | env = environ.copy() | ||
+ | output_raw = check_output([' | ||
+ | ##path = output_raw.decode(' | ||
+ | path = "/ | ||
+ | env[' | ||
+ | |||
+ | # If path extraction does not work enter desired path here | ||
+ | # env[' | ||
+ | |||
+ | options = [] | ||
+ | discarded_options = [] | ||
+ | |||
+ | # Load options for rclone mount to consume | ||
+ | for arg in sys_args: | ||
+ | if not arg.startswith(' | ||
+ | discarded_options.append(arg) | ||
+ | continue | ||
+ | options.append(f' | ||
+ | |||
+ | write_to_journal(f' | ||
+ | write_to_journal(f' | ||
+ | |||
+ | # Mount folder, if this doesn' | ||
+ | output = Popen( | ||
+ | [' | ||
+ | stdout=PIPE, | ||
+ | ) | ||
+ | try: | ||
+ | output.wait(1) | ||
+ | except TimeoutExpired as e: | ||
+ | # Must wait for mount to be seen, in order for systemd not to complain | ||
+ | write_to_journal(' | ||
+ | for tries in range(1, 20): | ||
+ | try: | ||
+ | check_call([' | ||
+ | write_to_journal(f' | ||
+ | break | ||
+ | except CalledProcessError: | ||
+ | write_to_journal(' | ||
+ | sleep(0.1) | ||
+ | else: | ||
+ | write_to_journal(' | ||
+ | sys.exit(1) | ||
+ | |||
+ | sys.exit(0) | ||
+ | else: | ||
+ | write_to_journal(f' | ||
+ | sys.exit(1) | ||
+ | </ | ||
+ | < | ||
+ | sudo chmod 755 / | ||
+ | </ | ||
+ | Then use | ||
+ | < | ||
+ | gdrive: /mnt/gdrive fuse.rclonefspy user, | ||
+ | </ | ||
+ | For troubleshooting use: | ||
+ | < | ||
+ | journalctl -b | grep rclone | ||
+ | </ | ||
+ | |||
+ | ====== systemd service ====== | ||
+ | |||
+ | https:// | ||
+ | |||
+ | Fuse config required for user systemd service: | ||
+ | <code - / | ||
+ | # Allow non-root users to specify the allow_other or allow_root mount options. | ||
+ | user_allow_other | ||
+ | </ | ||
+ | |||
+ | <code - rclone@.service> | ||
+ | # User service for Rclone mounting | ||
+ | # | ||
+ | # Place in ~/ | ||
+ | # File must include the ' | ||
+ | # As your normal user, run | ||
+ | # | ||
+ | # You can now start/ | ||
+ | # | ||
+ | # | ||
+ | |||
+ | [Unit] | ||
+ | Description=rclone: | ||
+ | Documentation=man: | ||
+ | After=network-online.target | ||
+ | Wants=network-online.target | ||
+ | AssertPathIsDirectory=%h/ | ||
+ | |||
+ | [Service] | ||
+ | Type=notify | ||
+ | ExecStart= \ | ||
+ | / | ||
+ | --config=%h/ | ||
+ | --fast-list \ | ||
+ | --vfs-cache-mode writes \ | ||
+ | --vfs-cache-max-size 100M \ | ||
+ | --log-level INFO \ | ||
+ | --log-file / | ||
+ | --umask 022 \ | ||
+ | --allow-other \ | ||
+ | %i: %h/mnt/%i | ||
+ | ExecStop=/ | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=default.target | ||
+ | </ | ||
+ | |||
+ | To hide Sharepoint' | ||
+ | < | ||
+ | --exclude "/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====== WebDAV2 process ====== | ||
+ | |||
+ | # | ||
+ | |||
+ | < | ||
+ | sudo apt-get install -y davfs2 | ||
+ | # | ||
+ | sudo chmod 777 / | ||
+ | echo " | ||
+ | |||
+ | wget https:// | ||
+ | |||
+ | python get-sharepoint-auth-cookie.py https:// | ||
+ | |||
+ | sed -i "s/ //g" cookie.txt | ||
+ | COOKIE=$(cat cookie.txt) | ||
+ | sudo chmod 777 / | ||
+ | for MPATH in {Funds/ | ||
+ | do | ||
+ | echo " | ||
+ | echo " | ||
+ | echo "" | ||
+ | done | ||
+ | |||
+ | for MPATH in {Funds/ | ||
+ | do | ||
+ | echo " | ||
+ | done | ||
+ | |||
+ | sudo chmod 755 / | ||
+ | |||
+ | sudo usermod -a -G davfs2 $USER | ||
+ | |||
+ | #apply the new group in the shell | ||
+ | su - $USER | ||
+ | |||
+ | for PATH in {funds, | ||
+ | do | ||
+ | mkdir -p ~/ | ||
+ | mount ~/ | ||
+ | done; | ||
+ | </ | ||
+ | |||
+ | The cookie will become invalid after about 3 weeks of inactivity. | ||
+ | |||
+ | fstab entry example | ||
+ | < | ||
+ | https:// | ||
+ | </ | ||
+ | |||
+ | https:// |
linux/sharepoint.1637548134.txt.gz · Last modified: (external edit)