Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Commit

Permalink
Added documentation to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
leadnaut authored and leadnaut committed Aug 17, 2024
1 parent c71bf7e commit f146446
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ To run a specific test, say `test_dummy.py`, use
poetry run pytest tests/test_dummy.py
```

## Deployment
To deploy a build to the Raspberry Pi use the `deploy.sh` script. This script will create a tarball of file listed in a text file, transfer it to
a specified hostname and untar it there.

To use the script execute it in the project's root directory with,
```bash
./deploy.sh [pathfile] [username]@[hostname]
```
For example, to deploy the files listed in `deploypaths.txt` to `testpi` (using username raspberry) the command would be
```bash
./deploy.sh deploypaths.txt raspberry@testpi
```
The pathname file should contain a path to a file or directory on each line. If a directory is listed `deploy.sh` will copy the entire contents over.
You can use the `#` character at the start of a line to leave comments.

## Code Styling

We use [black](https://black.readthedocs.io/en/stable/) for automated code formatting. To run Black, run this command from the root of the repo:
Expand Down
5 changes: 3 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ WARN="[\033[1;33mWARN\033[0m]"
INFO="[\033[1;32mINFO\033[0m]"
ERROR="[\033[1;31mERROR\033[0m]"

PATHFILE='deploypaths.txt'
PATHFILE=$1
TEMPDIRPATH='package_temp'

[ -d $TEMPDIRPATH ]
Expand Down Expand Up @@ -57,7 +57,7 @@ if ! tar cf $TARNAME -C $TEMPDIRPATH "./build"; then
exit 1
fi

SSHTARGET=$1
SSHTARGET=$2
# Check if we can find target
if ! nc -z $SSHTARGET 22 2>/dev/null; then
echo -e "$ERROR Host unreachable";
Expand All @@ -72,6 +72,7 @@ if ! scp -q $TARNAME $SSHTARGET:~/; then
exit 1
fi

echo -e "$INFO Extracting Build - the password may be needed again"
if ! ssh $SSHTARGET "tar xf $TARNAME; rm $TARNAME"; then
echo -e "$ERROR Remote extraction failed"
cleanup
Expand Down

0 comments on commit f146446

Please sign in to comment.