flagflag  If you want to see English page, please click "English" Button at Left.
2: 2021-07-03 (土) 18:59:47 iseki ソース 現: 2021-07-13 (火) 20:06:59 iseki ソース
Line 3: Line 3:
 # Copyright (c) Jupyter Development Team.  # Copyright (c) Jupyter Development Team.
 # Distributed under the terms of the Modified BSD License.  # Distributed under the terms of the Modified BSD License.
 + 
 set -e  set -e
 + 
 # Exec the specified command or fall back on bash  # Exec the specified command or fall back on bash
 if [ $# -eq 0 ]; then  if [ $# -eq 0 ]; then
Line 12: Line 12:
     cmd=( "$@" )      cmd=( "$@" )
 fi  fi
 + 
 run-hooks () {  run-hooks () {
     # Source scripts or run executable files in a directory      # Source scripts or run executable files in a directory
Line 37: Line 37:
     echo "$0: done running hooks in $1"      echo "$0: done running hooks in $1"
 }  }
 + 
 run-hooks /usr/local/bin/start-notebook.d  run-hooks /usr/local/bin/start-notebook.d
 + 
 # Handle special flags if we're root  # Handle special flags if we're root
 if [ $(id -u) == 0 ] ; then  if [ $(id -u) == 0 ] ; then
 + 
     # Only attempt to change the jovyan username if it exists      # Only attempt to change the jovyan username if it exists
     if id jovyan &> /dev/null ; then      if id jovyan &> /dev/null ; then
Line 48: Line 48:
         usermod -d /home/$NB_USER -l $NB_USER jovyan          usermod -d /home/$NB_USER -l $NB_USER jovyan
     fi      fi
 + 
     # Handle case where provisioned storage does not have the correct permissions by default      # Handle case where provisioned storage does not have the correct permissions by default
     # Ex: default NFS/EFS (no auto-uid/gid)      # Ex: default NFS/EFS (no auto-uid/gid)
Line 61: Line 61:
         done          done
     fi      fi
 + 
     # handle home and working directory if the username changed      # handle home and working directory if the username changed
     if [[ "$NB_USER" != "jovyan" ]]; then      if [[ "$NB_USER" != "jovyan" ]]; then
Line 77: Line 77:
         fi          fi
     fi      fi
 + 
     # Change UID:GID of NB_USER to NB_UID:NB_GID if it does not match      # Change UID:GID of NB_USER to NB_UID:NB_GID if it does not match
     if [ "$NB_UID" != $(id -u $NB_USER) ] || [ "$NB_GID" != $(id -g $NB_USER) ]; then      if [ "$NB_UID" != $(id -u $NB_USER) ] || [ "$NB_GID" != $(id -g $NB_USER) ]; then
Line 87: Line 87:
         useradd --home /home/$NB_USER -u $NB_UID -g $NB_GID -G 100 -l $NB_USER          useradd --home /home/$NB_USER -u $NB_UID -g $NB_GID -G 100 -l $NB_USER
     fi      fi
 + 
     # Enable sudo if requested      # Enable sudo if requested
     if [[ "$GRANT_SUDO" == "1" || "$GRANT_SUDO" == 'yes' ]]; then      if [[ "$GRANT_SUDO" == "1" || "$GRANT_SUDO" == 'yes' ]]; then
Line 93: Line 93:
         echo "$NB_USER ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/notebook          echo "$NB_USER ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/notebook
     fi      fi
 + 
     # Add $CONDA_DIR/bin to sudo secure_path      # Add $CONDA_DIR/bin to sudo secure_path
     sed -r "s#Defaults\s+secure_path\s*=\s*\"?([^\"]+)\"?#Defaults secure_path=\"\1:$CONDA_DIR/bin\"#" /etc/sudoers | grep secure_path > /etc/sudoers.d/path      sed -r "s#Defaults\s+secure_path\s*=\s*\"?([^\"]+)\"?#Defaults secure_path=\"\1:$CONDA_DIR/bin\"#" /etc/sudoers | grep secure_path > /etc/sudoers.d/path
 + 
     # Exec the command as NB_USER with the PATH and the rest of      # Exec the command as NB_USER with the PATH and the rest of
     # the environment preserved      # the environment preserved
Line 120: Line 120:
             fi              fi
         fi          fi
 + 
         # Warn if the user isn't going to be able to write files to $HOME.          # Warn if the user isn't going to be able to write files to $HOME.
         if [[ ! -w /home/jovyan ]]; then          if [[ ! -w /home/jovyan ]]; then
Line 135: Line 135:
         fi          fi
     fi      fi
 + 
     # Warn if looks like user want to run in sudo mode but hasn't run      # Warn if looks like user want to run in sudo mode but hasn't run
     # the container as root.      # the container as root.
Line 141: Line 141:
         echo 'Container must be run as root to grant sudo permissions'          echo 'Container must be run as root to grant sudo permissions'
     fi      fi
 + 
     # Execute the command      # Execute the command
     run-hooks /usr/local/bin/before-notebook.d      run-hooks /usr/local/bin/before-notebook.d


トップ   新規 ページ一覧 単語検索 最終更新   ヘルプ   最終更新のRSS 1.0 最終更新のRSS 2.0 最終更新のRSS Atom

サイト内 検索

ログイン

ユーザー名:

パスワード:


パスワード紛失
新規登録

サブ メニュー

ミニカレンダー

前月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
<今日>

オンライン状況

54 人のユーザが現在オンラインです。 (28 人のユーザが xpwiki を参照しています。)

登録ユーザ: 0
ゲスト: 54

もっと...

アクセスカウンタ

今日 : 2742274227422742
昨日 : 8048804880488048
総計 : 2367230323672303236723032367230323672303236723032367230323672303
Powered by XOOPS Cube 2.1© 2001-2006 XOOPS Cube Project
Design by XoopsDesign.com