On Wed, Jul 31, 2013 at 06:59:18PM +0100, lux-integ wrote:
> On Wednesday 31 July 2013 14:22:35 Michal Vyskocil wrote:
> > You can split the logic into two mount units with opposite Condition
> > 
> > #mountpoint.mount
> > [Unit]
> > Description=mount mountpoint
> > ConditionPathIsMountPoint=/mountpoint
> > 
> > [Mount]
> > What=/dev/something
> > Where=/mountpoint
> > 
> > #somewherelse.mount
> > [Unit]
> > Description=mount somewhereelse
> > ConditionPathIsMountPoint=!/mountpoint
> > 
> > [Mount]
> > What=/dev/something
> > Where=/somewhereelse
> 
> 
> very elegant
> 
> many thanks for this
> 
> 
> now suppose my original file had more than mount in it  say it was
> 
>  #--------------
>  IF mountpoint exists
>  /bin/mount /dev/something  $mountpoint
> /bin/mkdir $mountpoint/somedir
> /bin/cp something   $mountpoint/somedir
>  ELSE
>  /bin/mount /dev/something somewherelse
> /bin/mkdir  somewherelse/someotherdir
> /bin/cp somethingelse   somewherelse/someotherdir/
>  ENDiF
>  #--------------
> 
> How would I do this ? 
> in otherWORDS:-
> a) can I add other non-mount commands to mount units?

No, mount units are just more flexible replacenment of /etc/fstab.
Please consult the man systemd.mount.

> OR
> b) can I call mount units in other   types  of units  in say service units  
> (i.e. with  'ExecStart= ) and if so how so ?

Systemd units are not scripts, so can't be called. You can divide your
functionality into independent units, but that'd be overkill. If you
need more complex functionality, then simply call your script from one
.service file and let script do his work.

Regards
Michal Vyskocil

Attachment: signature.asc
Description: Digital signature

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to