symlink creation during installation
Jamie Strandboge
jamie at canonical.com
Tue Jun 9 15:17:13 UTC 2015
On 06/09/2015 08:57 AM, mauro at freedomotic.com wrote:
> Hi
> I'm trying to do
>
> cp -r ${appdir}/freedomotic/plugins ${datadir}
> rm -r ${appdir}/freedomotic/plugins ${datadir}
>
> cp -r ${appdir}/freedomotic/data ${datadir}
> rm -r ${appdir}/freedomotic/data ${datadir}
>
> ln -s ${datadir}/plugins/
> ln -s ${datadir}/data/
>
> in my app bin script.
> It's needed to work on writable folders.
> But these operations are not allowed after app installation because the
> folder is read-only.
> I must do them as "sudo" manually. Is there any way to execute them during
> app installation?
>
This isn't going to work because you are modifying the readonly portion of the
snappy FHS[1]. The cp is fine, but the rm and the ln are not. You could probably
do any of:
* cp all of ${appdir}/freedomotic/* to ${datadir} and adjust your script to
execute out of ${datadir}
* adjust your binary to understand the split between ${appdir} and ${datadir},
perhaps inherently or perhaps via env vars
The first should unblock you but is not as clean as the second.
You could in theory ship a dangling symlink in $appdir that points to
'../../../../var/lib/apps/<pkgname>/<ver>/...' as part of your snap, but that
has a number of problems:
- there is no 'current' directory in /var/lib/apps/<pkgname>/ so you have to
maintain the symlink yourself
- it won't work with sideloads because the origin will be different with the
store (eg, /var/lib/apps/hello-world.canonical vs
/var/lib/apps/hello-world.sideload) so you would have to maintain that
- it creates a hard dependency on filesystem layout. Snaps should be looking at
runtime environment variables rather then depending on a particular
filesystem layout
- the store review tools specifically test for symlinks pointing outside of
the install dir, so the app would fail automated review
The review tools could be updated to allow symlinks to the data dir, but the
other issues remain which is why this is not supported.
Perhaps other snappy developers want to weigh in on supporting dangling symlinks
shipped in the snap that point to the data dir.
[1]https://developer.ubuntu.com/en/snappy/guides/filesystem-layout/
> Thanks
> Mauro
>
> On Thu, June 4, 2015 10:43 am, mauro at freedomotic.com wrote:
>> Hi all
>> is there any way to create a symlink during app installation? I have some
>> writable folders in our application. I can move or copy them to snappy
>> DATA_PATH but I need to refer them from APP installation folder.
>> Their path can't be modified and /apps/* is read-only.
>> Any idea?
>>
>>
>> Thanks
>> Mauro
>>
>>
>> --
>> snappy-devel mailing list snappy-devel at lists.ubuntu.com Modify settings or
>> unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/snappy-devel
>>
>
>
--
Jamie Strandboge http://www.ubuntu.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/snappy-devel/attachments/20150609/712db148/attachment.pgp>
More information about the snappy-devel
mailing list