Skip to content

Commit 6736af6

Browse files
committed
fix(deb): use apt-get instead of apt in setup scripts
apt is meant for interactive use and prints "WARNING: apt does not have a stable CLI interface" when run from a script. apt-get is the stable interface for scripts. Change base_script.sh, regenerate the scripts with generator.sh, and apply the same change to setup_16/18/21/23.x, which the generator no longer produces. The install hints shown to users keep suggesting apt.
1 parent 9b431d8 commit 6736af6

12 files changed

Lines changed: 96 additions & 96 deletions

File tree

‎scripts/deb/script_generator/base_script.sh‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ check_os() {
4242
install_pre_reqs() {
4343
log "Installing pre-requisites" "info"
4444

45-
# Run 'apt update'
46-
if ! apt update -y; then
47-
handle_error "$?" "Failed to run 'apt update'"
45+
# Run 'apt-get update'
46+
if ! apt-get update -y; then
47+
handle_error "$?" "Failed to run 'apt-get update'"
4848
fi
4949

50-
# Run 'apt install'
51-
if ! apt install -y apt-transport-https ca-certificates curl gnupg; then
50+
# Run 'apt-get install'
51+
if ! apt-get install -y apt-transport-https ca-certificates curl gnupg; then
5252
handle_error "$?" "Failed to install packages"
5353
fi
5454

@@ -99,9 +99,9 @@ EOF
9999
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
100100
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
101101

102-
# Run 'apt update'
103-
if ! apt update -y; then
104-
handle_error "$?" "Failed to run 'apt update'"
102+
# Run 'apt-get update'
103+
if ! apt-get update -y; then
104+
handle_error "$?" "Failed to run 'apt-get update'"
105105
else
106106
log "Repository configured successfully."
107107
log "To install Node.js, run: apt install nodejs -y" "info"

‎scripts/deb/setup_16.x‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ check_os() {
113113
install_pre_reqs() {
114114
log "Installing pre-requisites" "info"
115115

116-
# Run 'apt update'
117-
if ! apt update -y; then
118-
handle_error "$?" "Failed to run 'apt update'"
116+
# Run 'apt-get update'
117+
if ! apt-get update -y; then
118+
handle_error "$?" "Failed to run 'apt-get update'"
119119
fi
120120

121-
# Run 'apt install'
122-
if ! apt install -y apt-transport-https ca-certificates curl gnupg; then
121+
# Run 'apt-get install'
122+
if ! apt-get install -y apt-transport-https ca-certificates curl gnupg; then
123123
handle_error "$?" "Failed to install packages"
124124
fi
125125

@@ -152,9 +152,9 @@ configure_repo() {
152152
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
153153
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
154154

155-
# Run 'apt update'
156-
if ! apt update -y; then
157-
handle_error "$?" "Failed to run 'apt update'"
155+
# Run 'apt-get update'
156+
if ! apt-get update -y; then
157+
handle_error "$?" "Failed to run 'apt-get update'"
158158
else
159159
log "Repository configured successfully. To install Node.js, run: apt install nodejs -y" "success"
160160
fi

‎scripts/deb/setup_18.x‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ check_os() {
6868
install_pre_reqs() {
6969
log "Installing pre-requisites" "info"
7070

71-
# Run 'apt update'
72-
if ! apt update -y; then
73-
handle_error "$?" "Failed to run 'apt update'"
71+
# Run 'apt-get update'
72+
if ! apt-get update -y; then
73+
handle_error "$?" "Failed to run 'apt-get update'"
7474
fi
7575

76-
# Run 'apt install'
77-
if ! apt install -y apt-transport-https ca-certificates curl gnupg; then
76+
# Run 'apt-get install'
77+
if ! apt-get install -y apt-transport-https ca-certificates curl gnupg; then
7878
handle_error "$?" "Failed to install packages"
7979
fi
8080

@@ -117,9 +117,9 @@ configure_repo() {
117117
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
118118
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
119119

120-
# Run 'apt update'
121-
if ! apt update -y; then
122-
handle_error "$?" "Failed to run 'apt update'"
120+
# Run 'apt-get update'
121+
if ! apt-get update -y; then
122+
handle_error "$?" "Failed to run 'apt-get update'"
123123
else
124124
log "Repository configured successfully."
125125
log "To install Node.js, run: apt install nodejs -y" "info"

‎scripts/deb/setup_20.x‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ check_os() {
4242
install_pre_reqs() {
4343
log "Installing pre-requisites" "info"
4444

45-
# Run 'apt update'
46-
if ! apt update -y; then
47-
handle_error "$?" "Failed to run 'apt update'"
45+
# Run 'apt-get update'
46+
if ! apt-get update -y; then
47+
handle_error "$?" "Failed to run 'apt-get update'"
4848
fi
4949

50-
# Run 'apt install'
51-
if ! apt install -y apt-transport-https ca-certificates curl gnupg; then
50+
# Run 'apt-get install'
51+
if ! apt-get install -y apt-transport-https ca-certificates curl gnupg; then
5252
handle_error "$?" "Failed to install packages"
5353
fi
5454

@@ -99,9 +99,9 @@ EOF
9999
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
100100
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
101101

102-
# Run 'apt update'
103-
if ! apt update -y; then
104-
handle_error "$?" "Failed to run 'apt update'"
102+
# Run 'apt-get update'
103+
if ! apt-get update -y; then
104+
handle_error "$?" "Failed to run 'apt-get update'"
105105
else
106106
log "Repository configured successfully."
107107
log "To install Node.js, run: apt install nodejs -y" "info"

‎scripts/deb/setup_21.x‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ check_os() {
4242
install_pre_reqs() {
4343
log "Installing pre-requisites" "info"
4444

45-
# Run 'apt update'
46-
if ! apt update -y; then
47-
handle_error "$?" "Failed to run 'apt update'"
45+
# Run 'apt-get update'
46+
if ! apt-get update -y; then
47+
handle_error "$?" "Failed to run 'apt-get update'"
4848
fi
4949

50-
# Run 'apt install'
51-
if ! apt install -y apt-transport-https ca-certificates curl gnupg; then
50+
# Run 'apt-get install'
51+
if ! apt-get install -y apt-transport-https ca-certificates curl gnupg; then
5252
handle_error "$?" "Failed to install packages"
5353
fi
5454

@@ -91,9 +91,9 @@ configure_repo() {
9191
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
9292
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
9393

94-
# Run 'apt update'
95-
if ! apt update -y; then
96-
handle_error "$?" "Failed to run 'apt update'"
94+
# Run 'apt-get update'
95+
if ! apt-get update -y; then
96+
handle_error "$?" "Failed to run 'apt-get update'"
9797
else
9898
log "Repository configured successfully."
9999
log "To install Node.js, run: apt install nodejs -y" "info"

‎scripts/deb/setup_22.x‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ check_os() {
4242
install_pre_reqs() {
4343
log "Installing pre-requisites" "info"
4444

45-
# Run 'apt update'
46-
if ! apt update -y; then
47-
handle_error "$?" "Failed to run 'apt update'"
45+
# Run 'apt-get update'
46+
if ! apt-get update -y; then
47+
handle_error "$?" "Failed to run 'apt-get update'"
4848
fi
4949

50-
# Run 'apt install'
51-
if ! apt install -y apt-transport-https ca-certificates curl gnupg; then
50+
# Run 'apt-get install'
51+
if ! apt-get install -y apt-transport-https ca-certificates curl gnupg; then
5252
handle_error "$?" "Failed to install packages"
5353
fi
5454

@@ -99,9 +99,9 @@ EOF
9999
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
100100
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
101101

102-
# Run 'apt update'
103-
if ! apt update -y; then
104-
handle_error "$?" "Failed to run 'apt update'"
102+
# Run 'apt-get update'
103+
if ! apt-get update -y; then
104+
handle_error "$?" "Failed to run 'apt-get update'"
105105
else
106106
log "Repository configured successfully."
107107
log "To install Node.js, run: apt install nodejs -y" "info"

‎scripts/deb/setup_23.x‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ check_os() {
4242
install_pre_reqs() {
4343
log "Installing pre-requisites" "info"
4444

45-
# Run 'apt update'
46-
if ! apt update -y; then
47-
handle_error "$?" "Failed to run 'apt update'"
45+
# Run 'apt-get update'
46+
if ! apt-get update -y; then
47+
handle_error "$?" "Failed to run 'apt-get update'"
4848
fi
4949

50-
# Run 'apt install'
51-
if ! apt install -y apt-transport-https ca-certificates curl gnupg; then
50+
# Run 'apt-get install'
51+
if ! apt-get install -y apt-transport-https ca-certificates curl gnupg; then
5252
handle_error "$?" "Failed to install packages"
5353
fi
5454

@@ -99,9 +99,9 @@ EOF
9999
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
100100
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
101101

102-
# Run 'apt update'
103-
if ! apt update -y; then
104-
handle_error "$?" "Failed to run 'apt update'"
102+
# Run 'apt-get update'
103+
if ! apt-get update -y; then
104+
handle_error "$?" "Failed to run 'apt-get update'"
105105
else
106106
log "Repository configured successfully."
107107
log "To install Node.js, run: apt install nodejs -y" "info"

‎scripts/deb/setup_24.x‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ check_os() {
4242
install_pre_reqs() {
4343
log "Installing pre-requisites" "info"
4444

45-
# Run 'apt update'
46-
if ! apt update -y; then
47-
handle_error "$?" "Failed to run 'apt update'"
45+
# Run 'apt-get update'
46+
if ! apt-get update -y; then
47+
handle_error "$?" "Failed to run 'apt-get update'"
4848
fi
4949

50-
# Run 'apt install'
51-
if ! apt install -y apt-transport-https ca-certificates curl gnupg; then
50+
# Run 'apt-get install'
51+
if ! apt-get install -y apt-transport-https ca-certificates curl gnupg; then
5252
handle_error "$?" "Failed to install packages"
5353
fi
5454

@@ -99,9 +99,9 @@ EOF
9999
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
100100
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
101101

102-
# Run 'apt update'
103-
if ! apt update -y; then
104-
handle_error "$?" "Failed to run 'apt update'"
102+
# Run 'apt-get update'
103+
if ! apt-get update -y; then
104+
handle_error "$?" "Failed to run 'apt-get update'"
105105
else
106106
log "Repository configured successfully."
107107
log "To install Node.js, run: apt install nodejs -y" "info"

‎scripts/deb/setup_25.x‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ check_os() {
4242
install_pre_reqs() {
4343
log "Installing pre-requisites" "info"
4444

45-
# Run 'apt update'
46-
if ! apt update -y; then
47-
handle_error "$?" "Failed to run 'apt update'"
45+
# Run 'apt-get update'
46+
if ! apt-get update -y; then
47+
handle_error "$?" "Failed to run 'apt-get update'"
4848
fi
4949

50-
# Run 'apt install'
51-
if ! apt install -y apt-transport-https ca-certificates curl gnupg; then
50+
# Run 'apt-get install'
51+
if ! apt-get install -y apt-transport-https ca-certificates curl gnupg; then
5252
handle_error "$?" "Failed to install packages"
5353
fi
5454

@@ -99,9 +99,9 @@ EOF
9999
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
100100
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
101101

102-
# Run 'apt update'
103-
if ! apt update -y; then
104-
handle_error "$?" "Failed to run 'apt update'"
102+
# Run 'apt-get update'
103+
if ! apt-get update -y; then
104+
handle_error "$?" "Failed to run 'apt-get update'"
105105
else
106106
log "Repository configured successfully."
107107
log "To install Node.js, run: apt install nodejs -y" "info"

‎scripts/deb/setup_26.x‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ check_os() {
4242
install_pre_reqs() {
4343
log "Installing pre-requisites" "info"
4444

45-
# Run 'apt update'
46-
if ! apt update -y; then
47-
handle_error "$?" "Failed to run 'apt update'"
45+
# Run 'apt-get update'
46+
if ! apt-get update -y; then
47+
handle_error "$?" "Failed to run 'apt-get update'"
4848
fi
4949

50-
# Run 'apt install'
51-
if ! apt install -y apt-transport-https ca-certificates curl gnupg; then
50+
# Run 'apt-get install'
51+
if ! apt-get install -y apt-transport-https ca-certificates curl gnupg; then
5252
handle_error "$?" "Failed to install packages"
5353
fi
5454

@@ -99,9 +99,9 @@ EOF
9999
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
100100
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
101101

102-
# Run 'apt update'
103-
if ! apt update -y; then
104-
handle_error "$?" "Failed to run 'apt update'"
102+
# Run 'apt-get update'
103+
if ! apt-get update -y; then
104+
handle_error "$?" "Failed to run 'apt-get update'"
105105
else
106106
log "Repository configured successfully."
107107
log "To install Node.js, run: apt install nodejs -y" "info"

0 commit comments

Comments
 (0)