forked from prusa3d/Prusa-Error-Codes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remote_install.sh
executable file
·44 lines (35 loc) · 1016 Bytes
/
remote_install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
# This file is part of the SL1 firmware
# Copyright (C) 2020 Prusa Research a.s. - www.prusa3d.com
# SPDX-License-Identifier: GPL-3.0-or-later
# Resolve target
if [ "$#" -ne 1 ]; then
echo "Please provide target ip as the only argument"
exit -1
fi
target=${1}
echo "Target is ${target}"
# Print commands being executed
set -o xtrace
# Create temp root
tmp=$(mktemp --directory --tmpdir=/tmp/ prusa_errors.XXXX)
echo "Local temp is ${tmp}"
echo "Running setup"
python3 setup.py sdist --dist-dir=${tmp}
# Create remote temp
target_tmp=$(ssh root@${target} "mktemp --directory --tmpdir=/tmp/ prusa_errors.XXXX")
echo "Remote temp is ${target_tmp}"
echo "Installing on target"
scp -r ${tmp}/* root@${target}:${target_tmp}
ssh root@${target} "\
set -o xtrace; \
cd ${target_tmp}; \
tar xvf prusa_errors*.tar.gz; \
rm prusa_errors*.tar.gz; \
cd prusa_errors-*; \
pip3 install . ; \
"
echo "Removing remote temp"
ssh root@${target} "rm -rf ${target_tmp}"
echo "Removing local temp"
rm -rf ${tmp}