feat: [CDE-175]: Changing all shell commands from bash to sh. (#2244)

* feat: [CDE-175]: Changing all shell commands from bash to sh.
unified-ui
Dhruv Dhruv 2024-07-18 08:01:37 +00:00 committed by Harness
parent ba934bb4e2
commit bb7433ef9a
7 changed files with 12 additions and 12 deletions

View File

@ -30,7 +30,7 @@ type Devcontainer struct {
}
func (d *Devcontainer) ExecuteCommand(ctx context.Context, command string, detach bool) ([]byte, error) {
cmd := []string{"/bin/bash", "-c", command}
cmd := []string{"/bin/sh", "-c", command}
execConfig := dockerTypes.ExecConfig{
User: "root",

View File

@ -553,8 +553,8 @@ func (e *EmbeddedDockerOrchestrator) createContainer(
_, err := dockerClient.ContainerCreate(ctx, &container.Config{
Image: imageName,
Entrypoint: []string{"/bin/bash"},
Cmd: []string{"-c", "trap \"exit 0\" 15;\n sleep infinity & wait $!"},
Entrypoint: []string{"/bin/sh"},
Cmd: []string{"-c", "trap 'exit 0' 15; sleep infinity & wait $!"},
ExposedPorts: exposedPorts,
}, &container.HostConfig{
PortBindings: portBindings,

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
repo_url={{ .RepoURL }}
devcontainer_present={{ .DevcontainerPresent }}
@ -9,13 +9,13 @@ branch={{ .Branch }}
repo_name=$(basename -s .git "$repo_url")
# Check if Git is installed
if ! command -v git &>/dev/null; then
if ! command -v git >/dev/null 2>&1; then
echo "Git is not installed. Installing Git..."
apt-get update
apt-get install -y git
fi
if ! command -v git &>/dev/null; then
if ! command -v git >/dev/null 2>&1; then
echo "Git is not installed. Exiting..."
exit 1
fi

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
echo "Installing VSCode Web"

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
echo "Running SSH Server"

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
echo "Running VSCode Web"

View File

@ -1,7 +1,7 @@
#!/bin/bash
#!/bin/sh
# Install SSH if it's not already installed
if ! command -v sshd &> /dev/null; then
if ! command -v sshd >/dev/null 2>&1; then
echo "OpenSSH server is not installed. Installing..."
apt-get update
apt-get install -y openssh-server
@ -14,7 +14,7 @@ password={{ .Password }}
workingDir={{ .WorkingDirectory }}
# Check if the user already exists
if id "$username" &> /dev/null; then
if id "$username" >/dev/null 2>&1; then
echo "User $username already exists."
else
# Create a new user