commit c818ffa892348a2e57db70d64e26e7d297f151f2
parent 10620aa0ebc9038d2ff5755a8409def0af56a730
Author: rsiddharth <rsiddharth@ninthfloor.org>
Date: Thu, 16 Jun 2016 16:31:29 +0000
.bin/ping-for-jarl: rewrote it in guile.
Diffstat:
1 file changed, 23 insertions(+), 21 deletions(-)
diff --git a/.bin/ping-for-jarl b/.bin/ping-for-jarl
@@ -1,23 +1,25 @@
-#!/bin/sh
-#
-# Copyright (C) 2016 rsiddharth <s@ricketyspace.net>
-#
-# This program is free software: you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see
-# <http://www.gnu.org/licenses/>.
+#!/home/rsd/.guix-profile/bin/guile \
+-e main -s
+!#
+;; coding: utf-8
+;; license: gnu gpl version 3 or higher.
+;; copyright 2016 rsiddharth <s@ricketyspace.net>
-# if $JARL_BACKUP_PATH is not mounted, ping me.
+;; mplayer
+(define mplayer "mplayer")
-if [ ! -d $JARL_BACKUP_PATH ]; then
- mplayer ~/.guix-profile/share/sounds/alsa/Noise.wav
-fi
+;; path to noise.
+(define noise (string-append (getenv "GUIX_PROFILE")
+ "/share/sounds/alsa/Noise.wav"))
+
+;; produce some noise.
+(define (ping-me)
+ (system* mplayer noise))
+
+;; return #t, iff jarl is mounted.
+(define (jarl-mounted?)
+ (let ((jarl-path (getenv "JARL_BACKUP_PATH")))
+ (file-exists? jarl-path)))
+
+(define (main args)
+ (if (not (jarl-mounted?)) (ping-me)))