Skip to content

Commit

Permalink
fix: error handling while creating adn deleting folders
Browse files Browse the repository at this point in the history
Signed-off-by: Jefferson <[email protected]>
  • Loading branch information
Jefferson authored and riosje committed Jul 2, 2024
1 parent 83867e0 commit 6907b1f
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 24 deletions.
9 changes: 6 additions & 3 deletions scripts/deb/script_generator/base_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 52,12 @@ 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
if ! mkdir -p /usr/share/keyrings; then
handle_error "$?" "Makes sure the path /usr/share/keyrings exist or run ' mkdir -p /usr/share/keyrings' with sudo"
fi

rm -f /usr/share/keyrings/nodesource.gpg || true
rm -f /etc/apt/sources.list.d/nodesource.list || true

# 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
Expand Down
9 changes: 6 additions & 3 deletions scripts/deb/setup_16.x
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 123,12 @@ 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
if ! mkdir -p /usr/share/keyrings; then
handle_error "$?" "Makes sure the path /usr/share/keyrings exist or run 'mkdir -p /usr/share/keyrings' with sudo"
fi

rm -f /usr/share/keyrings/nodesource.gpg || true
rm -f /etc/apt/sources.list.d/nodesource.list || true

# 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
Expand Down
9 changes: 6 additions & 3 deletions scripts/deb/setup_18.x
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 52,12 @@ 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
if ! mkdir -p /usr/share/keyrings; then
handle_error "$?" "Makes sure the path /usr/share/keyrings exist or run ' mkdir -p /usr/share/keyrings' with sudo"
fi

rm -f /usr/share/keyrings/nodesource.gpg || true
rm -f /etc/apt/sources.list.d/nodesource.list || true

# 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
Expand Down
9 changes: 6 additions & 3 deletions scripts/deb/setup_20.x
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 52,12 @@ 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
if ! mkdir -p /usr/share/keyrings; then
handle_error "$?" "Makes sure the path /usr/share/keyrings exist or run ' mkdir -p /usr/share/keyrings' with sudo"
fi

rm -f /usr/share/keyrings/nodesource.gpg || true
rm -f /etc/apt/sources.list.d/nodesource.list || true

# 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
Expand Down
9 changes: 6 additions & 3 deletions scripts/deb/setup_21.x
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 52,12 @@ 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
if ! mkdir -p /usr/share/keyrings; then
handle_error "$?" "Makes sure the path /usr/share/keyrings exist or run ' mkdir -p /usr/share/keyrings' with sudo"
fi

rm -f /usr/share/keyrings/nodesource.gpg || true
rm -f /etc/apt/sources.list.d/nodesource.list || true

# 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
Expand Down
9 changes: 6 additions & 3 deletions scripts/deb/setup_22.x
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 52,12 @@ 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
if ! mkdir -p /usr/share/keyrings; then
handle_error "$?" "Makes sure the path /usr/share/keyrings exist or run ' mkdir -p /usr/share/keyrings' with sudo"
fi

rm -f /usr/share/keyrings/nodesource.gpg || true
rm -f /etc/apt/sources.list.d/nodesource.list || true

# 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
Expand Down
9 changes: 6 additions & 3 deletions scripts/deb/setup_current.x
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 52,12 @@ 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
if ! mkdir -p /usr/share/keyrings; then
handle_error "$?" "Makes sure the path /usr/share/keyrings exist or run ' mkdir -p /usr/share/keyrings' with sudo"
fi

rm -f /usr/share/keyrings/nodesource.gpg || true
rm -f /etc/apt/sources.list.d/nodesource.list || true

# 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
Expand Down
9 changes: 6 additions & 3 deletions scripts/deb/setup_lts.x
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 52,12 @@ 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
if ! mkdir -p /usr/share/keyrings; then
handle_error "$?" "Makes sure the path /usr/share/keyrings exist or run ' mkdir -p /usr/share/keyrings' with sudo"
fi

rm -f /usr/share/keyrings/nodesource.gpg || true
rm -f /etc/apt/sources.list.d/nodesource.list || true

# 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
Expand Down

0 comments on commit 6907b1f

Please sign in to comment.