-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an automatic PrusaLink image builder script
- Loading branch information
Showing
11 changed files
with
634 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[Unit] | ||
Description=Boot message | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/bin/sh -c 'stty -F /dev/ttyAMA0 115200; printf \'M117 RPi booting...\n\' > /dev/ttyAMA0' | ||
|
||
[Install] | ||
WantedBy=basic.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
set_up_port () { | ||
# Sets the baudrate and cancels the hangup at the end of a connection | ||
stty -F "$1" 115200 -hupcl; | ||
} | ||
|
||
message() { | ||
printf "M117 $2\n" > "$1" | ||
} | ||
|
||
set_up_port "/dev/ttyAMA0" | ||
message "/dev/ttyAMA0" "Please wait < 10min"; | ||
|
||
for i in {0..5}; do | ||
set_up_port "/dev/ttyACM$i" | ||
done | ||
|
||
sleep 8 | ||
|
||
for i in {0..5}; do | ||
message "/dev/ttyACM$i" "Please wait < 10min" | ||
done | ||
|
||
# This generates the host keys for the ssh server to work | ||
ssh-keygen -A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Forward the port 80 to 8080 even on the loopback, so we van ping ourselves | ||
iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 80 -j REDIRECT --to-port 8080 | ||
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 | ||
iptables -t nat -I OUTPUT -p tcp -o lo -d localhost --dport 80 -j REDIRECT --to-ports 8080 | ||
|
||
set_up_port () { | ||
# Sets the baudrate and cancels the hangup at the end of a connection | ||
stty -F "$1" 115200 -hupcl; | ||
} | ||
|
||
message() { | ||
printf "M117 $2\n" > "$1" | ||
} | ||
|
||
username=$(id -nu 1000) | ||
user_site=$(su $username -c "python -m site --user-site") | ||
|
||
set_up_port "/dev/ttyAMA0" | ||
message "/dev/ttyAMA0" "Starting PrusaLink"; | ||
|
||
/home/$username/.local/bin/prusalink-boot | ||
rm -f /run/prusalink/manager.pid | ||
export PYTHONOPTIMIZE=2 | ||
PYTHONPATH=$user_site /home/$username/.local/bin/prusalink-manager -p "PYTHONPATH=$user_site /home/$username/.local/bin/" start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Forward the port 80 to 8080 even on the loopback, so we van ping ourselves | ||
iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 80 -j REDIRECT --to-port 8080 | ||
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 | ||
iptables -t nat -I OUTPUT -p tcp -o lo -d localhost --dport 80 -j REDIRECT --to-ports 8080 | ||
|
||
set_up_port () { | ||
# Sets the baudrate and cancels the hangup at the end of a connection | ||
stty -F "$1" 115200 -hupcl; | ||
} | ||
|
||
message() { | ||
printf "M117 $2\n" > "$1" | ||
} | ||
|
||
username=$(id -nu 1000) | ||
|
||
set_up_port "/dev/ttyAMA0" | ||
message "/dev/ttyAMA0" "Starting PrusaLink"; | ||
|
||
/home/$username/.local/bin/prusalink-boot | ||
rm -f /home/$username/prusalink.pid | ||
export PYTHONOPTIMIZE=2 | ||
su $username -c "/home/$username/.local/bin/prusalink -i start" |
Empty file.
Oops, something went wrong.