added a 'setup' action to manage-tools

This commit is contained in:
Yan 2015-05-07 19:27:54 -07:00
parent 6008834633
commit cc99f23430
2 changed files with 35 additions and 3 deletions

View file

@ -5,11 +5,18 @@ Of course, this isn't a hard problem, but it's really nice to have them in one p
To use, do:
```bash
# set up the path
manage-tools setup
source ~/.bashrc
# list the available tools
manage-tools list
# install gdb
manage-tools install gdb
# install gdb, allowing it to try to sudo install dependencies
manage-tools -s install gdb
# install pwntools, but don't let it sudo install dependencies
manage-tools install pwntools
# uninstall gdb
manage-tools uninstall gdb

View file

@ -1,11 +1,36 @@
#!/bin/bash -e
ALLOW_SUDO=0
while [[ $1 == -* ]]
do
case $1 in
-h)
cat <<END
Usage: $0 [-s] (list|setup|install|uninstall|bin) tool
Where:
-s allow running things with sudo (i.e., to install debs)
tool the name of the tool
END
exit
;;
-s)
ALLOW_SUDO=1
;;
*)
;;
esac
shift
done
ACTION=$1
TOOL=$2
cd $(dirname "${BASH_SOURCE[0]}")/..
case $ACTION in
setup)
echo "PATH=\"$PWD/bin:\$PATH\"" >> ~/.bashrc
;;
list)
for t in *
do
@ -32,7 +57,7 @@ case $ACTION in
cd $TOOL
echo "TOOLS | $TOOL | starting install"
[ -x ./install-root ] && ./install-root
[ -x ./install-root -a "$ALLOW_SUDO" -eq 1 ] && sudo ./install-root
./install
echo "TOOLS | $TOOL | install finished"