File tree 16 files changed +252
-352
lines changed
src/panoptes/pocs/utils/cli 16 files changed +252
-352
lines changed Original file line number Diff line number Diff line change @@ -38,15 +38,15 @@ folks even report that it works on a Mac.
38
38
To install POCS via the script, open a terminal and enter (you may be prompted for your ` sudo ` password):
39
39
40
40
``` bash
41
- curl -fsSL https://install.projectpanoptes.org > install-pocs .sh
42
- bash install-pocs .sh
41
+ curl -fsSL https://install.projectpanoptes.org > install.sh
42
+ bash install.sh
43
43
```
44
44
45
45
Or using ` wget ` :
46
46
47
47
``` bash
48
- wget -qO- https://install.projectpanoptes.org > install-pocs .sh
49
- bash install-pocs .sh
48
+ wget -qO- https://install.projectpanoptes.org > install.sh
49
+ bash install.sh
50
50
```
51
51
52
52
The install script will ask a few questions at the beginning of the process. If you are unsure of
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # Check for arduino-cli tool first.
4
+ if command -v arduino-cli & > /dev/null; then
5
+ echo " arduino-cli is already installed."
6
+ exit 0
7
+ fi
8
+
9
+ # Make sure we are at home.
10
+ cd
11
+
12
+ # Get the arduino-cli tool and install.
13
+ curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
14
+
15
+ " ${HOME} /bin/arduino-cli" config init
16
+ " ${HOME} /bin/arduino-cli" core update-index
17
+ " ${HOME} /bin/arduino-cli" core install arduino:avr
18
+ " ${HOME} /bin/arduino-cli" lib install ArduinoJson
19
+
20
+ # Ask if the user wants to install the power board software.
21
+ read -p " Do you want to install the power board software? [y/N] " -n 1 -r
22
+ echo
23
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
24
+ source ./install-power-board.sh
25
+ fi
Original file line number Diff line number Diff line change @@ -4,9 +4,5 @@ FQBN="${FQBN:-arduino:avr:uno}"
4
4
SKETCH_LOCATION=" ${SKETCH_LOCATION:- PowerBoard} "
5
5
ARDUINO_PORT=" ${ARDUINO_PORT:-/ dev/ ttyACM0} "
6
6
7
- arduino-cli config init
8
- arduino-cli core update-index
9
- arduino-cli core install arduino:avr
10
- arduino-cli lib install ArduinoJson
11
7
arduino-cli compile -b " ${FQBN} " " ${SKETCH_LOCATION} "
12
8
arduino-cli upload -p " ${ARDUINO_PORT} " -b " ${FQBN} " " ${SKETCH_LOCATION} "
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # We use htpdate below so this just needs to be a public url w/ trusted time.
4
+ TIME_SERVER=" ${TIME_SERVER:- google.com} "
5
+
6
+ function fix_time() {
7
+ echo " Syncing time."
8
+ DEBIAN_FRONTEND=noninteractive sudo apt-get install -y -qq htpdate
9
+ sudo timedatectl set-ntp false
10
+ sudo /usr/sbin/htpdate -as " ${TIME_SERVER} "
11
+ sudo timedatectl set-ntp true
12
+
13
+ # Add crontab entries for reboot and every hour.
14
+ (
15
+ sudo crontab -l
16
+ echo " @reboot /usr/sbin/htpdate -as ${TIME_SERVER} "
17
+ ) | sudo crontab -
18
+ (
19
+ sudo crontab -l
20
+ echo " 13 * * * * /usr/sbin/htpdate -s ${TIME_SERVER} "
21
+ ) | sudo crontab -
22
+
23
+ # Show updated time.
24
+ timedatectl
25
+ }
26
+
27
+ fix_time
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ BRANCH=" ${BRANCH:- develop} "
4
+
5
+ git clone https://github.com/panoptes/POCS
6
+ cd POCS
7
+ git checkout " ${BRANCH} "
8
+ cd resources/scripts
9
+ ./install.sh
10
+
11
+ echo " POCS installed, please reboot."
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ CONDA_URL=" https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-$( uname -m) .sh"
4
+ PANDIR=" ${PANDIR:- ${HOME} / POCS} "
5
+ CONDA_ENV_NAME=conda-pocs
6
+
7
+ echo " Installing miniforge conda"
8
+
9
+ wget -q " ${CONDA_URL} " -O install-miniforge.sh
10
+ /bin/sh install-miniforge.sh -b -f -p " ${HOME} /conda"
11
+ rm install-miniforge.sh
12
+
13
+ source " ${HOME} /conda/etc/profile.d/conda.sh"
14
+
15
+ # Initialize conda for the shells.
16
+ " ${HOME} /conda/bin/conda" init bash zsh
17
+
18
+ echo " Creating POCS conda environment"
19
+ " ${HOME} /conda/bin/conda" create -y -q -n " ${CONDA_ENV_NAME} " python=3.12
20
+
21
+ # Activate by default
22
+ echo " conda activate ${CONDA_ENV_NAME} " >> " ${HOME} /.zshrc"
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ CODE_BRANCH=${CODE_BRANCH:- " develop" }
4
+ CONDA_ENV_NAME=conda-pocs
5
+ PANDIR=" ${PANDIR:- ${HOME} / POCS} "
6
+
7
+ # Check if PANDIR exists and if not, clone.
8
+ if [ -d " ${PANDIR} " ]; then
9
+ echo " POCS repo already exists."
10
+ else
11
+ echo " Cloning POCS repo."
12
+ git clone https://github.com/panoptes/POCS " ${PANDIR} "
13
+ cd " ${PANDIR} "
14
+ git checkout " ${CODE_BRANCH} "
15
+ cd
16
+ fi
17
+
18
+ echo " Installing POCS into ${CONDA_ENV_NAME} environment."
19
+ " ${HOME} /conda/bin/conda" env update -p " ${HOME} /conda/envs/${CONDA_ENV_NAME} " -f " ${PANDIR} /environment.yaml"
20
+
21
+ echo " Creating POCS directories."
22
+ mkdir -p " ${HOME} /logs"
23
+ mkdir -p " ${HOME} /images"
24
+ mkdir -p " ${HOME} /json_store"
25
+ mkdir -p " ${HOME} /keys"
26
+
27
+ # Link the needed POCS folders.
28
+ ln -s " ${PANDIR} /conf_files" " ${HOME} "
29
+ ln -s " ${PANDIR} /resources" " ${HOME} "
30
+ ln -s " ${PANDIR} /notebooks" " ${HOME} "
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ PANUSER=" ${PANUSER:- panoptes} "
4
+
5
+ echo " Installing supervisor services."
6
+
7
+ # Make supervisor read our conf file at its current location.
8
+ echo " files = ${HOME} /conf_files/pocs-supervisord.conf" | sudo tee -a /etc/supervisor/supervisord.conf
9
+
10
+ # Change the user and home directory.
11
+ sed -i " s/chown=panoptes:panoptes/chown=${PANUSER} :${PANUSER} /g" " ${HOME} /conf_files/pocs-supervisord.conf"
12
+ sed -i " s/user=panoptes/user=${PANUSER} /g" " ${HOME} /conf_files/pocs-supervisord.conf"
13
+ sed -i " s|/home/panoptes|${HOME} |g" " ${HOME} /conf_files/pocs-supervisord.conf"
14
+
15
+ # Reread the supervisord conf and restart.
16
+ sudo supervisorctl reread
17
+ sudo supervisorctl update
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ echo " Installing system dependencies."
4
+
5
+ # Clean up problems.
6
+ sudo apt-get update --fix-missing -y
7
+
8
+ # Upgrade.
9
+ sudo apt-get -y full-upgrade
10
+
11
+ sudo apt-get -y install \
12
+ ack \
13
+ astrometry.net \
14
+ astrometry-data-tycho2-10-19 \
15
+ byobu \
16
+ curl \
17
+ dcraw \
18
+ exiftool \
19
+ fonts-powerline \
20
+ gcc \
21
+ git \
22
+ gphoto2 \
23
+ htop \
24
+ httpie \
25
+ jo \
26
+ jq \
27
+ libcfitsio-bin \
28
+ make \
29
+ nano \
30
+ supervisor \
31
+ vim-nox \
32
+ wget \
33
+ zsh
34
+
35
+ sudo apt-get -y autoremove
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ PANUSER=" ${PANUSER:- panoptes} "
4
+ PANDIR=" ${PANDIR:- ${HOME} / POCS} "
5
+
6
+ function install_zsh() {
7
+ if [ ! -d " ${HOME} /.oh-my-zsh" ]; then
8
+ echo " Using zsh for a better shell experience."
9
+
10
+ sudo chsh --shell /usr/bin/zsh " ${PANUSER} "
11
+
12
+ # Oh my zsh
13
+ wget -q https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O /tmp/install-ohmyzsh.sh
14
+ bash /tmp/install-ohmyzsh.sh --unattended
15
+
16
+ export ZSH_CUSTOM=" $HOME /.oh-my-zsh"
17
+
18
+ # Autosuggestions plugin
19
+ git clone https://github.com/zsh-users/zsh-autosuggestions " ${ZSH_CUSTOM:- ~/ .oh-my-zsh/ custom} " /plugins/zsh-autosuggestions
20
+
21
+ write_zshrc
22
+ fi
23
+ }
24
+
25
+ function write_zshrc() {
26
+ cat > " ${HOME} /.zshrc" << EOT
27
+
28
+ zstyle ':omz:update' mode disabled
29
+
30
+ export PATH="\$ HOME/bin:\$ HOME/.local/bin:/usr/local/bin:\$ PATH"
31
+ export ZSH="/home/${PANUSER} /.oh-my-zsh"
32
+ export PANDIR="${PANDIR} "
33
+
34
+ ZSH_THEME="agnoster"
35
+
36
+ plugins=(git sudo zsh-autosuggestions docker docker-compose python)
37
+ source \$ ZSH/oh-my-zsh.sh
38
+ unsetopt share_history
39
+
40
+ EOT
41
+ }
42
+
43
+ install_zsh
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -e
3
+
4
+ echo " Installing POCS"
5
+
6
+ echo " Setting up user."
7
+ source ./setup-user.sh > install.log 2>&1
8
+
9
+ echo " Fixing system time."
10
+ source ./fix-time.sh >> install.log 2>&1
11
+
12
+ echo " Installing system dependencies."
13
+ source ./install-system-deps.sh >> install.log 2>&1
14
+
15
+ echo " Installing ZSH for a better shell."
16
+ source ./install-zsh.sh >> install.log 2>&1
17
+
18
+ echo " Installing conda python."
19
+ source ./install-conda.sh >> install.log 2>&1
20
+
21
+ echo " Installing POCS software."
22
+ source ./install-pocs.sh >> install.log 2>&1
23
+
24
+ echo " Installing services so things run at startup."
25
+ source ./install-services.sh >> install.log 2>&1
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # Set up passwordless sudo for all sudo group.
4
+ echo " %sudo ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/panoptes
5
+
6
+ # Add an SSH key if one doesn't exist.
7
+ if [[ ! -f " ${HOME} /.ssh/id_rsa" ]]; then
8
+ echo " Adding ssh key"
9
+ ssh-keygen -t rsa -N " " -f " ${HOME} /.ssh/id_rsa"
10
+ fi
You can’t perform that action at this time.
0 commit comments