Skip to content

Commit

Permalink
More consistency with the PANUSER and PANDIR.
Browse files Browse the repository at this point in the history
  • Loading branch information
wtgee committed Nov 19, 2024
1 parent cefdd3e commit abffede
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions resources/scripts/install-conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

CONDA_URL="https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-$(uname -m).sh"
CONDA_ENV_NAME=conda-pocs
PANDIR="${PANDIR:-${HOME}/POCS}"

function install_conda() {
echo "Installing miniforge conda"
Expand All @@ -11,7 +12,6 @@ function install_conda() {
rm install-miniforge.sh

source "${HOME}/conda/etc/profile.d/conda.sh"
source "${HOME}/conda/etc/profile.d/mamba.sh"

# Initialize conda for the shells.
"${HOME}/conda/bin/conda" init bash zsh
Expand All @@ -22,7 +22,7 @@ function install_conda() {
# Activate by default
echo "conda activate ${CONDA_ENV_NAME}" >>"${HOME}/.zshrc"

"${HOME}/conda/bin/mamba" env update -p "${HOME}/conda/envs/${CONDA_ENV_NAME}" -f environment.yaml
"${HOME}/conda/bin/conda" env update -p "${HOME}/conda/envs/${CONDA_ENV_NAME}" -f "${PANDIR}/environment.yaml"
}

install_conda
8 changes: 6 additions & 2 deletions resources/scripts/install-pocs.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#!/usr/bin/env bash

CODE_BRANCH=${CODE_BRANCH:-"develop"}
PANUSER="${PANUSER:-$USER}"
PANDIR="${PANDIR:-${HOME}/POCS}"

function get_pocs_repo() {
echo "Cloning POCS repo."
# Check if PANDIR exists and if not, clone.
if [ -d "${PANDIR}" ]; then
echo "POCS repo already exists."
return
fi

echo "Cloning POCS repo."
git clone https://github.com/panoptes/POCS "${PANDIR}"
cd "${PANDIR}"
git checkout "${CODE_BRANCH}"
Expand Down
9 changes: 4 additions & 5 deletions resources/scripts/install-services.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
#!/usr/bin/env bash

PANUSER="${PANUSER:-$USER}"
PANDIR="${PANDIR:-${HOME}/pocs}"
PANUSER="${PANUSER:-panoptes}"

function install_services() {
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
echo "files = ${HOME}/conf_files/pocs-supervisord.conf" | 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
supervisorctl reread
supervisorctl update
}

install_services
12 changes: 6 additions & 6 deletions resources/scripts/install-system-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ function system_deps() {
echo "Installing system dependencies."

# Set up passwordless sudo for all sudo group.
echo "%sudo ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/panoptes
echo "%sudo ALL=(ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/panoptes

# Clean up problems.
sudo apt-get -y -qq purge needrestart
sudo apt-get update --fix-missing -y -qq
sudo apt-get -y -qq full-upgrade
apt-get -y -qq purge needrestart
apt-get update --fix-missing -y -qq
apt-get -y -qq full-upgrade

sudo apt-get -y -qq install \
apt-get -y -qq install \
ack \
astrometry.net \
astrometry-data-tycho2-10-19 \
Expand All @@ -33,7 +33,7 @@ function system_deps() {
supervisor \
wget \
zsh
sudo apt-get -y -qq autoremove
apt-get -y -qq autoremove
}

system_deps
4 changes: 2 additions & 2 deletions resources/scripts/install-zsh.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

PANUSER="${PANUSER:-$USER}"
PANDIR="${PANDIR:-${HOME}/pocs}"
PANUSER="${PANUSER:-panoptes}"
PANDIR="${PANDIR:-${HOME}/POCS}"

function install_zsh() {
if [ ! -d "$ZSH_CUSTOM" ]; then
Expand Down
2 changes: 1 addition & 1 deletion resources/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
set -e

echo "Installing POCS"
source ./install-pocs.sh
source ./install-system-deps.sh
source ./install-conda.sh
source ./install-pocs.sh
source ./install-zsh.sh
source ./install-services.sh
2 changes: 0 additions & 2 deletions resources/scripts/setup-user.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash

PANUSER="${PANUSER:-$USER}"

function setup_user() {
# Add an SSH key if one doesn't exist.
if [[ ! -f "${HOME}/.ssh/id_rsa" ]]; then
Expand Down

0 comments on commit abffede

Please sign in to comment.