Merge branch '03_install_prefix' into 'master'
- As described in #3 this commit adds PREFIX-parsing to install.sh.
This commit is contained in:
commit
161bbe50b2
1 changed files with 32 additions and 3 deletions
35
install.sh
35
install.sh
|
@ -1,5 +1,34 @@
|
||||||
#/bin/bash
|
#/bin/bash
|
||||||
|
# PREFIX gets set with the following priorities:
|
||||||
|
# 1) use provided argument
|
||||||
|
# 2) use environement PREFIX
|
||||||
|
# 3) use "/usr/local/"
|
||||||
|
|
||||||
install -m 755 src/pizza /usr/local/bin/pizza
|
|
||||||
mkdir -p /usr/local/share/pizza
|
if [ "$1" ]; then
|
||||||
install -m 644 assets/* /usr/local/share/pizza/
|
PREFIX:="$1"
|
||||||
|
else
|
||||||
|
: ${PREFIX:="/usr/local"}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create necessary directories
|
||||||
|
|
||||||
|
for i in "${PREFIX}/bin" "${PREFIX}/share/pizza"; do
|
||||||
|
if [ ! -d "$i" ]; then
|
||||||
|
mkdir -p "$i"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
install -m 755 src/pizza "${PREFIX}/bin/pizza"
|
||||||
|
install -m 644 assets/* "${PREFIX}/share/pizza/"
|
||||||
|
|
||||||
|
# Tell the user what to do next, if he used another PREFIX
|
||||||
|
|
||||||
|
if [ "${PREFIX}" != "/usr/local" ]; then
|
||||||
|
echo 'Your installation path differs from /usr/local'
|
||||||
|
echo 'For pizza to run properly, please either modify the script'
|
||||||
|
echo 'or set the PIZZAINC-variable accordingly.'
|
||||||
|
echo '(Add the following to your ${shell}rc:'
|
||||||
|
echo -e "\t export PIZZAINC=\"${PREFIX}/share/pizza/\""
|
||||||
|
echo ")"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue