Debian Codegraph @

interactive-notebook/container/runtime_container_config.sh

raw
1 #!/bin/bash
2 # A runtime config for the isystemtap container
3 # Copyright (C) 2023 Red Hat Inc.
4 #
5 # This file is part of systemtap, and is free software. You can
6 # redistribute it and/or modify it under the terms of the GNU General
7 # Public License (GPL); either version 2, or (at your option) any
8 # later version.
9
10 # We need to get some of the info from the host's version of systemtap (at runtime) and add it here
11 # ISystemtap is already installed, so we need to find that location and add the ssh dest
12 localhost=127.0.0.1
13 INSTALL_PATH=`python -c 'import os; import isystemtap; print(os.path.abspath(isystemtap.__path__[-1]))'`
14 echo "STAP_VERSION = $STAP_VERSION" > $INSTALL_PATH/constants.py
15 echo "STAP_PKGDATADIR = $STAP_PKGDATADIR" >> $INSTALL_PATH/constants.py
16 echo "STAP_PREFIX = $STAP_PREFIX" >> $INSTALL_PATH/constants.py
17 echo "SSH_DEST = '$localhost'" >> $INSTALL_PATH/constants.py
18
19 # Update the language server config. Convert stap to PREFIX/bin/stap (Ex. /usr/bin/stap)
20 ABSOLUTE_STAP_PATH=`echo "$STAP_PREFIX" | tr -d "'\t\n\r"`/bin/stap
21 LSP_CONFIG=`jupyter --config`/jupyter_server_config.d/jupyter_stap_lsp.json
22 cp $LSP_CONFIG ${LSP_CONFIG}_old
23 jq --arg STAP $ABSOLUTE_STAP_PATH '.LanguageServerManager.language_servers."stap-language".argv = ["ssh", "127.0.0.1", $STAP + " --language-server"]' ${LSP_CONFIG}_old > $LSP_CONFIG
24 rm ${LSP_CONFIG}_old