Made the install script and Makefile more verbose

pull/15/head
Alexandre Dantas 10 years ago
parent 28b5c87ce7
commit 31177a9352

@ -1,18 +1,24 @@
# bpkg Makefile
BIN ?= bpkg
BIN ?= bpkg
PREFIX ?= /usr/local
# All 'bpkg' supported commands
CMDS = json install package term suggest init
install: uninstall
install $(BIN) $(PREFIX)/bin
for cmd in $(CMDS); do cp $(BIN)-$${cmd} $(PREFIX)/bin; done
@echo " info: Installing $(PREFIX)/$(BIN)..."
@install $(BIN) $(PREFIX)/bin
@for cmd in $(CMDS); do cp $(BIN)-$${cmd} $(PREFIX)/bin; done
uninstall:
rm -f $(PREFIX)/bin/$(BIN)
for cmd in $(CMDS); do rm -f $(PREFIX)/bin/$(BIN)-$${cmd}; done
@echo " info: Uninstalling $(PREFIX)/$(BIN)..."
@rm -f $(PREFIX)/bin/$(BIN)
@for cmd in $(CMDS); do rm -f $(PREFIX)/bin/$(BIN)-$${cmd}; done
link: uninstall
ln -s $(BIN) $(PREFIX)/bin/$(BIN)
for cmd in $(CMDS); do ln -s $(BIN)-$${cmd} $(PREFIX)/bin; done
@ln -s $(BIN) $(PREFIX)/bin/$(BIN)
@for cmd in $(CMDS); do ln -s $(BIN)-$${cmd} $(PREFIX)/bin; done
unlink: uninstall

@ -1,4 +1,13 @@
#!/bin/bash
#
# # #
# #mmm mmmm # m mmmm
# #" "# #" "# # m" #" "#
# # # # # #"# # #
# ##m#" ##m#" # "m "#m"#
# # m #
# " ""
# bash package manager
REMOTE=${REMOTE:-https://github.com/bpkg/bpkg.git}
TMPDIR=${TMPDIR:-/tmp}
@ -6,6 +15,7 @@ DEST=${DEST:-${TMPDIR}/bpkg-master}
## test if command exists
ftest () {
echo " info: Checking for ${1}..."
if ! type -f "${1}" > /dev/null 2>&1; then
return 1
else
@ -17,7 +27,7 @@ ftest () {
features () {
for f in "${@}"; do
ftest "${f}" || {
echo >&2 " error: Missing \`${f}'"
echo >&2 " error: Missing \`${f}'! Make sure it exists and try again."
return 1
}
done
@ -26,6 +36,7 @@ features () {
## main setup
setup () {
echo " info: Welcome to the 'bpkg' installer!"
## test for require features
features git || return $?
@ -33,15 +44,16 @@ setup () {
{
echo
cd ${TMPDIR}
echo " info: pruning..."
test -d ${DEST} && { echo " warn: exists: \`${DEST}'"; }
echo " info: Creating temporary files..."
test -d ${DEST} && { echo " warn: Already exists: \`${DEST}'"; }
rm -rf ${DEST}
echo " info: fetching..."
echo " info: Fetching latest 'bpkg'..."
git clone --depth=1 ${REMOTE} ${DEST} > /dev/null 2>&1
cd ${DEST}
echo " info: installing..."
echo " info: Installing..."
echo
make install
echo " info: Done!"
} >&2
return $?
}

Loading…
Cancel
Save