Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@
# Software repos
software
embedded
mission9
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3"
version: "2"

services:
maav-run:
Expand All @@ -7,4 +7,4 @@ services:
- ./software:/software
- ${PWD}/Makefile:/Makefile
container_name: maav-run
command: "make ${ACTION}"
command: "make ${ACTION}"
20 changes: 20 additions & 0 deletions maav-uninstall.sh
Original file line number Diff line number Diff line change
@@ -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
56 changes: 34 additions & 22 deletions maav.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,41 @@
#!/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 directory of this script
MAAV_DIR=$(dirname "$0")

# Run the built MAAV code
function run() {
# Change to the MAAV directory
cd $MAAV_DIR
ACTION=$1 docker-compose run --rm maav-run
}

function print_where() {
echo $MAAV_DIR
# 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:
# * 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:"
Expand All @@ -41,9 +47,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
Expand All @@ -53,4 +63,6 @@ elif [ $CMD == "nuke" ]; then
nuke
elif [ $CMD == "run" ]; then
run $ARG
fi
else
print_help
fi