privateone commited on
Commit
a884714
·
verified ·
1 Parent(s): d5bbb49

Upload 12 files

Browse files
root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-openvscode-server ADDED
File without changes
root/etc/s6-overlay/s6-rc.d/init-openvscode-server/dependencies.d/init-config ADDED
File without changes
root/etc/s6-overlay/s6-rc.d/init-openvscode-server/run ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/with-contenv bash
2
+
3
+ mkdir -p /config/{workspace,.ssh}
4
+
5
+ if [ -n "${SUDO_PASSWORD}" ] || [ -n "${SUDO_PASSWORD_HASH}" ]; then
6
+ echo "setting up sudo access"
7
+ if ! grep -q 'abc' /etc/sudoers; then
8
+ echo "adding abc to sudoers"
9
+ echo "abc ALL=(ALL:ALL) ALL" >> /etc/sudoers
10
+ fi
11
+ if [ -n "${SUDO_PASSWORD_HASH}" ]; then
12
+ echo "setting sudo password using sudo password hash"
13
+ sed -i "s|^abc:\!:|abc:${SUDO_PASSWORD_HASH}:|" /etc/shadow
14
+ else
15
+ echo "setting sudo password using SUDO_PASSWORD env var"
16
+ echo -e "${SUDO_PASSWORD}\n${SUDO_PASSWORD}" | passwd abc
17
+ fi
18
+ fi
19
+
20
+ [[ ! -f /config/.bashrc ]] && \
21
+ cp /root/.bashrc /config/.bashrc
22
+ [[ ! -f /config/.profile ]] && \
23
+ cp /root/.profile /config/.profile
24
+
25
+ # fix permissions (ignore contents of /config/workspace)
26
+ echo "setting permissions::config"
27
+ find /config -path /config/workspace -prune -o -exec chown abc:abc {} +
28
+ chown abc:abc /config/workspace
29
+ echo "setting permissions::app"
30
+ chown -R abc:abc /app/openvscode-server
31
+
32
+ chmod 700 /config/.ssh
33
+ if [ -n "$(ls -A /config/.ssh)" ]; then
34
+ chmod 600 /config/.ssh/*
35
+ fi
root/etc/s6-overlay/s6-rc.d/init-openvscode-server/type ADDED
@@ -0,0 +1 @@
 
 
1
+ oneshot
root/etc/s6-overlay/s6-rc.d/init-openvscode-server/up ADDED
@@ -0,0 +1 @@
 
 
1
+ /etc/s6-overlay/s6-rc.d/init-openvscode-server/run
root/etc/s6-overlay/s6-rc.d/svc-openvscode-server/dependencies.d/init-services ADDED
File without changes
root/etc/s6-overlay/s6-rc.d/svc-openvscode-server/notification-fd ADDED
@@ -0,0 +1 @@
 
 
1
+ 3
root/etc/s6-overlay/s6-rc.d/svc-openvscode-server/run ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/with-contenv bash
2
+
3
+ if [ -n "$CONNECTION_SECRET" ]; then
4
+ CODE_ARGS="${CODE_ARGS} --connection-secret ${CONNECTION_SECRET}"
5
+ echo "Using connection secret from ${CONNECTION_SECRET}"
6
+ elif [ -n "$CONNECTION_TOKEN" ]; then
7
+ CODE_ARGS="${CODE_ARGS} --connection-token ${CONNECTION_TOKEN}"
8
+ echo "Using connection token ${CONNECTION_TOKEN}"
9
+ else
10
+ CODE_ARGS="${CODE_ARGS} --without-connection-token"
11
+ echo "**** No connection token is set ****"
12
+ fi
13
+
14
+ exec \
15
+ s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z 127.0.0.1 3000" \
16
+ cd /app/openvscode-server s6-setuidgid abc \
17
+ /app/openvscode-server/bin/openvscode-server \
18
+ --host 0.0.0.0 \
19
+ --port 3000 \
20
+ --disable-telemetry \
21
+ ${CODE_ARGS}
root/etc/s6-overlay/s6-rc.d/svc-openvscode-server/type ADDED
@@ -0,0 +1 @@
 
 
1
+ longrun
root/etc/s6-overlay/s6-rc.d/user/contents.d/init-openvscode-server ADDED
File without changes
root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-openvscode-server ADDED
File without changes
root/usr/local/bin/install-extension ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/with-contenv bash
2
+ # shellcheck shell=bash
3
+
4
+ _install=(/app/openvscode-server/bin/openvscode-server "--install-extension")
5
+
6
+ if [ "$(whoami)" == "abc" ]; then
7
+ "${_install[@]}" "$@"
8
+ else
9
+ s6-setuidgid abc "${_install[@]}" "$@"
10
+ fi