Root/genkicat/mkgenkicat-wrapper

1#!/bin/sh -e
2#
3# mkgenkicat-wrapper - Generate wrapper script for genkicat
4#
5# Copyright 2012 by Werner Almesberger
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12
13
14MODE=555
15DIR=
16
17usage()
18{
19    echo "usage: $0 [-m mode] [-p directory] wrapper-path" 1>&2
20    exit 1
21}
22
23
24while [ "$1" ]; do
25    case "$1" in
26    -m) shift
27        MODE=$1;;
28    -p) shift
29        DIR=$1;;
30    -*) usage;;
31    *) break;;
32    esac
33    shift
34done
35
36: ${DIR:=`dirname $1`}
37
38[ -d "$DIR" ] && [ "$1" ] && [ -z "$2" ] || usage
39
40trap "rm -f _wrapper" 0
41
42cat <<EOF >_wrapper
43#!/bin/sh
44PATH=\$PATH:$DIR
45exec genkicat-bin "\$@"
46EOF
47chmod $MODE _wrapper
48
49mv _wrapper "$1"
50

Archive Download this file

Branches:
master



interactive