From bb5e2fbda82de6edcbf218d2b916d3f4e014a666 Mon Sep 17 00:00:00 2001 From: Jacob Minock Date: Sun, 29 Sep 2019 13:10:21 -0400 Subject: [PATCH 1/6] Made the Makefile more readable --- Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b353a8b..f308eb8 100644 --- a/Makefile +++ b/Makefile @@ -8,10 +8,15 @@ run-all: ./maav-software/bin/maav-exec clean: - rm -r /software/bin; rm -r /software/lib; cd /software/build && make clean + rm -r /software/bin + rm -r /software/lib + cd /software/build && make clean nuke: - cd; rm -r /software/bin; rm -r /software/lib; rm -r /software/build + cd + rm -r /software/bin + rm -r /software/lib + rm -r /software/build .PHONY: build .PHONY: bash From da837590924e63b1ad48e5570999b9b562fa93a6 Mon Sep 17 00:00:00 2001 From: Jacob Minock Date: Sun, 29 Sep 2019 13:11:17 -0400 Subject: [PATCH 2/6] Changed version from 3 to 2; should be more compatible with our systems --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7693e5d..39d36bb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: "3" +version: "2" services: maav-run: @@ -7,4 +7,4 @@ services: - ./software:/software - ${PWD}/Makefile:/Makefile container_name: maav-run - command: "make ${ACTION}" \ No newline at end of file + command: "make ${ACTION}" From e039faddf3230b62f459720a5ee2dc71b4d7128d Mon Sep 17 00:00:00 2001 From: Jacob Minock Date: Sun, 29 Sep 2019 13:14:06 -0400 Subject: [PATCH 3/6] Reformatted a bit; added some comments; now using rm -f instead of manual check for nuke; displays help menu without args --- maav.sh | 53 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/maav.sh b/maav.sh index 79a34c9..2772e98 100755 --- a/maav.sh +++ b/maav.sh @@ -1,35 +1,38 @@ #!/bin/bash -CMD=$1 +# Set command requested; "help" by default +CMD=${1:-help} + +# Set argument for command; for now, "build" and "run" use an argument ARG=$2 # TODO: read this from ~/.maavrc -MAAV_DIR=/home/rpash/maav +# Set the directory of the MAAV repository on this machine +# Note: this will be the highest directory that is still in the repo +# Note: this is also the current directory TODO +MAAV_DIR=$PWD +# Run the built MAAV code +# TODO function run() { cd $MAAV_DIR ACTION=$1 docker-compose run --rm maav-run } -function print_where() { - echo $MAAV_DIR -} - +# Delete the following folders: +# * software/bin - Contains executable files built from source +# * software/lib - Contains MAAV libraries, not third party libraries +# * software/build - Contains build data function nuke() { - if [ -d "$MAAV_DIR/software/bin" ]; then - echo "Removing $MAAV_DIR/software/bin" - rm -r $MAAV_DIR/software/bin - fi - if [ -d "$MAAV_DIR/software/lib" ]; then - echo "Removing $MAAV_DIR/software/lib" - rm -r $MAAV_DIR/software/lib - fi - if [ -d "$MAAV_DIR/software/build" ]; then - echo "Removing $MAAV_DIR/software/build" - rm -r $MAAV_DIR/software/build - fi + echo "Removing $MAAV_DIR/software/bin" + rm -rf $MAAV_DIR/software/bin + echo "Removing $MAAV_DIR/software/lib" + rm -rf $MAAV_DIR/software/lib + echo "Removing $MAAV_DIR/software/build" + rm -rf $MAAV_DIR/software/build } +# Print script usage function print_help() { echo "Usage: maav [command]" echo -e "Commands:" @@ -41,9 +44,13 @@ function print_help() { echo -e "\trun [exe]\tRun a compiled executable" } -if [ $CMD == "help" ]; then - print_help -elif [ $CMD == "where" ]; then +# Print the location of the MAAV directory +function print_where() { + echo $MAAV_DIR +} + +# Read command, and call appropriate function +if [ $CMD == "where" ]; then print_where elif [ $CMD == "build" ]; then run build $ARG @@ -53,4 +60,6 @@ elif [ $CMD == "nuke" ]; then nuke elif [ $CMD == "run" ]; then run $ARG -fi \ No newline at end of file +else + print_help +fi From b9537a9f999d2f2dccd10d0bba6970b7bb6d298c Mon Sep 17 00:00:00 2001 From: Jacob Minock Date: Sun, 29 Sep 2019 14:10:06 -0400 Subject: [PATCH 4/6] Wrote uninstall script for removing software/ and docker image --- maav-uninstall.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 maav-uninstall.sh diff --git a/maav-uninstall.sh b/maav-uninstall.sh new file mode 100755 index 0000000..3ecc2d9 --- /dev/null +++ b/maav-uninstall.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Get directory of the bash script, which is the MAAV directory +MAAV_DIR=$(dirname "$0") + +# Ask for confirmation of uninstallation; make user type "uninstall" +read -p "Are you sure you want to uninstall? Type \"uninstall\": " -r +if [ $REPLY != "uninstall" ] +then + exit 1 +fi + +echo "Starting Uninstall" + +echo "Deleting Software Folder..." +rm -rf $MAAV_DIR/software/ +rm -rf $MAAV_DIR/Software/ + +echo "Deleting Docker image" +docker image rm maav-software From 4f25488999bc464ee076e8129274efcaa92d327e Mon Sep 17 00:00:00 2001 From: Jacob Minock Date: Sun, 29 Sep 2019 15:11:44 -0400 Subject: [PATCH 5/6] Changed MAAV_DIR from PWD to script location; started work on run command --- maav.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/maav.sh b/maav.sh index 2772e98..40dc5c4 100755 --- a/maav.sh +++ b/maav.sh @@ -8,15 +8,18 @@ ARG=$2 # TODO: read this from ~/.maavrc # Set the directory of the MAAV repository on this machine -# Note: this will be the highest directory that is still in the repo -# Note: this is also the current directory TODO -MAAV_DIR=$PWD +# Note: this will be the directory of this script +MAAV_DIR=$(dirname "$0") # Run the built MAAV code -# TODO function run() { + # Change to the MAAV directory cd $MAAV_DIR - ACTION=$1 docker-compose run --rm maav-run + + # Get the action we are running; docker-compose by default + ACTION=${1:-docker-compose run --rm maav-run} + + # TODO Run action } # Delete the following folders: From e898b13e8939b977eae54c17c27086863629a273 Mon Sep 17 00:00:00 2001 From: Jacob Minock Date: Wed, 13 Nov 2019 20:52:59 -0500 Subject: [PATCH 6/6] Added ignoring of mission9/ directory to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7a36284..17988b4 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ # Software repos software embedded +mission9