Revert "Delete git-eb, it's obsolete"
[sunny256-utils.git] / pine
blob2cd32ac24f981b039a3f2acac006e0f572707a1d
1 #!/usr/bin/env bash
3 # pine
4 # File ID: 7420db28-5d42-11df-9a7c-90e6ba3022ac
5 # Locking for pine
7 echo "Nei. Bruk mutt."
8 exit
10 lockdir=$HOME/.lock
11 [ "$1" = "-f" ] && { shift; rm -rf $lockdir; }
12 [ -d $lockdir/. ] || mkdir $lockdir || { echo "$lockdir: Klarte ikke mkdir" >&2; exit 1; }
13 lockname=$lockdir/pine
14 until mkdir $lockname 2>/dev/null; do
15 echo "$0: $lockname: Venter på at \"`cat $lockname/info`\" skal slippe locken..." >&2
16 sleep 2
17 done
18 echo "$(tty) $(date +"%Y-%m-%d %H:%M:%S")" >$lockname/info
20 unset LC_CTYPE
22 if [ -x /usr/local/bin/pine ]; then
23 /usr/local/bin/pine $*
24 elif [ -x /usr/bin/pine ]; then
25 /usr/bin/pine $*
28 rm $lockname/info
29 rmdir $lockname