Re: [systemd-devel] [Install] question

2013-08-01 Thread Tomasz Torcz
On Thu, Aug 01, 2013 at 07:48:19AM +0100, lux-integ wrote:
 Greetings,
 
 I am trying to learn to use systemd.
 
 I  scanned through some of the online manpages and looked at some example 
 unit 
 files.  I keep seeing
 
 [Install]
 WantedBy=multi-user.target
 
 or
 
 [Install]
 WantedBy=sysinit.target 
 
 or some such
 
  Description of targets is in man systemd.special.


 I have for example a need to mount stuff (via a mount unit )  then to create 
 directories and copy stuff to them
 I dont know if these '/bin/mkdir'  and '/bin/cp'  tasks  can be done under 
 '[Install]'
 
  They cannot be in mount.  There are few way to accomplish what you want,
but without details I can provide only vague directions.  You need to create
unit for your work.  You can stuff mkdir into ExecStartPre and cp into 
ExecStart;
you have to make your unit Require the mount unit (or go with the automounter);
activation of your work unit should trigger mount.
  There are few details to work out, like for example usage of PartOf.

 
 Ib brief, I dont know what [Install] is for, 
 --what goes under it?
 --when it is used ?
 --or not used etc ?
 --and I cant locate a manpage to explain it.  
 
 I would be grateful if someone could send me the appropriate URL for 
 'Install' 
 manpage  and or explain what it is and how it is used.

  Start with man systemd.unit and search for [Install]. All four directives
are described there.
  The information is used by systemctl enable command to create appropriate 
symlinks.

  Man pages are also available at 
http://www.freedesktop.org/software/systemd/man/
-- 
Tomasz Torcz   ,,(...) today's high-end is tomorrow's embedded processor.''
xmpp: zdzich...@chrome.pl  -- Mitchell Blank on LKML

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


Re: [systemd-devel] [Install] question

2013-08-01 Thread lux-integ
On Thursday 01 August 2013 08:00:49 Tomasz Torcz wrote:
   They cannot be in mount.  There are few way to accomplish what you want,
 but without details I can provide only vague directions.  You need to
 create unit for your work.  You can stuff mkdir into ExecStartPre and cp
 into ExecStart; you have to make your unit Require the mount unit (or go
 with the automounter); activation of your work unit should trigger mount.
   There are few details to work out, like for example usage of PartOf.


Thanks for your reply

I take the opportunity  to  layout in more detail what my problem is and 
hopefully you and others will provide guidance:-


I want to translate the followingfrom a typical init scipt to systemd.

##
/bin/mount \
-m $someMode \
-t someType \
-o opt1,opt2,opt3 \
someDIR  /somewhereInFS

/bin/mkdir  \
--mode $someMode  $someDIR/otherDIR

/bin/cp -a someStuff  $someDIR/otherDIR

#

My first approach is to   use a so-called service file like so


[Unit]
Description=Mounting and copying stuff

[Service]
ExecStart=/bin/mount \
-m $someMode \
-t someType \
-o opt1,opt2,opt3 \
someDIR  /somewhereInFS

ExecStart=/bin/mkdir  \
--mode $someMode  $someDIR/otherDIR

ExecStart=/bin/cp -a someStuff  $someDIR/otherDIR

##
However I would like to use so called mount units and   with this approach 
this is the furtherst I get:-

[Unit]
Description=Mounting somewhereInFS
#After=dont know what to put here?
#Before=dont know what to put here?



[Mount]
What=someDIR 
Where=/somewhereInFS
Type=someType
Options=opt1,opt2,opt3
DirectoryMode=$someMode

I am then stuck I dont know where to put the last two commands namely:-

#
ExecStart=/bin/mkdir  \
--mode $someMode  $someDIR/otherDIR
and
ExecStart=/bin/cp -a someStuff  $someDIR/otherDIR
#--


do I have to create a service file for these and if so  how do I ensurethe 
mount unit is exicuted before  this service is called?
( Remark::- this is a learnig exercise  And  using  fstab is not in such an 
instance an option )

Thanks in advance

sincerely
luxInteg
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [Install] question

2013-08-01 Thread lux-integ
On Thursday 01 August 2013 08:00:49 Tomasz Torcz wrote:
 You can stuff mkdir into ExecStartPre and cp into ExecStart;
 you have to make your unit Require the mount unit (or go with the
 automounter); activation of your work unit should trigger mount.


many thanks for this
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel