Home
News
Forum
Wiki
Blog
Contents
Gallery
Movies
Downloads
About NSL
If you want to see English page, please click "English" Button at Left.
[
タイトル一覧
|
ページ一覧
|
新規
|
単語検索
|
最終更新
|
ヘルプ
]
JupyterHub/DockerSpawner/start.sh
をテンプレートにして作成
[
トップ
]
[ ]
開始行:
**** /usr/local/bin/start.sh
#!/bin/bash
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
set -e
# Exec the specified command or fall back on bash
if [ $# -eq 0 ]; then
cmd=( "bash" )
else
cmd=( "$@" )
fi
run-hooks () {
# Source scripts or run executable files in a direct...
if [[ ! -d "$1" ]] ; then
return
fi
echo "$0: running hooks in $1"
for f in "$1/"*; do
case "$f" in
*.sh)
echo "$0: running $f"
source "$f"
;;
*)
if [[ -x "$f" ]] ; then
echo "$0: running $f"
"$f"
else
echo "$0: ignoring $f"
fi
;;
esac
done
echo "$0: done running hooks in $1"
}
run-hooks /usr/local/bin/start-notebook.d
# Handle special flags if we're root
if [ $(id -u) == 0 ] ; then
# Only attempt to change the jovyan username if it e...
if id jovyan &> /dev/null ; then
echo "Set username to: $NB_USER"
usermod -d /home/$NB_USER -l $NB_USER jovyan
fi
# Handle case where provisioned storage does not hav...
# Ex: default NFS/EFS (no auto-uid/gid)
if [[ "$CHOWN_HOME" == "1" || "$CHOWN_HOME" == 'yes'...
echo "Changing ownership of /home/$NB_USER to $N...
chown $CHOWN_HOME_OPTS $NB_UID:$NB_GID /home/$NB...
fi
if [ ! -z "$CHOWN_EXTRA" ]; then
for extra_dir in $(echo $CHOWN_EXTRA | tr ',' ' ...
echo "Changing ownership of ${extra_dir} to ...
chown $CHOWN_EXTRA_OPTS $NB_UID:$NB_GID $ext...
done
fi
# handle home and working directory if the username ...
if [[ "$NB_USER" != "jovyan" ]]; then
# changing username, make sure homedir exists
# (it could be mounted, and we shouldn't create ...
if [[ ! -e "/home/$NB_USER" ]]; then
echo "Relocating home dir to /home/$NB_USER"
mv /home/jovyan "/home/$NB_USER" || ln -s /h...
fi
# if workdir is in /home/jovyan, cd to /home/$NB...
if [[ "$PWD/" == "/home/jovyan/"* ]]; then
newcwd="/home/$NB_USER/${PWD:13}"
echo "Setting CWD to $newcwd"
cd "$newcwd"
fi
fi
# Change UID:GID of NB_USER to NB_UID:NB_GID if it d...
if [ "$NB_UID" != $(id -u $NB_USER) ] || [ "$NB_GID"...
echo "Set user $NB_USER UID:GID to: $NB_UID:$NB_...
if [ "$NB_GID" != $(id -g $NB_USER) ]; then
groupadd -g $NB_GID -o ${NB_GROUP:-${NB_USER}}
fi
userdel $NB_USER
useradd --home /home/$NB_USER -u $NB_UID -g $NB_...
fi
# Enable sudo if requested
if [[ "$GRANT_SUDO" == "1" || "$GRANT_SUDO" == 'yes'...
echo "Granting $NB_USER sudo access and appendin...
echo "$NB_USER ALL=(ALL) NOPASSWD:ALL" > /etc/su...
fi
# Add $CONDA_DIR/bin to sudo secure_path
sed -r "s#Defaults\s+secure_path\s*=\s*\"?([^\"]+)\"...
# Exec the command as NB_USER with the PATH and the ...
# the environment preserved
run-hooks /usr/local/bin/before-notebook.d
echo "Executing the command: ${cmd[@]}"
exec sudo -E -H -u $NB_USER PATH=$PATH XDG_CACHE_HOM...
else
if [[ "$NB_UID" == "$(id -u jovyan 2>/dev/null)" && ...
# User is not attempting to override user/group ...
# variables, but they could still have overridde...
# container runs as. Check that the user has an ...
# file and if not add an entry.
STATUS=0 && whoami &> /dev/null || STATUS=$? && ...
if [[ "$STATUS" != "0" ]]; then
if [[ -w /etc/passwd ]]; then
echo "Adding passwd file entry for $(id ...
cat /etc/passwd | sed -e "s/^jovyan:/nay...
echo "jovyan:x:$(id -u):$(id -g):,,,:/ho...
cat /tmp/passwd > /etc/passwd
rm /tmp/passwd
else
echo 'Container must be run with group "...
fi
fi
# Warn if the user isn't going to be able to wri...
if [[ ! -w /home/jovyan ]]; then
echo 'Container must be run with group "user...
fi
else
# Warn if looks like user want to override uid/g...
# run the container as root.
if [[ ! -z "$NB_UID" && "$NB_UID" != "$(id -u)" ...
echo 'Container must be run as root to set $...
fi
if [[ ! -z "$NB_GID" && "$NB_GID" != "$(id -g)" ...
echo 'Container must be run as root to set $...
fi
fi
# Warn if looks like user want to run in sudo mode b...
# the container as root.
if [[ "$GRANT_SUDO" == "1" || "$GRANT_SUDO" == 'yes'...
echo 'Container must be run as root to grant sud...
fi
# Execute the command
run-hooks /usr/local/bin/before-notebook.d
echo "Executing the command: ${cmd[@]}"
exec "${cmd[@]}"
fi
終了行:
**** /usr/local/bin/start.sh
#!/bin/bash
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
set -e
# Exec the specified command or fall back on bash
if [ $# -eq 0 ]; then
cmd=( "bash" )
else
cmd=( "$@" )
fi
run-hooks () {
# Source scripts or run executable files in a direct...
if [[ ! -d "$1" ]] ; then
return
fi
echo "$0: running hooks in $1"
for f in "$1/"*; do
case "$f" in
*.sh)
echo "$0: running $f"
source "$f"
;;
*)
if [[ -x "$f" ]] ; then
echo "$0: running $f"
"$f"
else
echo "$0: ignoring $f"
fi
;;
esac
done
echo "$0: done running hooks in $1"
}
run-hooks /usr/local/bin/start-notebook.d
# Handle special flags if we're root
if [ $(id -u) == 0 ] ; then
# Only attempt to change the jovyan username if it e...
if id jovyan &> /dev/null ; then
echo "Set username to: $NB_USER"
usermod -d /home/$NB_USER -l $NB_USER jovyan
fi
# Handle case where provisioned storage does not hav...
# Ex: default NFS/EFS (no auto-uid/gid)
if [[ "$CHOWN_HOME" == "1" || "$CHOWN_HOME" == 'yes'...
echo "Changing ownership of /home/$NB_USER to $N...
chown $CHOWN_HOME_OPTS $NB_UID:$NB_GID /home/$NB...
fi
if [ ! -z "$CHOWN_EXTRA" ]; then
for extra_dir in $(echo $CHOWN_EXTRA | tr ',' ' ...
echo "Changing ownership of ${extra_dir} to ...
chown $CHOWN_EXTRA_OPTS $NB_UID:$NB_GID $ext...
done
fi
# handle home and working directory if the username ...
if [[ "$NB_USER" != "jovyan" ]]; then
# changing username, make sure homedir exists
# (it could be mounted, and we shouldn't create ...
if [[ ! -e "/home/$NB_USER" ]]; then
echo "Relocating home dir to /home/$NB_USER"
mv /home/jovyan "/home/$NB_USER" || ln -s /h...
fi
# if workdir is in /home/jovyan, cd to /home/$NB...
if [[ "$PWD/" == "/home/jovyan/"* ]]; then
newcwd="/home/$NB_USER/${PWD:13}"
echo "Setting CWD to $newcwd"
cd "$newcwd"
fi
fi
# Change UID:GID of NB_USER to NB_UID:NB_GID if it d...
if [ "$NB_UID" != $(id -u $NB_USER) ] || [ "$NB_GID"...
echo "Set user $NB_USER UID:GID to: $NB_UID:$NB_...
if [ "$NB_GID" != $(id -g $NB_USER) ]; then
groupadd -g $NB_GID -o ${NB_GROUP:-${NB_USER}}
fi
userdel $NB_USER
useradd --home /home/$NB_USER -u $NB_UID -g $NB_...
fi
# Enable sudo if requested
if [[ "$GRANT_SUDO" == "1" || "$GRANT_SUDO" == 'yes'...
echo "Granting $NB_USER sudo access and appendin...
echo "$NB_USER ALL=(ALL) NOPASSWD:ALL" > /etc/su...
fi
# Add $CONDA_DIR/bin to sudo secure_path
sed -r "s#Defaults\s+secure_path\s*=\s*\"?([^\"]+)\"...
# Exec the command as NB_USER with the PATH and the ...
# the environment preserved
run-hooks /usr/local/bin/before-notebook.d
echo "Executing the command: ${cmd[@]}"
exec sudo -E -H -u $NB_USER PATH=$PATH XDG_CACHE_HOM...
else
if [[ "$NB_UID" == "$(id -u jovyan 2>/dev/null)" && ...
# User is not attempting to override user/group ...
# variables, but they could still have overridde...
# container runs as. Check that the user has an ...
# file and if not add an entry.
STATUS=0 && whoami &> /dev/null || STATUS=$? && ...
if [[ "$STATUS" != "0" ]]; then
if [[ -w /etc/passwd ]]; then
echo "Adding passwd file entry for $(id ...
cat /etc/passwd | sed -e "s/^jovyan:/nay...
echo "jovyan:x:$(id -u):$(id -g):,,,:/ho...
cat /tmp/passwd > /etc/passwd
rm /tmp/passwd
else
echo 'Container must be run with group "...
fi
fi
# Warn if the user isn't going to be able to wri...
if [[ ! -w /home/jovyan ]]; then
echo 'Container must be run with group "user...
fi
else
# Warn if looks like user want to override uid/g...
# run the container as root.
if [[ ! -z "$NB_UID" && "$NB_UID" != "$(id -u)" ...
echo 'Container must be run as root to set $...
fi
if [[ ! -z "$NB_GID" && "$NB_GID" != "$(id -g)" ...
echo 'Container must be run as root to set $...
fi
fi
# Warn if looks like user want to run in sudo mode b...
# the container as root.
if [[ "$GRANT_SUDO" == "1" || "$GRANT_SUDO" == 'yes'...
echo 'Container must be run as root to grant sud...
fi
# Execute the command
run-hooks /usr/local/bin/before-notebook.d
echo "Executing the command: ${cmd[@]}"
exec "${cmd[@]}"
fi
ページ名:
サイト内 検索
高度な検索
ログイン
ユーザー名:
パスワード:
パスワード紛失
新規登録
サブ メニュー
新着情報
Books
リンク
サイトマップ
e-Learning
TUIS 認証局証明書
ミニカレンダー
2025年 5月
日
月
火
水
木
金
土
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
<今日>
オンライン状況
98 人のユーザが現在オンラインです。 (5 人のユーザが xpwiki を参照しています。)
登録ユーザ: 0
ゲスト: 98
もっと...
アクセスカウンタ
今日 :
昨日 :
総計 :
Powered by XOOPS Cube 2.1© 2001-2006
XOOPS Cube Project
Design by
XoopsDesign.com