Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

Commit f4012c1

Browse files
author
Success Kingsley
authored
Merge pull request #7 from ToolKitHub/development
Update installation script to remove unnecessary package dependencies
2 parents 39b2c00 + 4c92f27 commit f4012c1

File tree

1 file changed

+51
-12
lines changed

1 file changed

+51
-12
lines changed

scripts/install.sh

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#+---------------------------------------------------------------------------------------------------------------+
44
# Author: Success Kingsley <hello@xosnrdev.tech>
5-
# Last Updated: 2024-08-09
5+
# Last Updated: 2024-08-11
66
# Version: 1.2.1
77
# License: MIT
88
# Description: This script installs the rce-engine on an Ubuntu 22.04 or latest machine.
@@ -26,12 +26,12 @@ log "Updating package list..."
2626
sudo apt update
2727

2828
# Check for essential packages needed for the installation like curl, docker, etc. If they are not installed, install them.
29-
pkgs=("curl" "docker.io" "runsc" "apt-transport-https" "ca-certificates" "gnupg-agent" "software-properties-common")
29+
pkgs=("docker.io" "runsc" "apt-transport-https" "ca-certificates" "gnupg-agent" "software-properties-common")
3030

3131
for pkg in "${pkgs[@]}"; do
3232
if ! dpkg -l | grep -q "^ii ${pkg}"; then
3333
log "Installing ${pkg}..."
34-
sudo apt-get install -y ${pkg} || error "Failed to install ${pkg}"
34+
sudo apt-get install -y "${pkg}" || error "Failed to install ${pkg}"
3535
fi
3636
done
3737

@@ -86,7 +86,7 @@ log "Configuring rce-engine systemd service..."
8686
curl -o /etc/systemd/system/rce-engine.service https://raw.githubusercontent.com/toolkithub/rce-engine/main/systemd/rce-engine.service || error "Failed to download rce-engine systemd service file"
8787

8888
# Prompt user to set the API access token
89-
read -p "Enter an API access token you'd like to use for rce-engine X-Access-Token Header: " api_access_token
89+
read -r -p "Enter an API access token you'd like to use for rce-engine X-Access-Token Header: " api_access_token
9090

9191
# Update rce-engine.service with the API access token
9292
sudo sed -i "s/Environment=\"API_ACCESS_TOKEN=some-secret-token\"/Environment=\"API_ACCESS_TOKEN=${api_access_token}\"/" /etc/systemd/system/rce-engine.service || error "Failed to update rce-engine.service with API access token"
@@ -100,11 +100,50 @@ sudo systemctl start rce-engine.service || error "Failed to start rce-engine ser
100100
# This phase of the script installs the rce-images for supported languages interactively.
101101
# see https://github.com/toolkithub/rce-images
102102
languages=(
103-
"Assembly" "Ats" "Bash" "C" "Clojure" "Cobol" "CoffeeScript" "Cpp"
104-
"Crystal" "Csharp" "D" "Elixir" "Elm" "Erlang" "Fsharp" "Go"
105-
"Groovy" "Haskell" "Idris" "Java" "JavaScript" "Julia" "Kotlin"
106-
"Lua" "Mercury" "Nim" "Ocaml" "Perl" "Php" "Python" "Raku"
107-
"Ruby" "Rust" "SaC" "Scala" "Swift" "TypeScript"
103+
"Assembly"
104+
"Ats"
105+
"Bash"
106+
"C"
107+
"Clisp"
108+
"Clojure"
109+
"Cobol"
110+
"CoffeeScript"
111+
"Cpp"
112+
"Crystal"
113+
"Csharp"
114+
"D"
115+
"Dart"
116+
"Elixir"
117+
"Elm"
118+
"Erlang"
119+
"Fsharp"
120+
"Go"
121+
"Groovy"
122+
"Guile"
123+
"Hare"
124+
"Haskell"
125+
"Idris"
126+
"Java"
127+
"JavaScript"
128+
"Julia"
129+
"Kotlin"
130+
"Lua"
131+
"Mercury"
132+
"Nim"
133+
"Nix"
134+
"Ocaml"
135+
"Pascal"
136+
"Perl"
137+
"Php"
138+
"Python"
139+
"Raku"
140+
"Ruby"
141+
"Rust"
142+
"SaC"
143+
"Scala"
144+
"Swift"
145+
"TypeScript"
146+
"Zig"
108147
)
109148

110149
# Display supported languages
@@ -144,11 +183,11 @@ main() {
144183
display_supported_languages
145184

146185
# Prompt user input
147-
read -p "Enter the number corresponding to the language(s) you'd like to install (comma-separated), or press Enter to install all: " language_input
186+
read -r -p "Enter the number corresponding to the language(s) you'd like to install (comma-separated), or press Enter to install all: " language_input
148187
language_input=$(trim_whitespace "${language_input}")
149188

150189
is_valid_input=true
151-
if [ -z "${language_input}" ]; then
190+
if [[ -z ${language_input} ]]; then
152191
for language in "${languages[@]}"; do
153192
pull_language_image "${language}" &
154193
done
@@ -165,7 +204,7 @@ main() {
165204
fi
166205
done
167206

168-
if [ "${is_valid_input}" = true ]; then
207+
if [[ ${is_valid_input} == true ]]; then
169208
for index in "${indices[@]}"; do
170209
language="${languages[$((index - 1))]}"
171210
pull_language_image "${language}" &

0 commit comments

Comments
 (0)