Yes it is good when you want to do something and find that someone has already done any preparations for that. So here is the script and all needed tools to convert an .ape audio CD image with .cue tracklist to .flac tracks. Download this archive to your NAS, unpack it to your /usr/local, like,
cd /usr/local && tar -zxf /path/to/ape2flac.tar.gz
then go to a directory that has both .ape and .cue files and type
ape2flac
See the progress and enjoy! And note that the last line of the script removes your .ape and .cue files.

With any questions you can contact me via e-mail denis1482@yandex.ru