-
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.
* Remove custom gphoto2 install * Install from apt, which is at the current version. This should save a lot of time compared to the compiling needed for the custom install. * * Source micromamba properly * * Fixing up more of the conda/mamba init on install. * * Removing install shell function for udev entries, which are handled by `pocs mount setup`. * * Small change to writing of dev entry. * * Remove gphoto2 dev install. * Moving script file location. * Split each install function into a separate file. * Small script fixes. * Passwordless sudo on machine. * Default POCS dir to uppercase. * More consistency with the PANUSER and PANDIR. * Remove from functions so just scripts run. * Setup user and do passwordless, all the good stuff. * Handle pocs clone * Change default shell with sudo * Updating the script install order. * Fix conda install. * Make scripts executable. * Check for zsh dir * Explicit ohmyzsh * Python 3.12 for now. * Add a base script that can be fetched and installed.
- Loading branch information
Showing
16 changed files
with
252 additions
and
352 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 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,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 |
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,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
BRANCH="${BRANCH:-develop}" | ||
|
||
git clone https://github.com/panoptes/POCS | ||
cd POCS | ||
git checkout "${BRANCH}" | ||
cd resources/scripts | ||
./install.sh | ||
|
||
echo "POCS installed, please reboot." |
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,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
CONDA_URL="https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-$(uname -m).sh" | ||
PANDIR="${PANDIR:-${HOME}/POCS}" | ||
CONDA_ENV_NAME=conda-pocs | ||
|
||
echo "Installing miniforge conda" | ||
|
||
wget -q "${CONDA_URL}" -O install-miniforge.sh | ||
/bin/sh install-miniforge.sh -b -f -p "${HOME}/conda" | ||
rm install-miniforge.sh | ||
|
||
source "${HOME}/conda/etc/profile.d/conda.sh" | ||
|
||
# Initialize conda for the shells. | ||
"${HOME}/conda/bin/conda" init bash zsh | ||
|
||
echo "Creating POCS conda environment" | ||
"${HOME}/conda/bin/conda" create -y -q -n "${CONDA_ENV_NAME}" python=3.12 | ||
|
||
# Activate by default | ||
echo "conda activate ${CONDA_ENV_NAME}" >>"${HOME}/.zshrc" |
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,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
CODE_BRANCH=${CODE_BRANCH:-"develop"} | ||
CONDA_ENV_NAME=conda-pocs | ||
PANDIR="${PANDIR:-${HOME}/POCS}" | ||
|
||
# Check if PANDIR exists and if not, clone. | ||
if [ -d "${PANDIR}" ]; then | ||
echo "POCS repo already exists." | ||
else | ||
echo "Cloning POCS repo." | ||
git clone https://github.com/panoptes/POCS "${PANDIR}" | ||
cd "${PANDIR}" | ||
git checkout "${CODE_BRANCH}" | ||
cd | ||
fi | ||
|
||
echo "Installing POCS into ${CONDA_ENV_NAME} environment." | ||
"${HOME}/conda/bin/conda" env update -p "${HOME}/conda/envs/${CONDA_ENV_NAME}" -f "${PANDIR}/environment.yaml" | ||
|
||
echo "Creating POCS directories." | ||
mkdir -p "${HOME}/logs" | ||
mkdir -p "${HOME}/images" | ||
mkdir -p "${HOME}/json_store" | ||
mkdir -p "${HOME}/keys" | ||
|
||
# Link the needed POCS folders. | ||
ln -s "${PANDIR}/conf_files" "${HOME}" | ||
ln -s "${PANDIR}/resources" "${HOME}" | ||
ln -s "${PANDIR}/notebooks" "${HOME}" |
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,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
PANUSER="${PANUSER:-panoptes}" | ||
|
||
echo "Installing supervisor services." | ||
|
||
# Make supervisor read our conf file at its current location. | ||
echo "files = ${HOME}/conf_files/pocs-supervisord.conf" | sudo tee -a /etc/supervisor/supervisord.conf | ||
|
||
# Change the user and home directory. | ||
sed -i "s/chown=panoptes:panoptes/chown=${PANUSER}:${PANUSER}/g" "${HOME}/conf_files/pocs-supervisord.conf" | ||
sed -i "s/user=panoptes/user=${PANUSER}/g" "${HOME}/conf_files/pocs-supervisord.conf" | ||
sed -i "s|/home/panoptes|${HOME}|g" "${HOME}/conf_files/pocs-supervisord.conf" | ||
|
||
# Reread the supervisord conf and restart. | ||
sudo supervisorctl reread | ||
sudo supervisorctl update |
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,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "Installing system dependencies." | ||
|
||
# Clean up problems. | ||
sudo apt-get update --fix-missing -y | ||
|
||
# Upgrade. | ||
sudo apt-get -y full-upgrade | ||
|
||
sudo apt-get -y install \ | ||
ack \ | ||
astrometry.net \ | ||
astrometry-data-tycho2-10-19 \ | ||
byobu \ | ||
curl \ | ||
dcraw \ | ||
exiftool \ | ||
fonts-powerline \ | ||
gcc \ | ||
git \ | ||
gphoto2 \ | ||
htop \ | ||
httpie \ | ||
jo \ | ||
jq \ | ||
libcfitsio-bin \ | ||
make \ | ||
nano \ | ||
supervisor \ | ||
vim-nox \ | ||
wget \ | ||
zsh | ||
|
||
sudo apt-get -y autoremove |
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,43 @@ | ||
#!/usr/bin/env bash | ||
|
||
PANUSER="${PANUSER:-panoptes}" | ||
PANDIR="${PANDIR:-${HOME}/POCS}" | ||
|
||
function install_zsh() { | ||
if [ ! -d "${HOME}/.oh-my-zsh" ]; then | ||
echo "Using zsh for a better shell experience." | ||
|
||
sudo chsh --shell /usr/bin/zsh "${PANUSER}" | ||
|
||
# Oh my zsh | ||
wget -q https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O /tmp/install-ohmyzsh.sh | ||
bash /tmp/install-ohmyzsh.sh --unattended | ||
|
||
export ZSH_CUSTOM="$HOME/.oh-my-zsh" | ||
|
||
# Autosuggestions plugin | ||
git clone https://github.com/zsh-users/zsh-autosuggestions "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}"/plugins/zsh-autosuggestions | ||
|
||
write_zshrc | ||
fi | ||
} | ||
|
||
function write_zshrc() { | ||
cat >"${HOME}/.zshrc" <<EOT | ||
zstyle ':omz:update' mode disabled | ||
export PATH="\$HOME/bin:\$HOME/.local/bin:/usr/local/bin:\$PATH" | ||
export ZSH="/home/${PANUSER}/.oh-my-zsh" | ||
export PANDIR="${PANDIR}" | ||
ZSH_THEME="agnoster" | ||
plugins=(git sudo zsh-autosuggestions docker docker-compose python) | ||
source \$ZSH/oh-my-zsh.sh | ||
unsetopt share_history | ||
EOT | ||
} | ||
|
||
install_zsh |
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 | ||
set -e | ||
|
||
echo "Installing POCS" | ||
|
||
echo "Setting up user." | ||
source ./setup-user.sh > install.log 2>&1 | ||
|
||
echo "Fixing system time." | ||
source ./fix-time.sh >> install.log 2>&1 | ||
|
||
echo "Installing system dependencies." | ||
source ./install-system-deps.sh >> install.log 2>&1 | ||
|
||
echo "Installing ZSH for a better shell." | ||
source ./install-zsh.sh >> install.log 2>&1 | ||
|
||
echo "Installing conda python." | ||
source ./install-conda.sh >> install.log 2>&1 | ||
|
||
echo "Installing POCS software." | ||
source ./install-pocs.sh >> install.log 2>&1 | ||
|
||
echo "Installing services so things run at startup." | ||
source ./install-services.sh >> install.log 2>&1 |
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,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Set up passwordless sudo for all sudo group. | ||
echo "%sudo ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/panoptes | ||
|
||
# Add an SSH key if one doesn't exist. | ||
if [[ ! -f "${HOME}/.ssh/id_rsa" ]]; then | ||
echo "Adding ssh key" | ||
ssh-keygen -t rsa -N "" -f "${HOME}/.ssh/id_rsa" | ||
fi |
Oops, something went wrong.