summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2021-05-14 16:29:25 +0530
committerArun Isaac2021-05-14 16:36:55 +0530
commitbaac266cdf1cd035c7cc50000209e70160efb715 (patch)
tree0004d7086e1ea5a48c3888514acad429d478c7be
parent1d936f2b39d4dc2b682b0efa80d277940194560b (diff)
downloadccwl-baac266cdf1cd035c7cc50000209e70160efb715.tar.gz
ccwl-baac266cdf1cd035c7cc50000209e70160efb715.tar.lz
ccwl-baac266cdf1cd035c7cc50000209e70160efb715.zip
Rewrite pre-inst-env in scheme.
Scheme code is more readable than arcane bash. * pre-inst-env.in: Rewrite in scheme.
-rw-r--r--pre-inst-env.in53
1 files changed, 29 insertions, 24 deletions
diff --git a/pre-inst-env.in b/pre-inst-env.in
index 4e73d75..7b58d09 100644
--- a/pre-inst-env.in
+++ b/pre-inst-env.in
@@ -1,28 +1,33 @@
-#! /bin/sh
+#! @GUILE@ -s
+-*- scheme -*-
+!#
+;;; ccwl --- Concise Common Workflow Language
+;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
+;;;
+;;; This file is part of ccwl.
+;;;
+;;; ccwl 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.
+;;;
+;;; ccwl 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 ccwl. If not, see <https://www.gnu.org/licenses/>.
-# ccwl --- Concise Common Workflow Language
-# Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
-#
-# This file is part of ccwl.
-#
-# ccwl 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.
-#
-# ccwl 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 ccwl. If not, see <https://www.gnu.org/licenses/>.
+(import (ice-9 match))
-abs_top_srcdir="`cd "@abs_top_srcdir@" > /dev/null; pwd -P`"
-abs_top_builddir="`cd "@abs_top_builddir@" > /dev/null; pwd -P`"
+(define (prepend-path-env! name . values)
+ (setenv name (string-append (string-join values ":" 'suffix)
+ (getenv name))))
-GUILE_LOAD_COMPILED_PATH="$abs_top_builddir${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
-GUILE_LOAD_PATH="$abs_top_builddir:$abs_top_srcdir${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
-export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
+(prepend-path-env! "GUILE_LOAD_PATH" "@abs_top_builddir@" "@abs_top_srcdir@")
+(prepend-path-env! "GUILE_LOAD_COMPILED_PATH" "@abs_top_builddir@")
-exec "$@"
+(match (command-line)
+ ((pre-inst-env command args ...)
+ (apply execlp command command args)))