diff --git a/ct/cronicle.sh b/ct/cronicle.sh index f5227c32..0f9dee7d 100644 --- a/ct/cronicle.sh +++ b/ct/cronicle.sh @@ -75,13 +75,7 @@ apt-get install -y g++ &>/dev/null apt-get install -y gcc &>/dev/null msg_ok "Installed Dependencies" -msg_info "Setting up Node.js Repository" -bash <(curl -fsSL https://deb.nodesource.com/setup_16.x) &>/dev/null -msg_ok "Set up Node.js Repository" - -msg_info "Installing Node.js" -apt-get install -y nodejs &>/dev/null -msg_ok "Installed Node.js" +install_nodejs 16 msg_info "Installing Cronicle Worker" mkdir -p /opt/cronicle diff --git a/install/changedetection-install.sh b/install/changedetection-install.sh index 1ff0af91..4836a5f0 100644 --- a/install/changedetection-install.sh +++ b/install/changedetection-install.sh @@ -53,15 +53,7 @@ $STD apt-get install -y \ python3-pip msg_ok "Updated Python3" -msg_info "Setting up Node.js Repository" -curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg -echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" >/etc/apt/sources.list.d/nodesource.list -msg_ok "Set up Node.js Repository" - -msg_info "Installing Node.js" -$STD apt-get update -$STD apt-get install -y nodejs -msg_ok "Installed Node.js" +install_nodejs 18 msg_info "Installing Change Detection" mkdir /opt/changedetection diff --git a/install/homarr-install.sh b/install/homarr-install.sh index 54725ee5..4389333e 100644 --- a/install/homarr-install.sh +++ b/install/homarr-install.sh @@ -20,13 +20,7 @@ $STD apt-get install -y mc $STD apt-get install -y git msg_ok "Installed Dependencies" -msg_info "Setting up Node.js Repository" -$STD bash <(curl -fsSL https://deb.nodesource.com/setup_18.x) -msg_ok "Set up Node.js Repository" - -msg_info "Installing Node.js" -$STD apt-get install -y nodejs -msg_ok "Installed Node.js" +install_nodejs 18 msg_info "Installing Yarn" $STD npm install -g yarn diff --git a/install/homepage-install.sh b/install/homepage-install.sh index f0c221e5..0164d477 100644 --- a/install/homepage-install.sh +++ b/install/homepage-install.sh @@ -18,16 +18,16 @@ $STD apt-get install -y curl $STD apt-get install -y sudo $STD apt-get install -y mc $STD apt-get install -y git +$STD apt-get install -y make +$STD apt-get install -y g++ +$STD apt-get install -y gcc msg_ok "Installed Dependencies" -msg_info "Setting up Node.js Repository" -$STD bash <(curl -fsSL https://deb.nodesource.com/setup_18.x) -msg_ok "Set up Node.js Repository" +install_nodejs 18 -msg_info "Installing Node.js" -$STD apt-get install -y nodejs git make g++ gcc +msg_info "Installing pnpm" $STD npm install -g pnpm -msg_ok "Installed Node.js" +msg_ok "Installed pnpm" msg_info "Installing Homepage (Patience)" cd /opt diff --git a/install/jellyseerr-install.sh b/install/jellyseerr-install.sh index 06803fc0..a06d2772 100644 --- a/install/jellyseerr-install.sh +++ b/install/jellyseerr-install.sh @@ -20,13 +20,7 @@ $STD apt-get install -y mc $STD apt-get install -y git msg_ok "Installed Dependencies" -msg_info "Setting up Node.js Repository" -$STD bash <(curl -fsSL https://deb.nodesource.com/setup_18.x) -msg_ok "Set up Node.js Repository" - -msg_info "Installing Node.js" -$STD apt-get install -y nodejs -msg_ok "Installed Node.js" +install_nodejs 18 msg_info "Installing Yarn" $STD npm install -g yarn diff --git a/install/n8n-install.sh b/install/n8n-install.sh index 6f36c40b..89f70e58 100644 --- a/install/n8n-install.sh +++ b/install/n8n-install.sh @@ -19,13 +19,7 @@ $STD apt-get install -y sudo $STD apt-get install -y mc msg_ok "Installed Dependencies" -msg_info "Setting up Node.js Repository" -$STD bash <(curl -fsSL https://deb.nodesource.com/setup_18.x) -msg_ok "Set up Node.js Repository" - -msg_info "Installing Node.js" -$STD apt-get install -y nodejs -msg_ok "Installed Node.js" +install_nodejs 18 msg_info "Installing n8n (Patience)" $STD npm install --global n8n diff --git a/install/node-red-install.sh b/install/node-red-install.sh index b9ca4fd3..e10c03bf 100644 --- a/install/node-red-install.sh +++ b/install/node-red-install.sh @@ -20,13 +20,7 @@ $STD apt-get install -y mc $STD apt-get install -y git msg_ok "Installed Dependencies" -msg_info "Setting up Node.js Repository" -$STD bash <(curl -fsSL https://deb.nodesource.com/setup_18.x) -msg_ok "Set up Node.js Repository" - -msg_info "Installing Node.js" -$STD apt-get install -y nodejs -msg_ok "Installed Node.js" +install_nodejs 18 msg_info "Installing Node-Red" $STD npm install -g --unsafe-perm node-red diff --git a/install/overseerr-install.sh b/install/overseerr-install.sh index bb62febe..b2f580c3 100644 --- a/install/overseerr-install.sh +++ b/install/overseerr-install.sh @@ -20,13 +20,7 @@ $STD apt-get install -y mc $STD apt-get install -y git msg_ok "Installed Dependencies" -msg_info "Setting up Node.js Repository" -$STD bash <(curl -fsSL https://deb.nodesource.com/setup_18.x) -msg_ok "Set up Node.js Repository" - -msg_info "Installing Node.js" -$STD apt-get install -y nodejs -msg_ok "Installed Node.js" +install_nodejs 18 msg_info "Installing Yarn" $STD npm install -g yarn diff --git a/install/photoprism-install.sh b/install/photoprism-install.sh index 64f303b6..fb0b0e2c 100644 --- a/install/photoprism-install.sh +++ b/install/photoprism-install.sh @@ -28,13 +28,7 @@ $STD apt-get install -y ffmpeg $STD apt-get install -y libheif1 msg_ok "Installed Dependencies" -msg_info "Setting up Node.js Repository" -$STD bash <(curl -fsSL https://deb.nodesource.com/setup_18.x) -msg_ok "Set up Node.js Repository" - -msg_info "Installing Node.js" -$STD apt-get -y install nodejs -msg_ok "Installed Node.js" +install_nodejs 18 msg_info "Installing Golang" set +o pipefail diff --git a/install/scrypted-install.sh b/install/scrypted-install.sh index b8707308..96f6b2f7 100644 --- a/install/scrypted-install.sh +++ b/install/scrypted-install.sh @@ -62,13 +62,7 @@ $STD apt-get -y install \ gstreamer1.0-alsa msg_ok "Installed GStreamer" -msg_info "Setting up Node.js Repository" -$STD bash <(curl -fsSL https://deb.nodesource.com/setup_18.x) -msg_ok "Set up Node.js Repository" - -msg_info "Installing Node.js" -$STD apt-get install -y nodejs -msg_ok "Installed Node.js" +install_nodejs 18 msg_info "Updating Python3" $STD apt-get install -y \ diff --git a/install/shinobi-install.sh b/install/shinobi-install.sh index 3d8801dd..73379865 100644 --- a/install/shinobi-install.sh +++ b/install/shinobi-install.sh @@ -28,13 +28,7 @@ $STD apt-get install -y make zip net-tools $STD apt-get install -y gcc g++ cmake msg_ok "Installed Dependencies" -msg_info "Setting up Node.js Repository" -$STD bash <(curl -fsSL https://deb.nodesource.com/setup_18.x) -msg_ok "Set up Node.js Repository" - -msg_info "Installing Node.js" -$STD apt-get install -y nodejs -msg_ok "Installed Node.js" +install_nodejs 18 msg_info "Installing FFMPEG" $STD apt-get install -y ffmpeg diff --git a/install/uptimekuma-install.sh b/install/uptimekuma-install.sh index c78a890e..f95673d4 100644 --- a/install/uptimekuma-install.sh +++ b/install/uptimekuma-install.sh @@ -20,13 +20,7 @@ $STD apt-get install -y mc $STD apt-get install -y git msg_ok "Installed Dependencies" -msg_info "Setting up Node.js Repository" -$STD bash <(curl -fsSL https://deb.nodesource.com/setup_18.x) -msg_ok "Set up Node.js Repository" - -msg_info "Installing Node.js" -$STD sudo apt-get install -y nodejs -msg_ok "Installed Node.js" +install_nodejs 18 msg_info "Installing Uptime Kuma" $STD git clone https://github.com/louislam/uptime-kuma.git diff --git a/install/wikijs-install.sh b/install/wikijs-install.sh index 32152da6..193e36ac 100644 --- a/install/wikijs-install.sh +++ b/install/wikijs-install.sh @@ -20,13 +20,7 @@ $STD apt-get install -y mc $STD apt-get install -y git msg_ok "Installed Dependencies" -msg_info "Setting up Node.js Repository" -$STD bash <(curl -fsSL https://deb.nodesource.com/setup_16.x) -msg_ok "Set up Node.js Repository" - -msg_info "Installing Node.js" -$STD apt-get install -y nodejs -msg_ok "Installed Node.js" +install_nodejs 16 msg_info "Installing Wiki.js" mkdir -p /opt/wikijs diff --git a/install/zigbee2mqtt-install.sh b/install/zigbee2mqtt-install.sh index 151d028b..9ce18920 100644 --- a/install/zigbee2mqtt-install.sh +++ b/install/zigbee2mqtt-install.sh @@ -23,13 +23,7 @@ $STD apt-get install -y g++ $STD apt-get install -y gcc msg_ok "Installed Dependencies" -msg_info "Setting up Node.js Repository" -$STD bash <(curl -fsSL https://deb.nodesource.com/setup_18.x) -msg_ok "Set up Node.js Repository" - -msg_info "Installing Node.js" -$STD apt-get install -y nodejs -msg_ok "Installed Node.js" +install_nodejs 18 msg_info "Setting up Zigbee2MQTT Repository" $STD git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt diff --git a/misc/install.func b/misc/install.func index 24fd8533..2569e592 100644 --- a/misc/install.func +++ b/misc/install.func @@ -117,6 +117,22 @@ update_os() { msg_ok "Updated Container OS" } +# This function sets up the Node.js repository and installs Node.js +# Takes one argument: the Node.js version to install +install_nodejs() { + local NODE_VERSION="$1" + msg_info "Setting up Node.js Repository" + $STD apt-get install -y ca-certificates curl gnupg + $STD mkdir -p /etc/apt/keyrings + $STD curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg + $STD echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_VERSION}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list + $STD apt-get update + msg_ok "Set up Node.js Repository" + msg_info "Installing Node.js" + $STD apt-get install -y nodejs + msg_ok "Installed Node.js" +} + # This function modifies the message of the day (motd) and SSH settings motd_ssh() { echo "export TERM='xterm-256color'" >>/root/.bashrc