Skip to content

Commit

Permalink
Add noninteractive option
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritLHLS committed Nov 18, 2024
1 parent 91ffbfa commit 651bbb9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM alpine:latest
RUN apk add --no-cache wget curl bash
RUN apk add --no-cache bind-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
RUN apk add --no-cache grep openssl ca-certificates uuidgen

RUN export noninteractive=true
# 下载并执行 goecs.sh 脚本
RUN curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && \
chmod +x goecs.sh && \
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ Shell版本: https://github.com/spiritLHLS/ecs
### 一键命令

```
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
export noninteractive=true && curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
```


```
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
export noninteractive=true && curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
```

### 详细说明
Expand All @@ -76,6 +76,8 @@ curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt
./goecs.sh env
```

如果不想要互动,可使用```export noninteractive=true```再执行```env```命令

安装goecs

```
Expand Down
4 changes: 3 additions & 1 deletion README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Systems to be supported (hardware testing bugs not yet fixed): MacOS、FreeBSD
### one-click command

```
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs -l en
export noninteractive=true && curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs -l en
```

### explain in detail
Expand All @@ -64,6 +64,8 @@ Install environment
./goecs.sh env
```

If you don't want interaction, use ```export noninteractive=true``` and then execute the ```env``` command

Install goecs

```
Expand Down
30 changes: 17 additions & 13 deletions goecs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# From https://github.com/oneclickvirt/ecs
# 2024.11.17
# 2024.11.18

# curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh

Expand Down Expand Up @@ -245,10 +245,12 @@ InstallSysbench() {
echo "Error: Unable to determine memory size or memory size is zero."
elif [ $mem_size -lt 1024 ]; then
_red "Warning: Your system has less than 1GB RAM (${mem_size}MB)"
reading "Do you want to continue with EPEL installation? (y/N): " confirm
if [[ ! $confirm =~ ^[Yy]$ ]]; then
_yellow "Skipping EPEL installation"
return 1
if [ "$noninteractive" != "true" ]; then
reading "Do you want to continue with EPEL installation? (y/N): " confirm
if [[ ! $confirm =~ ^[Yy]$ ]]; then
_yellow "Skipping EPEL installation"
return 1
fi
fi
case "$Var_OSRelease" in
ubuntu | debian | astra)
Expand Down Expand Up @@ -397,14 +399,16 @@ env_check() {
_yellow "2. Cause temporary network interruptions"
_yellow "3. Impact system stability"
_yellow "4. Affect future system startup"
reading "Do you want to proceed with system update? (y/N): " update_confirm
if [[ ! $update_confirm =~ ^[Yy]$ ]]; then
_yellow "Skipping system update"
_yellow "Note: Some package installations may fail"
else
_green "Updating system package manager..."
if ! ${PACKAGE_UPDATE[int]} 2>/dev/null; then
_red "System update failed!"
if [ "$noninteractive" != "true" ]; then
reading "Do you want to proceed with system update? (y/N): " update_confirm
if [[ ! $update_confirm =~ ^[Yy]$ ]]; then
_yellow "Skipping system update"
_yellow "Note: Some package installations may fail"
else
_green "Updating system package manager..."
if ! ${PACKAGE_UPDATE[int]} 2>/dev/null; then
_red "System update failed!"
fi
fi
fi

Expand Down

0 comments on commit 651bbb9

Please sign in to comment.