This is very messy as I'm still learning my way around a synology and building a package from scratch isn't something I've figured out yet.
I did create a completely separate volume for mylar to use. I'll make an assumption and guess this is something that the package centre would hate when following it's correct working but I noticed that the relative file path for package centre installations caused the occasional problem for mylar as it was running below /volume1/@appstore. The @ symbol in the path can cause problems for mylar as it it doesn't expect to have to escape part of the file path it runs from. Also it means I still have an intact version of the original package to fall back to if needed.
Anyway, I'm running DSM 6.2.3-25426 Update 2 on a DS216+II. I originally installed mylar, python2 and git from synocommunity. To get this started I also installed python3 from synocommunity as it's a later version than synology's. It's still behind the recommended version but as yet it's given me no problems.
So onto my hackery (most of this requires SSH access):
1) Create a volume for mylar, I called my volume mylar so I'll be referring to as that. Also my synology creates shared volumes under /volume1 so I'm making the assumption this is standard to DSM 6.
2) SSH into the server and elevate yourself to root permission, I hate using sudo
.
3) Go to your mylar volume and use git to clone mylar3:
git clone
https://github.com/mylar3/mylar3
4) If you prefer to run off the dev branch then use git to checkout python3-dev:
git checkout python3-dev
5) Navigate to your mylar volume and create a python3 environment for mylar to use:
cd /volume1/mylar
/usr/local/python3/bin/python3 -m venv env
I can't remember if python 3 came bundled with virutalenv so if the above doesn't work try installing virtual env first:
/usr/local/python3/bin/python3 -m pip install --user virtualenv
6) Enter your python environment and install mylar's requirements, (assuming you're still at the root of your mylar volume):
source env/bin/activate
cd mylar3
pip3 install -r requirements.txt
Once you have the requirements installed you can drop from your python virtual environment:
deactivate
7) Decide where you want your cache, config, logs and data to reside. I placed them all on the mylar volume and copied what I needed from the original. If you like you can leave the as they are but as I stated earlier I wanted to create a backup of my original installation where I could.
8) Assuming that you're following my method, create the folders on your mylar volume:
cd /volume1/mylar
mkdir run conf cache logs data
9) Copy your data and config.ini from the existing package over to your volume.
cp -rvp /volume1/\@appstore/mylar/var/data/* /volume1/mylar/data/.
cp -rvp /volume1/\@appstore/mylar/var/config.ini /volume1/mylar/conf/.
Note the use of backslash to escape the @ symbol for referencing the packages original location.
10) Edit these entries in your config file to match something like:
cache_dir = /volume1/mylar/cache
git_user = mylar3
git_branch = python3-dev (only do this if you want to follow the dev branch)
log_dir = /volume1/mylar/logs
ddl_location = /volume1/mylar/downloads
11) Ensure that everything in your new mylar volume has the necessary user permissions (the synocommunity mylar installation created the user sc-mylar and group mylar on my synology so I stuck with them):
cd /volume1/mylar
chown -R sc-mylar:mylar run conf cache logs data
At this point we could potentially start up mylar manually from the command line but I hacked away at the package a little so the synology could have some control over it.
12) Shut down the existing mylar instance using the package centre GUI or the following from the command line:
synoservice --disable pkgctl-mylar
13) Most of the mylar service detail resides in the folder /var/packages/mylar/ on my synology so we'll be doing a lot of work in that folder from here on in. So navigate to that folder:
cd /var/packages/mylar/
14) First remove the dependencies for the original mylar package by editing the INFO file, I use vi, (this stops mylar insisting it needs python 2 when you start it up):
vi INFO
and then remove the line thats starts with install_dep_package or change this to include the version of python3 you've installed.
15) Change the symlink to the mylar installation itself:
unlink target
ln -s /volume1/mylar/mylar3 target
16) We now start hacking away at the service scripts so at this point you'll need to have your file and new folder locations handy.
17) In the folder scripts, /var/packages/mylar/scripts, there are two main files that package centre relies on. One is start-stop-status, you can guess what this does from it's title but if this script breaks then the package centre will not play ball with mylar. The second script is service-setup, this pulls together various configuration settings and locations for the start-stop-status script to use. Here is what I changed in these two for my installation:
In service-setup, (using the editor of your choice):
replace this line:
if [ -n "${SYNOPKG_DSM_VERSION_MAJOR}" -a "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 6 ]; then EFF_USER="${SYNOUSER_PREFIX}${USER}"; else EFF_USER="${PRIV_PREFIX}${USER}"; fi
with:
EFF_USER="${PRIV_PREFIX}${USER}"
Now find and amend the variables below, (again these are based on the preference for how i want to run my version of mylar, your setup may vary but this is where you need your new locations):
LOG_FILE="/volume1/mylar/logs/mylar.log"
PID_FILE="/volume1/mylar/run/mylar.pid"
PYTHON_DIR="/usr/local/python3"
GIT_DIR="/usr/local/git"
PATH="/volume1/mylar/bin:/volume1/mylar/env/bin:${PYTHON_DIR}/bin:${GIT_DIR}/bin:${PATH}"
PYTHON="/volume1/mylar/env/bin/python3"
VIRTUALENV="${PYTHON_DIR}/bin/virtualenv"
MYLAR="/volume1/mylar/mylar3/Mylar.py"
CFG_FILE="/volume1/mylar/conf/config.ini"
DATA_DIR="/volume1/mylar/data
18) Edit the start-stop-status script:
Change the line:
DNAME="${SYNOPKG_PKGNAME}"
to
DNAME="mylar"
19) That's all folks! Now feel free to start up your mylar installation and fingers crossed it works. Either use package centre or the CLI command:
synoservice --enable pkgctl-mylar
So as I've been writing this I feel there are things I might have forgotten or neglected to mention, I did a lot of messing about to get this working and broke the package centre a few times on my synology. It have got to all working fine now and I reckon the above steps should be all you need. I'll be happy to help if you want to give this a go yourselves.
I'm dyslexic so proof reading is not my bag, if incorrect spellings or grammar haven't been caught as I type by my PC then I'll have missed them, If something looks like garbage then just pull me up on it.