-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·71 lines (60 loc) · 1.96 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·71 lines (60 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#! /bin/bash
# -*- bash -*-
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis <michael.aivazis@para-sim.com>
# (c) 1998-2026 all rights reserved
# simple installation script for mm
# usage: ./install.sh {prefix} [--bash-completion]
# parse arguments
prefix=""
install_completion=0
while [[ $# -gt 0 ]]; do
case $1 in
--bash-completion)
install_completion=1
shift
;;
*)
if [ x"${prefix}" = x"" ]; then
prefix=$1
else
echo "error: unexpected argument '$1'"
echo "usage: install.sh <prefix> [--bash-completion]"
exit 1
fi
shift
;;
esac
done
# check that we were given a prefix
if [ x"${prefix}" = x"" ]; then
echo "usage: install.sh <prefix> [--bash-completion]"
echo ""
echo "options:"
echo " --bash-completion install bash completion support for mm"
exit 1
fi
# ensure the installation location for the script exists
mkdir -p ${prefix}/bin
# and copy it ther
cp mm ${prefix}/bin
# ensure that the installation location for my headers exists
mkdir -p ${prefix}/include
# copy them over
cp -r include/mm ${prefix}/include
# ensure that the installation location for my makefile fragments exists
mkdir -p ${prefix}/share/mm
# copy them over, along with the readme and the license file
cp -r README.md LICENSE make ${prefix}/share/mm
# if bash completion was requested
if [ ${install_completion} -eq 1 ]; then
echo "installing bash completion support..."
# ensure the bash completion directory exists
mkdir -p ${prefix}/share/bash-completion/completions
# copy the completion script
cp etc/bash_completion/mm ${prefix}/share/bash-completion/completions/mm
echo "bash completion installed to ${prefix}/share/bash-completion/completions/mm"
echo "you may need to restart your shell or run: source ${prefix}/share/bash-completion/completions/mm"
fi
# end of file