Skip to content
This repository was archived by the owner on Nov 11, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
sudo /bin/bash ./test/environment_setup.sh
- name: install prerrequisites
run: |
sudo /bin/bash ./scripts/dappnode_install_pre.sh
sudo /bin/bash ./scripts/dappnode_install_pre.sh UPDATE
- name: Install DAppNode
run: |
sudo /bin/bash ./scripts/dappnode_install.sh
Expand Down
5 changes: 1 addition & 4 deletions iso/preseeds/preseed.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,4 @@ d-i preseed/late_command string \
in-target chmod +x /usr/local/bin/docker-compose; \
in-target gpasswd -a $(getent passwd "1000" | cut -d: -f1) sudo; \
/target/usr/src/dappnode/scripts/static_ip.sh; \
# Deep host update
in-target apt-get update ; \
in-target apt-get -y upgrade ; \
in-target /usr/src/dappnode/scripts/dappnode_install_pre.sh
in-target /usr/src/dappnode/scripts/dappnode_install_pre.sh UPDATE
5 changes: 1 addition & 4 deletions iso/preseeds/preseed_unattended.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,5 @@ d-i preseed/late_command string \
in-target chmod +x /usr/src/dappnode/scripts/dappnode_install_pre.sh; \
in-target chmod +x /usr/local/bin/docker-compose; \
in-target touch /usr/src/dappnode/.firstboot; \
# Deep host update
in-target apt-get update ; \
in-target apt-get -y upgrade ; \
in-target /usr/src/dappnode/scripts/dappnode_install_pre.sh
in-target /usr/src/dappnode/scripts/dappnode_install_pre.sh UPDATE
d-i finish-install/reboot_in_progress note
32 changes: 18 additions & 14 deletions scripts/dappnode_install_pre.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

# Execute script with flag UPDATE to update the host: ./dappnode_install_pre.sh UPDATE

DAPPNODE_DIR="/usr/src/dappnode"
LOGS_DIR="$DAPPNODE_DIR/logs"
DOCKER_PKG="docker-ce_20.10.6~3-0~debian-bullseye_amd64.deb"
Expand Down Expand Up @@ -29,11 +31,8 @@ detect_installation_type() {
fi
}

# DOCKER INSTALLATION
install_docker() {
##############################################
#### DOCKER INSTALLATION ####
##############################################

# STEP 0: Detect if it's a Debian 9 (stretch) or Debian 10 (Buster) installation
# ----------------------------------------
if [ -f "/etc/os-release" ] && grep -q "buster" "/etc/os-release"; then
Expand Down Expand Up @@ -90,11 +89,8 @@ install_docker() {
fi
}

# DOCKER COMPOSE INSTALLATION
install_docker_compose() {
##############################################
#### DOCKER COMPOSE INSTALLATION ####
##############################################

# STEP 0: Declare paths and directories
# ----------------------------------------

Expand All @@ -120,10 +116,8 @@ install_docker_compose() {
fi
}

# WIREGUARD INSTALLATION
install_wireguard_dkms() {
##############################################
#### WIREGUARD INSTALLATION ####
##############################################
apt-get update -y
if [ -f "/etc/os-release" ] && grep -q "buster" "/etc/os-release"; then
echo "deb http://deb.debian.org/debian/ buster-backports main" > /etc/apt/sources.list.d/buster-backports.list
Expand All @@ -139,10 +133,8 @@ install_wireguard_dkms() {
fi
}

# LSOF INSTALLATION
install_lsof() {
##############################################
#### LSOF INSTALLATION ####
##############################################
apt-get update -y
apt-get install lsof -y | tee -a $LOG_FILE
if lsof -v >/dev/null 2>&1 ; then
Expand All @@ -152,6 +144,12 @@ install_lsof() {
fi
}

# HOST UPDATE
host_update () {
apt-get update 2>&1 | tee -a $LOG_FILE
apt-get -y upgrade 2>&1 | tee -a $LOG_FILE
}

##############################################
#### SCRIPT START ####
##############################################
Expand All @@ -165,6 +163,12 @@ mkdir -p "$(dirname "$DOCKER_PATH")"

touch $LOG_FILE

# Only update && upgrade host if needed
if [ "$1" == "UPDATE" ]; then
echo -e "\e[32m \n\n Updating && upgrading host \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
host_update 2>&1 | tee -a $LOG_FILE
fi

# Only install docker if needed
if docker -v >/dev/null 2>&1; then
echo -e "\e[32m \n\n docker is already installed \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
Expand Down