Skip to content

Instantly share code, notes, and snippets.

@hraftery
Created July 31, 2022 13:09
Show Gist options
  • Save hraftery/3631bbce756aa540ce50f44a7fd5f4c9 to your computer and use it in GitHub Desktop.
Save hraftery/3631bbce756aa540ce50f44a7fd5f4c9 to your computer and use it in GitHub Desktop.
Installing getmail on Synology Diskstation DS920+ with DSM 7

Installing getmail on Synology Diskstation DS920+ with DSM 7

  • Did a survey of alternatives and am not convinced there's better out there. The built-in Synology stuff might be capable, but I don't think it's going to be as set-and-forget. So getmail it is.
  • Right, no getmail in the official Synology repositories, but it is in ipkg apparently. So just install that like last time right? Nope. It's opkg now, and the installer doesn't work on DSM 7!
    • Wow, not getting far.
  • Okay, official instructions work just fine (the DS920+ is x86_64, according to uname -a), but need to wait for a reboot and I still have 5 hours of backup copying to go.
  • So in meantime, notice that the opkg getmail package seems to be v4 anyway, and v5 is available. So why not just install it manually?
wget https://pyropus.ca./software/getmail/old-versions/getmail-5.16.tar.gz # note "old-versions" is where the latest is stored! curl just infinite redirects to the same URL? Maybe cookie issue. wget works.
tar -xzvf getmail-5.16.tar.gz
cd getmail-5.16
sudo python2 setup.py install
  • Everything gets installed in /var/packages/Python2/target/usr/local/, which sounds about right.
    • Would need to be symlinked into /usr/local/bin to get on the path, otherwise absolute path will have to do.
  • Installed getmail rc files in ~/.getmail
    • Decided to change log location from tmp to log as I know that was a hack because log has restricted permissions.
      • Discovered same problem here - there's no reason I can't run getmail as my user, but only root has write access to /var/log. Some good options here.
      • Considered adding myself to the log group (advice here suggests sudo synogroup --get log and then --write with all members).
      • Decided instead to mkdir /var/log/getmail as root and set it group writable by users, and write log files there since it is a user that runs getmail.
      • Just need to be sure the folder gets recreated whenever necessary??
sudo mkdir /var/log/getmail
sudo chgrp users /var/log/getmail
sudo chmod 770 /var/log/getmail
  • Now create Scheduled Task.
    • Every 5 minutes.
    • Execution is /var/packages/Python2/target/usr/local/bin/getmail $rcs (I construct $rcs from all rc files in folder).
  • Well... that's it. I think it's finally time to run it.
  • Eh, turns out permissions were wrong. To fix:
sudo chown Python2:Python2 /var/packages/Python2/target/usr/local/lib/python2.7/site-packages/getmail-5.16-py2.7.egg-info
sudo chmod 644 /var/packages/Python2/target/usr/local/lib/python2.7/site-packages/getmail-5.16-py2.7.egg-info
sudo chown Python2:Python2 /var/packages/Python2/target/usr/local/lib/python2.7/site-packages/getmailcore
sudo chmod 755 /var/packages/Python2/target/usr/local/lib/python2.7/site-packages/getmailcore
sudo chown Python2:Python2 /var/packages/Python2/target/usr/local/lib/python2.7/site-packages/getmailcore/*
sudo chmod 644 /var/packages/Python2/target/usr/local/lib/python2.7/site-packages/getmailcore/*.pyc
sudo chmod 755 /var/packages/Python2/target/usr/local/lib/python2.7/site-packages/getmailcore/*.py
  • Now we're back in the game - success!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment