Skip to content
Open
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
38 changes: 31 additions & 7 deletions scripts/deb/setup_18.x
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ check_os() {
fi
}

# Get release version
version=$(lsb_release -rs)

# min Ubuntu version for proper gpg key placement
ubuntu_min_version="22.04"

if [[ "$(lsb_release -si)" == "Ubuntu" && "$(echo "$version >= $ubuntu_min_version" | bc)" -eq 1 ]]; then
gpgkeypath="/etc/apt/trusted.gpg.d"
else
gpgkeypath="/usr/share/keyrings"
fi

# Function to Install the script pre-requisites
install_pre_reqs() {
log "Installing pre-requisites" "info"
Expand All @@ -52,12 +64,24 @@ install_pre_reqs() {
handle_error "$?" "Failed to install packages"
fi

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[40,41]+# Get release version [40,42]+version=$(lsb_release -rs) [40,43]+ [40,44]+# min Ubuntu version for proper gpg key placement [40,45]+ubuntu_min_version="22.04" [40,46]+ [40,47]+if [[ "$(lsb_release -si)" == "Ubuntu" && "$(echo "$version >= $ubuntu_min_version" | bc)" -eq 1 ]]; then [40,48]+ gpgkeypath="/etc/apt/trusted.gpg.d" [40,49]+else [40,50]+ gpgkeypath="/usr/share/keyrings" [40,51]+fi


mkdir -p /usr/share/keyrings
rm -f /usr/share/keyrings/nodesource.gpg
rm -f /etc/apt/sources.list.d/nodesource.list

# Check if the OS type is Ubuntu and the version is above 22.04
if [[ "$(lsb_release -si)" == "Ubuntu" && "$(echo "$version >= $ubuntu_min_version" | bc)" -eq 1 ]]; then
# Check if the folder /etc/apt/trusted.gpg.d exists
if [[ -d "$gpgkeypath" ]]; then
rm -f $gpgkeypath/nodesource.gpg
rm -f /etc/apt/sources.list.d/nodesource.list
else
echo "Error: OS identified as Ubuntu 22.04+ and folder /etc/apt/trusted.gpg.d should exist and does not."
exit 1
fi
else
mkdir -p $gpgkeypath
rm -f $gpgkeypath/nodesource.gpg
rm -f /etc/apt/sources.list.d/nodesource.list
fi

# Run 'curl' and 'gpg'
if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then
if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o $gpgkeypath/nodesource.gpg; then
handle_error "$?" "Failed to download and import the NodeSource signing key"
fi
}
Expand All @@ -71,8 +95,8 @@ configure_repo() {
handle_error "1" "Unsupported architecture: $arch. Only amd64, arm64, and armhf are supported."
fi

echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null

echo "deb [arch=$arch signed-by=$gpgkeypath/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null
# N|solid Config
echo "Package: nsolid" | tee /etc/apt/preferences.d/nsolid > /dev/null
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nsolid > /dev/null
Expand Down
38 changes: 31 additions & 7 deletions scripts/deb/setup_20.x
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ check_os() {
fi
}

# Get release version
version=$(lsb_release -rs)

# min Ubuntu version for proper gpg key placement
ubuntu_min_version="22.04"

if [[ "$(lsb_release -si)" == "Ubuntu" && "$(echo "$version >= $ubuntu_min_version" | bc)" -eq 1 ]]; then
gpgkeypath="/etc/apt/trusted.gpg.d"
else
gpgkeypath="/usr/share/keyrings"
fi

# Function to Install the script pre-requisites
install_pre_reqs() {
log "Installing pre-requisites" "info"
Expand All @@ -52,12 +64,24 @@ install_pre_reqs() {
handle_error "$?" "Failed to install packages"
fi

mkdir -p /usr/share/keyrings
rm -f /usr/share/keyrings/nodesource.gpg
rm -f /etc/apt/sources.list.d/nodesource.list

# Check if the OS type is Ubuntu and the version is above 22.04
if [[ "$(lsb_release -si)" == "Ubuntu" && "$(echo "$version >= $ubuntu_min_version" | bc)" -eq 1 ]]; then
# Check if the folder /etc/apt/trusted.gpg.d exists
if [[ -d "$gpgkeypath" ]]; then
rm -f $gpgkeypath/nodesource.gpg
rm -f /etc/apt/sources.list.d/nodesource.list
else
echo "Error: OS identified as Ubuntu 22.04+ and folder /etc/apt/trusted.gpg.d should exist and does not."
exit 1
fi
else
mkdir -p $gpgkeypath
rm -f $gpgkeypath/nodesource.gpg
rm -f /etc/apt/sources.list.d/nodesource.list
fi

# Run 'curl' and 'gpg'
if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then
if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o $gpgkeypath/nodesource.gpg; then
handle_error "$?" "Failed to download and import the NodeSource signing key"
fi
}
Expand All @@ -70,8 +94,8 @@ configure_repo() {
if [ "$arch" != "amd64" ] && [ "$arch" != "arm64" ] && [ "$arch" != "armhf" ]; then
handle_error "1" "Unsupported architecture: $arch. Only amd64, arm64, and armhf are supported."
fi

echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null
echo "deb [arch=$arch signed-by=$gpgkeypath/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null

# N|solid Config
echo "Package: nsolid" | tee /etc/apt/preferences.d/nsolid > /dev/null
Expand Down
36 changes: 30 additions & 6 deletions scripts/deb/setup_21.x
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ check_os() {
fi
}

# Get release version
version=$(lsb_release -rs)

# min Ubuntu version for proper gpg key placement
ubuntu_min_version="22.04"

if [[ "$(lsb_release -si)" == "Ubuntu" && "$(echo "$version >= $ubuntu_min_version" | bc)" -eq 1 ]]; then
gpgkeypath="/etc/apt/trusted.gpg.d"
else
gpgkeypath="/usr/share/keyrings"
fi

# Function to Install the script pre-requisites
install_pre_reqs() {
log "Installing pre-requisites" "info"
Expand All @@ -52,12 +64,24 @@ install_pre_reqs() {
handle_error "$?" "Failed to install packages"
fi

mkdir -p /usr/share/keyrings
rm -f /usr/share/keyrings/nodesource.gpg
rm -f /etc/apt/sources.list.d/nodesource.list

# Check if the OS type is Ubuntu and the version is above 22.04
if [[ "$(lsb_release -si)" == "Ubuntu" && "$(echo "$version >= $ubuntu_min_version" | bc)" -eq 1 ]]; then
# Check if the folder /etc/apt/trusted.gpg.d exists
if [[ -d "$gpgkeypath" ]]; then
rm -f $gpgkeypath/nodesource.gpg
rm -f /etc/apt/sources.list.d/nodesource.list
else
echo "Error: OS identified as Ubuntu 22.04+ and folder /etc/apt/trusted.gpg.d should exist and does not."
exit 1
fi
else
mkdir -p $gpgkeypath
rm -f $gpgkeypath/nodesource.gpg
rm -f /etc/apt/sources.list.d/nodesource.list
fi

# Run 'curl' and 'gpg'
if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then
if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o $gpgkeypath/nodesource.gpg; then
handle_error "$?" "Failed to download and import the NodeSource signing key"
fi
}
Expand All @@ -71,7 +95,7 @@ configure_repo() {
handle_error "1" "Unsupported architecture: $arch. Only amd64, arm64, and armhf are supported."
fi

echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null
echo "deb [arch=$arch signed-by=$gpgkeypath/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null

# N|solid Config
echo "Package: nsolid" | tee /etc/apt/preferences.d/nsolid > /dev/null
Expand Down
38 changes: 31 additions & 7 deletions scripts/deb/setup_current.x
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ check_os() {
fi
}

# Get release version
version=$(lsb_release -rs)

# min Ubuntu version for proper gpg key placement
ubuntu_min_version="22.04"

if [[ "$(lsb_release -si)" == "Ubuntu" && "$(echo "$version >= $ubuntu_min_version" | bc)" -eq 1 ]]; then
gpgkeypath="/etc/apt/trusted.gpg.d"
else
gpgkeypath="/usr/share/keyrings"
fi

# Function to Install the script pre-requisites
install_pre_reqs() {
log "Installing pre-requisites" "info"
Expand All @@ -52,12 +64,24 @@ install_pre_reqs() {
handle_error "$?" "Failed to install packages"
fi

mkdir -p /usr/share/keyrings
rm -f /usr/share/keyrings/nodesource.gpg
rm -f /etc/apt/sources.list.d/nodesource.list

# Check if the OS type is Ubuntu and the version is above 22.04
if [[ "$(lsb_release -si)" == "Ubuntu" && "$(echo "$version >= $ubuntu_min_version" | bc)" -eq 1 ]]; then
# Check if the folder /etc/apt/trusted.gpg.d exists
if [[ -d "$gpgkeypath" ]]; then
rm -f $gpgkeypath/nodesource.gpg
rm -f /etc/apt/sources.list.d/nodesource.list
else
echo "Error: OS identified as Ubuntu 22.04+ and folder /etc/apt/trusted.gpg.d should exist and does not."
exit 1
fi
else
mkdir -p $gpgkeypath
rm -f $gpgkeypath/nodesource.gpg
rm -f /etc/apt/sources.list.d/nodesource.list
fi

# Run 'curl' and 'gpg'
if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then
if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o $gpgkeypath/nodesource.gpg; then
handle_error "$?" "Failed to download and import the NodeSource signing key"
fi
}
Expand All @@ -70,8 +94,8 @@ configure_repo() {
if [ "$arch" != "amd64" ] && [ "$arch" != "arm64" ] && [ "$arch" != "armhf" ]; then
handle_error "1" "Unsupported architecture: $arch. Only amd64, arm64, and armhf are supported."
fi

echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null
echo "deb [arch=$arch signed-by=$gpgkeypath/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null

# N|solid Config
echo "Package: nsolid" | tee /etc/apt/preferences.d/nsolid > /dev/null
Expand Down
38 changes: 31 additions & 7 deletions scripts/deb/setup_lts.x
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ check_os() {
fi
}

# Get release version
version=$(lsb_release -rs)

# min Ubuntu version for proper gpg key placement
ubuntu_min_version="22.04"

if [[ "$(lsb_release -si)" == "Ubuntu" && "$(echo "$version >= $ubuntu_min_version" | bc)" -eq 1 ]]; then
gpgkeypath="/etc/apt/trusted.gpg.d"
else
gpgkeypath="/usr/share/keyrings"
fi

# Function to Install the script pre-requisites
install_pre_reqs() {
log "Installing pre-requisites" "info"
Expand All @@ -52,12 +64,24 @@ install_pre_reqs() {
handle_error "$?" "Failed to install packages"
fi

mkdir -p /usr/share/keyrings
rm -f /usr/share/keyrings/nodesource.gpg
rm -f /etc/apt/sources.list.d/nodesource.list

# Check if the OS type is Ubuntu and the version is above 22.04
if [[ "$(lsb_release -si)" == "Ubuntu" && "$(echo "$version >= $ubuntu_min_version" | bc)" -eq 1 ]]; then
# Check if the folder /etc/apt/trusted.gpg.d exists
if [[ -d "$gpgkeypath" ]]; then
rm -f $gpgkeypath/nodesource.gpg
rm -f /etc/apt/sources.list.d/nodesource.list
else
echo "Error: OS identified as Ubuntu 22.04+ and folder /etc/apt/trusted.gpg.d should exist and does not."
exit 1
fi
else
mkdir -p $gpgkeypath
rm -f $gpgkeypath/nodesource.gpg
rm -f /etc/apt/sources.list.d/nodesource.list
fi

# Run 'curl' and 'gpg'
if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then
if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o $gpgkeypath/nodesource.gpg; then
handle_error "$?" "Failed to download and import the NodeSource signing key"
fi
}
Expand All @@ -71,8 +95,8 @@ configure_repo() {
handle_error "1" "Unsupported architecture: $arch. Only amd64, arm64, and armhf are supported."
fi

echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null

echo "deb [arch=$arch signed-by=$gpgkeypath/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null
# N|solid Config
echo "Package: nsolid" | tee /etc/apt/preferences.d/nsolid > /dev/null
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nsolid > /dev/null
Expand Down