-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sh
38 lines (31 loc) · 2.06 KB
/
init.sh
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
34
35
36
37
38
# ************************************************************************************************************ #
# #
# ::::::::: :::::::: :::::::: ::: ::: :::::::::: #
# init.sh :+: :+: :+: :+: :+: :+: :+: :+: :+: #
# +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ #
# By: ES-Yukun <[email protected]> +#+ +:+ +#+ +:+ +#+ +#++:++#++ +#++:++# #
# +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ #
# Created: 2023/04/30 01:50:48 by ES-Yukun #+# #+# #+# #+# #+# #+# #+# #+# #+# #
# Updated: 2023/04/30 03:23:58 by ES-Yukun ######### ######## ######## ### ### ##########.io. #
# #
# ************************************************************************************************************ #
VERSION=$(curl https://api.github.com/repos/coder/code-server/releases/latest -s | jq .name -r | sed -e s/v//g)
echo -e "$(date --utc +[%Y-%m-%dT%H:%M:%S.%3NZ]) info Installing requirements packages"
echo -e "$(date --utc +[%Y-%m-%dT%H:%M:%S.%3NZ]) info Installing code-server\033[0m"
rpm -i https://github.com/coder/code-server/releases/download/v${VERSION}/code-server-${VERSION}-amd64.rpm
echo -e "$(date --utc +[%Y-%m-%dT%H:%M:%S.%3NZ]) info Installing code-server"
cat <<EOF > /tmp/.code-server.yaml
bind-addr: 0.0.0.0:8080
auth: password
password: $(echo $RANDOM | md5sum | head -c 20)
cert: false
EOF
if [ ! -f ~/.installrc ]; then
touch ~/.installrc
fi
if [ ! -f /tmp/installed ]; then
touch /tmp/installed;
source ~/.installrc
fi
echo -e "$(date --utc +[%Y-%m-%dT%H:%M:%S.%3NZ]) info code-server start"
code-server --config /tmp/.code-server.yaml