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-kai
をテンプレートにして作成
[
トップ
]
[ ]
開始行:
**** /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
#
HOME_DIR=\\"/home\\"
if [[ \\"$NB_GROUP\\" != \\"\\" ]]; then
HOME_DIR=\\"$HOME_DIR/$NB_GROUP\\"
if [[ ! -e \\"$HOME_DIR\\" ]]; then
mkdir $HOME_DIR
fi
fi
# 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_DIR/$NB_USER -l $NB_USER jovyan
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 crea...
if [[ ! -e \\"$HOME_DIR/$NB_USER\\" ]]; then
echo \\"Relocating home dir to $HOME_DIR/$NB...
mv /home/jovyan \\"$HOME_DIR/$NB_USER\\" || ...
else
cd $HOME_DIR/$NB_USER
rm -rf /home/jovyan || true
fi
# if workdir is in /home/jovyan, cd to $HOME_DIR...
if [[ \\"$PWD/\\" == \\"/home/jovyan/\\"* ]]; then
newcwd=\\"$HOME_DIR/$NB_USER/${PWD:13}\\"
echo \\"Setting CWD to $newcwd\\"
cd \\"$newcwd\\"
fi
fi
CHOWN_HOME=1
# Handle case where provisioned storage does not hav...
# Ex: default NFS/EFS (no auto-uid/gid)
if [[ \\"$CHOWN_HOME\\" == \\"1\\" || \\"$CHOWN_HOME...
echo \\"Changing ownership of $HOME_DIR/$NB_USER...
chown -R $CHOWN_HOME_OPTS $NB_UID:$NB_GID $HOME_...
fi
if [ ! -z \\"$CHOWN_EXTRA\\" ]; then
for extra_dir in $(echo $CHOWN_EXTRA | tr \\\',\...
echo \\"Changing ownership of ${extra_dir} t...
chown -R $CHOWN_EXTRA_OPTS $NB_UID:$NB_GID $...
done
fi
# Change UID:GID of NB_USER to NB_UID:NB_GID if it d...
if [ \\"$NB_UID\\" != $(id -u $NB_USER) ] || [ \\"$N...
echo \\"Set user $NB_USER UID:GID to: $NB_UID:$N...
if [ \\"$NB_GID\\" != $(id -g $NB_USER) ]; then
groupadd -f -g $NB_GID -o ${NB_GROUP:-${NB_U...
fi
userdel $NB_USER
useradd --home $HOME_DIR/$NB_USER -u $NB_UID -g ...
fi
# Enable sudo if requested
if [[ \\"$GRANT_SUDO\\" == \\"1\\" || \\"$GRANT_SUDO...
echo \\"Granting $NB_USER sudo access and append...
echo \\"$NB_USER ALL=(ALL) NOPASSWD:ALL\\" > /et...
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 $(i...
cat /etc/passwd | sed -e \\"s/^jovyan:/n...
echo \\"jovyan:x:$(id -u):$(id -g):,,,:/...
cat /tmp/passwd > /etc/passwd
rm /tmp/passwd
else
echo \\\'Container must be run with grou...
fi
fi
# Warn if the user isn\\\'t going to be able to ...
if [[ ! -w /home/jovyan ]]; then
echo \\\'Container must be run with group \\...
fi
else
# Warn if looks like user want to override uid/g...
# run the container as root.
if [[ ! -z \\"$NB_UID\\" && \\"$NB_UID\\" != \\"...
echo \\\'Container must be run as root to se...
fi
if [[ ! -z \\"$NB_GID\\" && \\"$NB_GID\\" != \\"...
echo \\\'Container must be run as root to se...
fi
fi
# Warn if looks like user want to run in sudo mode b...
# the container as root.
if [[ \\"$GRANT_SUDO\\" == \\"1\\" || \\"$GRANT_SUDO...
echo \\\'Container must be run as root to grant ...
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
#
HOME_DIR=\\"/home\\"
if [[ \\"$NB_GROUP\\" != \\"\\" ]]; then
HOME_DIR=\\"$HOME_DIR/$NB_GROUP\\"
if [[ ! -e \\"$HOME_DIR\\" ]]; then
mkdir $HOME_DIR
fi
fi
# 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_DIR/$NB_USER -l $NB_USER jovyan
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 crea...
if [[ ! -e \\"$HOME_DIR/$NB_USER\\" ]]; then
echo \\"Relocating home dir to $HOME_DIR/$NB...
mv /home/jovyan \\"$HOME_DIR/$NB_USER\\" || ...
else
cd $HOME_DIR/$NB_USER
rm -rf /home/jovyan || true
fi
# if workdir is in /home/jovyan, cd to $HOME_DIR...
if [[ \\"$PWD/\\" == \\"/home/jovyan/\\"* ]]; then
newcwd=\\"$HOME_DIR/$NB_USER/${PWD:13}\\"
echo \\"Setting CWD to $newcwd\\"
cd \\"$newcwd\\"
fi
fi
CHOWN_HOME=1
# Handle case where provisioned storage does not hav...
# Ex: default NFS/EFS (no auto-uid/gid)
if [[ \\"$CHOWN_HOME\\" == \\"1\\" || \\"$CHOWN_HOME...
echo \\"Changing ownership of $HOME_DIR/$NB_USER...
chown -R $CHOWN_HOME_OPTS $NB_UID:$NB_GID $HOME_...
fi
if [ ! -z \\"$CHOWN_EXTRA\\" ]; then
for extra_dir in $(echo $CHOWN_EXTRA | tr \\\',\...
echo \\"Changing ownership of ${extra_dir} t...
chown -R $CHOWN_EXTRA_OPTS $NB_UID:$NB_GID $...
done
fi
# Change UID:GID of NB_USER to NB_UID:NB_GID if it d...
if [ \\"$NB_UID\\" != $(id -u $NB_USER) ] || [ \\"$N...
echo \\"Set user $NB_USER UID:GID to: $NB_UID:$N...
if [ \\"$NB_GID\\" != $(id -g $NB_USER) ]; then
groupadd -f -g $NB_GID -o ${NB_GROUP:-${NB_U...
fi
userdel $NB_USER
useradd --home $HOME_DIR/$NB_USER -u $NB_UID -g ...
fi
# Enable sudo if requested
if [[ \\"$GRANT_SUDO\\" == \\"1\\" || \\"$GRANT_SUDO...
echo \\"Granting $NB_USER sudo access and append...
echo \\"$NB_USER ALL=(ALL) NOPASSWD:ALL\\" > /et...
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 $(i...
cat /etc/passwd | sed -e \\"s/^jovyan:/n...
echo \\"jovyan:x:$(id -u):$(id -g):,,,:/...
cat /tmp/passwd > /etc/passwd
rm /tmp/passwd
else
echo \\\'Container must be run with grou...
fi
fi
# Warn if the user isn\\\'t going to be able to ...
if [[ ! -w /home/jovyan ]]; then
echo \\\'Container must be run with group \\...
fi
else
# Warn if looks like user want to override uid/g...
# run the container as root.
if [[ ! -z \\"$NB_UID\\" && \\"$NB_UID\\" != \\"...
echo \\\'Container must be run as root to se...
fi
if [[ ! -z \\"$NB_GID\\" && \\"$NB_GID\\" != \\"...
echo \\\'Container must be run as root to se...
fi
fi
# Warn if looks like user want to run in sudo mode b...
# the container as root.
if [[ \\"$GRANT_SUDO\\" == \\"1\\" || \\"$GRANT_SUDO...
echo \\\'Container must be run as root to grant ...
fi
# Execute the command
run-hooks /usr/local/bin/before-notebook.d
echo \\"Executing the command: ${cmd[@]}\\"
exec \\"${cmd[@]}\\"
fi
ページ名:
サイト内 検索
高度な検索
ログイン
ユーザー名:
パスワード:
パスワード紛失
新規登録
サブ メニュー
新着情報
Books
リンク
サイトマップ
e-Learning
TUIS 認証局証明書
ミニカレンダー
2024年 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
<今日>
オンライン状況
90 人のユーザが現在オンラインです。 (18 人のユーザが xpwiki を参照しています。)
登録ユーザ: 0
ゲスト: 90
もっと...
アクセスカウンタ
今日 :
昨日 :
総計 :
Powered by XOOPS Cube 2.1© 2001-2006
XOOPS Cube Project
Design by
XoopsDesign.com