-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgo.sh
More file actions
33 lines (33 loc) · 1.06 KB
/
go.sh
File metadata and controls
33 lines (33 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Link="$1"
# config file
FILE="/root/config.cfg"
# Check if the file exists
if [ -f "$FILE" ]; then
echo "The file $FILE exists."
elif [ -z "$Link" ]; then
wget https://raw.githubusercontent.com/xmohammad1/steupnode/main/config.cfg -O "$FILE"
# Prompt the user to input the certificate
echo -e "Please paste the content of the Client Certificate, and press ENTER on a new line when finished:"
# Use sed to remove the specific block of text
sed -i '/^CERT_CONTENT="/,/^"$/d' "$FILE"
CERT_CONTENT=""
while IFS= read -r line; do
if [[ -z "$line" ]]; then
break
fi
CERT_CONTENT+="$line\n"
done
echo "CERT_CONTENT=\"$CERT_CONTENT\"" >> "$FILE"
else
wget "$Link" -O "$FILE"
fi
if [ -f /root/after_reboot.sh ]; then
echo "Script runned once already"
exit 1
fi
cd /root/
SCRIPT_PATH="/root/main.sh"
sudo wget https://raw.githubusercontent.com/xmohammad1/steupnode/main/main.sh -O $SCRIPT_PATH
chmod +x "$SCRIPT_PATH"
tmux new-session -d -s update-session 'bash /root/main.sh'
tmux attach -t update-session