11#! /bin/sh
22
3+ # This script uses the short flags (e.g., "-f") for commands instead of the
4+ # long flags (e.g. "--force") to work on Alpine and other distributions.
5+
36# shellcheck disable=SC2154
47
58set -e -u
@@ -12,20 +15,20 @@ if [ -z "${_REMOTE_USER_HOME:-}" ]; then
1215fi
1316
1417# We create the mount point and temporary directories here with the
15- # correct permissions. This is especially imperative for the mount
16- # point as the volume mount will cary over the _permissions_ of an
17- # existing directory. We _cannot_ use `chown` here because of
18+ # correct permissions. This is imperative for the mount point as
19+ # the volume mount will cary over the _permissions_ of an existing
20+ # directory. We _cannot_ use `chown` here because of
1821# `updateRemoteUserUID: true` in some cases, which would result in
1922# a UID mismatch; hence, we need `777` as the permissions.
2023for LOOP_VAR in " stable," " insiders,-insiders" ; do
21- PERSISTENCE_DIR=" ${CACHE_MOUNT_POINT} /$( printf ' %s' " ${LOOP_VAR} " | cut --delimiter= , --fields= 1) "
24+ PERSISTENCE_DIR=" ${CACHE_MOUNT_POINT} /$( printf ' %s' " ${LOOP_VAR} " | cut -d , - 1) "
2225 TMP_STORAGE_DIR=" ${_REMOTE_USER_HOME} /.vscode-server$( printf ' %s' " ${LOOP_VAR} " | cut --delimiter=, --fields=2) "
2326
24- mkdir --parents " ${PERSISTENCE_DIR} " " ${TMP_STORAGE_DIR} "
25- chmod --recursive 777 " ${PERSISTENCE_DIR} " " ${TMP_STORAGE_DIR} "
27+ # shellcheck disable=SC2174
28+ mkdir -m 777 -p " ${PERSISTENCE_DIR} " " ${TMP_STORAGE_DIR} "
2629
2730 TMP_STORAGE_DIR=${TMP_STORAGE_DIR} /extensions
2831
29- rm --recursive --force " ${TMP_STORAGE_DIR} "
30- ln --symbolic " ${PERSISTENCE_DIR} " " ${TMP_STORAGE_DIR} "
32+ rm -r -f " ${TMP_STORAGE_DIR} "
33+ ln -s " ${PERSISTENCE_DIR} " " ${TMP_STORAGE_DIR} "
3134done
0 commit comments