-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split each install function into a separate file.
- Loading branch information
Showing
11 changed files
with
241 additions
and
307 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Check for arduino-cli tool first. | ||
if command -v arduino-cli &> /dev/null; then | ||
echo "arduino-cli is already installed." | ||
exit 0 | ||
fi | ||
|
||
# Make sure we are at home. | ||
cd | ||
|
||
# Get the arduino-cli tool and install. | ||
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh | ||
|
||
"${HOME}/bin/arduino-cli" config init | ||
"${HOME}/bin/arduino-cli" core update-index | ||
"${HOME}/bin/arduino-cli" core install arduino:avr | ||
"${HOME}/bin/arduino-cli" lib install ArduinoJson | ||
|
||
# Ask if the user wants to install the power board software. | ||
read -p "Do you want to install the power board software? [y/N] " -n 1 -r | ||
echo | ||
if [[ $REPLY =~ ^[Yy]$ ]]; then | ||
source ./install-power-board.sh | ||
fi |
This file was deleted.
Oops, something went wrong.
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,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
# We use htpdate below so this just needs to be a public url w/ trusted time. | ||
TIME_SERVER="${TIME_SERVER:-google.com}" | ||
|
||
function fix_time() { | ||
echo "Syncing time." | ||
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y -qq htpdate | ||
sudo timedatectl set-ntp false | ||
sudo /usr/sbin/htpdate -as "${TIME_SERVER}" | ||
sudo timedatectl set-ntp true | ||
|
||
# Add crontab entries for reboot and every hour. | ||
( | ||
sudo crontab -l | ||
echo "@reboot /usr/sbin/htpdate -as ${TIME_SERVER}" | ||
) | sudo crontab - | ||
( | ||
sudo crontab -l | ||
echo "13 * * * * /usr/sbin/htpdate -s ${TIME_SERVER}" | ||
) | sudo crontab - | ||
|
||
# Show updated time. | ||
timedatectl | ||
} | ||
|
||
fix_time |
Oops, something went wrong.