@@ -6,7 +6,6 @@ DAPPNODE_DIR="/usr/src/dappnode"
66LOGS_DIR=" $DAPPNODE_DIR /logs"
77lsb_dist=" $( . /etc/os-release && echo " $ID " ) "
88
9-
109#! ISOBUILD Do not modify, variables above imported for ISO build
1110
1211detect_installation_type () {
@@ -20,24 +19,23 @@ detect_installation_type() {
2019 fi
2120}
2221
23-
2422add_docker_repo () {
2523 apt-get update -y
2624 apt-get remove -y docker docker-engine docker.io containerd runc | tee -a $LOG_FILE
2725 apt-get install -y ca-certificates curl gnupg lsb-release | tee -a $LOG_FILE
2826 mkdir -p /etc/apt/keyrings && chmod -R 0755 /etc/apt/keyrings
2927 curl -fsSL " https://download.docker.com/linux/${lsb_dist} /gpg" | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg
3028 chmod a+r /etc/apt/keyrings/docker.gpg
31- echo " deb [arch=$( dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$lsb_dist $( lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
29+ echo " deb [arch=$( dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$lsb_dist $( lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
3230}
3331
3432# DOCKER INSTALLATION
3533install_docker () {
3634 apt-get update -y
37- apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin | tee -a $LOG_FILE
35+ apt-get install -y docker-ce docker-ce-cli containerd.io | tee -a $LOG_FILE
3836
3937 # Ensure xz is installed
40- [ -f " /usr/bin/xz" ] || ( apt-get install -y xz-utils)
38+ [ -f " /usr/bin/xz" ] || (apt-get install -y xz-utils)
4139
4240 USER=$( grep 1000 " /etc/passwd" | cut -f 1 -d:)
4341 [ -z " $USER " ] || usermod -aG docker " $USER "
@@ -56,50 +54,50 @@ install_docker() {
5654
5755# DOCKER-COMPOSE FOR LEGACY SCRIPTS, SHOULD BE REMOVED EVENTUALLY
5856alias_docker_compose () {
59- cat > /usr/local/bin/docker-compose<< EOL
57+ cat > /usr/local/bin/docker-compose << EOL
6058#!/bin/bash
6159docker compose "\$ @"
6260EOL
6361 chmod +x /usr/local/bin/docker-compose
6462}
6563
66- # WIREGUARD INSTALLATION
64+ # WIREGUARD INSTALLATION
6765install_wireguard_dkms () {
6866 apt-get update -y
6967
7068 apt-get install wireguard-dkms -y | tee -a $LOG_FILE
7169
72- if modprobe wireguard > /dev/null 2>&1 ; then
70+ if modprobe wireguard > /dev/null 2>&1 ; then
7371 echo -e " \e[32m \n\n Verified wiregurd-dkms installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
7472 else
7573 echo -e " \e[31m \n\n WARNING: wireguard kernel module is not installed, Wireguard DAppNode package might not work! \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
7674 fi
7775}
7876
79- # LSOF INSTALLATION: used to scan host port 80 in use, https package installation will deppend on it
77+ # LSOF INSTALLATION: used to scan host port 80 in use, https package installation will deppend on it
8078install_lsof () {
8179 apt-get update -y
8280 apt-get install lsof -y | tee -a $LOG_FILE
83- if lsof -v > /dev/null 2>&1 ; then
81+ if lsof -v > /dev/null 2>&1 ; then
8482 echo -e " \e[32m \n\n Verified lsof installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
8583 else
8684 echo -e " \e[31m \n\n WARNING: lsof not installed, HTTPS DAppNode package might not be installed! \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
8785 fi
8886}
8987
9088# IPTABLES INSTALLATION: mandatory for docker, on bullseye is not installed by default
91- install_iptables () {
89+ install_iptables () {
9290 apt-get update -y
9391 apt-get install iptables -y | tee -a $LOG_FILE
94- if iptables -v > /dev/null 2>&1 ; then
92+ if iptables -v > /dev/null 2>&1 ; then
9593 echo -e " \e[32m \n\n Verified iptables installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
9694 else
9795 echo -e " \e[31m \n\n WARNING: iptables not installed, Docker may not work! \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
9896 fi
9997}
10098
10199# HOST UPDATE
102- host_update () {
100+ host_update () {
103101 apt-get update 2>&1 | tee -a $LOG_FILE
104102 apt-get -y upgrade 2>&1 | tee -a $LOG_FILE
105103}
@@ -122,8 +120,7 @@ if [ "$1" == "UPDATE" ]; then
122120 host_update 2>&1 | tee -a $LOG_FILE
123121fi
124122
125-
126- if find /etc/apt/ -name " *.list" -print0 | xargs --null cat | grep -q " https://download.docker.com/linux/$lsb_dist " ; then
123+ if find /etc/apt/ -name " *.list" -print0 | xargs --null cat | grep -q " https://download.docker.com/linux/$lsb_dist " ; then
127124 echo -e " \e[32m \n\n docker repo is already added \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
128125else
129126 add_docker_repo | tee -a $LOG_FILE
@@ -136,15 +133,8 @@ else
136133 install_docker 2>&1 | tee -a $LOG_FILE
137134fi
138135
139- # Only install docker-compose if needed
140- if docker-compose -v > /dev/null 2>&1 ; then
141- echo -e " \e[32m \n\n docker-compose is already aliased \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
142- else
143- alias_docker_compose 2>&1 | tee -a $LOG_FILE
144- fi
145-
146136# Only install wireguard-dkms if needed
147- if modprobe wireguard > /dev/null 2>&1 ; then
137+ if modprobe wireguard > /dev/null 2>&1 ; then
148138 echo -e " \e[32m \n\n wireguard-dkms is already installed \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
149139else
150140 install_wireguard_dkms 2>&1 | tee -a $LOG_FILE
@@ -158,15 +148,22 @@ else
158148fi
159149
160150# Check connectivity
161- { [ -f /etc/network/interfaces ] && grep " iface en.* inet dhcp" /etc/network/interfaces & > /dev/null; } || { echo " Interfaces not found" ; exit 1; }
151+ { [ -f /etc/network/interfaces ] && grep " iface en.* inet dhcp" /etc/network/interfaces & > /dev/null; } || {
152+ echo " Interfaces not found"
153+ exit 1
154+ }
162155
163156# # Add missing interfaces
164157if [ -f /usr/src/dappnode/hotplug ]; then
165158 # shellcheck disable=SC2013
166159 for IFACE in $( grep " en.*" /usr/src/dappnode/hotplug) ; do
167160 # shellcheck disable=SC2143
168161 if [[ $( grep -L " $IFACE " /etc/network/interfaces) ]]; then
169- { echo " # $IFACE " ; echo " allow-hotplug $IFACE " ; echo " iface $IFACE inet dhcp" ; } >> /etc/network/interfaces
162+ {
163+ echo " # $IFACE "
164+ echo " allow-hotplug $IFACE "
165+ echo " iface $IFACE inet dhcp"
166+ } >> /etc/network/interfaces
170167 fi
171168 done
172169fi
0 commit comments