forked from prusa3d/Prusa-Link
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprusalink-boot
executable file
·29 lines (28 loc) · 980 Bytes
/
prusalink-boot
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
#!/bin/bash
USERNAME=$(id -nu 1000)
HOME_DIR=$(eval echo "~$USERNAME")
P_SOURCE="/boot/prusa_printer_settings.ini"
P_DESTINATION="$HOME_DIR/prusa_printer_settings.ini"
if test -f $P_SOURCE; then
echo "Using the new printer settings from the boot partition!" | logger
mv $P_SOURCE $P_DESTINATION
chown $USERNAME $P_DESTINATION
chgrp $USERNAME $P_DESTINATION
chmod 644 $P_DESTINATION
else
echo "No file to overwrite the current printer settings with." | logger
fi
S_SOURCE="/boot/prusalink.ini"
S_DESTINATION="/etc/prusalink/prusalink.ini"
S_DESTINATION_DIR="/etc/prusalink"
if test -f $S_SOURCE; then
echo "Using the new app config from the boot partition!" | logger
if ! test -d S_DESTINATION_DIR ; then
echo "Creating a folder at $S_DESTINATION_DIR" | logger
mkdir $S_DESTINATION_DIR
fi
mv $S_SOURCE $S_DESTINATION
chmod 644 $S_DESTINATION
else
echo "No file to overwrite the current app config with." | logger
fi