env-wrapper 804 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env bash
  2. source "${SNAP}/env/vars"
  3. is_root || echo "You might experience some issues with running this as a user. Consider using sudo."
  4. if [ "$(basename ${1})" == "code-server" ]; then
  5. ARGS=(--config "${VSCS_CONFIG}")
  6. ARGS+=(--user-data-dir "${VSCS_UDD}")
  7. ARGS+=(--extensions-dir "${VSCS_EXT}")
  8. ARGS+=("${VSCS_USD}")
  9. set -- "$@" "${ARGS[@]}"
  10. fi
  11. if [ ! -d "${VSCS_SSH}" ]; then
  12. mkdir --mode=0700 "${VSCS_SSH}"
  13. touch "${VSCS_SSH}/config"
  14. chmod 0644 "${VSCS_SSH}/config"
  15. echo "alias ssh-keygen='${SSH_KEYGEN}'" >> "${SNAP_USER_DATA}/.bashrc"
  16. git config --global core.sshCommand "ssh -i \"${VSCS_SSH}/id_rsa\" -F \"${VSCS_SSH}/config\" -o BatchMode=yes -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=\"${VSCS_SSH}/known_hosts\""
  17. fi
  18. exec $@