| git.druid.rocks | index | druid520 | mp | mk/ | bs.sh |
mk/bs.sh
set -e
MP_PREFIX="${MP_PREFIX:-/usr/local}"
if command -v mk >/dev/null 2>&1; then
mk . b
else
sh mk/b.sh
fi
mkdir -p "$MP_PREFIX/bin/mplib" "$MP_PREFIX/libexec/mp"
cp mpx "$MP_PREFIX/libexec/mp/mpx.new"
chmod +x "$MP_PREFIX/libexec/mp/mpx.new"
mv -f "$MP_PREFIX/libexec/mp/mpx.new" "$MP_PREFIX/libexec/mp/mpx"
cp mp "$MP_PREFIX/bin/mp.new"
chmod +x "$MP_PREFIX/bin/mp.new"
mv -f "$MP_PREFIX/bin/mp.new" "$MP_PREFIX/bin/mp"
# mp.<command>: the -x check keeps the real, non-executable mp.conf.example
# (matched by the same glob at repo root) from being installed as a command.
for f in mp.*; do
[ -x "$f" ] || continue
cp "$f" "$MP_PREFIX/bin/$f.new"
chmod +x "$MP_PREFIX/bin/$f.new"
mv -f "$MP_PREFIX/bin/$f.new" "$MP_PREFIX/bin/$f"
done
# same reason meta/mp's own add.sh now does this too: usage()/mp.version
# both classify an installed mp.<name> as core vs. plugin by checking
# this file -- bootstrap installed everything else already, but never
# this, so "commands:"/"plugins:" collapsed into one undifferentiated
# list until the very first "mp reinstall mp" replaced it with add.sh's
# own (now-fixed) copy.
if [ -f plugins.list ]; then
cp plugins.list "$MP_PREFIX/bin/plugins.list.new"
mv -f "$MP_PREFIX/bin/plugins.list.new" "$MP_PREFIX/bin/plugins.list"
fi
for f in mplib/*.pm; do
cp "$f" "$MP_PREFIX/bin/$f.new"
mv -f "$MP_PREFIX/bin/$f.new" "$MP_PREFIX/bin/mplib/$(basename "$f")"
done
[ -f /etc/mp.conf ] || cp mp.conf.example /etc/mp.conf
[ -f /etc/mpx.conf ] || cp mpx.conf.example /etc/mpx.conf
"$MP_PREFIX/bin/mp" install meta/mp