On Tue, Oct 20, 2015 at 06:49:51AM +0200, Alexandre Hoïde wrote:
>   Fichiers :
>   /usr/local/bin/usertmp
>   ~/.config/systemd/user/usertmp.service
> 
>   Activation :
>   $ systemclt --user enable usertmp.service

  Modifiés selon mes premières auto-critiques.

  Fichiers :
  /usr/local/bin/usrtmp
  ~/.config/systemd/user/usrtmp.service

  Activation :
  $ systemctl --user usrtmp.service

-- 
 ___________________
| $ post_tenebras ↲ |       waouh !
| GNU        \ /    |      /
|          -- * --  |     o
| $ who ↲    / \    |_-- ~_|
| Alexandre Hoïde   |  _/| |
 -------------------
#!/bin/sh

userLink=/home/${USER}/tmpnp

start() {
  tempDir=/tmp/${USER}.$$
  (umask 077 && mkdir ${tempDir}) && \
    ln -f -s ${tempDir} ${userLink} || \
    exit 1
}

stop() {
  tempDir=$(readlink ${userLink})
  rm -rf ${tempDir}
  rm -f ${userLink}
}

case $1 in
  start|stop) "$1" ;;
esac
[Unit]
Description=Create non persitant $USER /tmp dir and symblink in ~/.

[Service]
Type=oneshot
ExecStart=/usr/local/bin/usrtmp start
ExecStop=/usr/local/bin/usrtmp stop
RemainAfterExit=yes

[Install]
WantedBy=default.target

Répondre à