Commit Graph

83 Commits

Author SHA1 Message Date
Erik Sundell
1f59bd7a77 start.sh: JUPYTER_DOCKER_STACKS_QUIET introduced
It is meant to allow you to opt out from non-error non-warning logs
generated by start.sh.
2021-11-12 12:35:35 +01:00
Ayaz Salikhov
8dfdbfd3a3 Merge pull request #1522 from mathbunnyru/asalikhov/remove_xdg_cache_home
Remove XDG_CACHE_HOME from start.sh sudo call
2021-11-10 21:24:20 +03:00
Ayaz Salikhov
f8c281a4f9 Fail if creating symlink fails 2021-11-10 18:27:23 +03:00
Ayaz Salikhov
0cc11990c7 Remove XDG_CACHE_HOME from start.sh sudo call 2021-11-10 17:58:32 +03:00
Ben Mares
3a5c2caded Revert broken sed --in-place command 2021-11-10 13:10:46 +01:00
Ben Mares
4c47de93e7 start.sh: add parens for CHOWN_HOME_OPTS
Co-authored-by: Erik Sundell <erik.i.sundell@gmail.com>
2021-11-10 00:56:34 +01:00
Ben Mares
87ad5ffdf6 start.sh: improve some messages 2021-11-09 20:52:59 +01:00
Erik Sundell
1ce72b55e2 Apply suggestions from code review
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2021-11-09 13:44:06 +01:00
Ben Mares
4ef8a7816d Undo changes which require further examination 2021-11-08 16:29:26 +01:00
Erik Sundell
018e5fc962 start.sh: tests, docs, and refinements 2021-11-08 16:29:11 +01:00
Erik Sundell
0365e73889 start.sh: update logging output 2021-11-08 16:25:41 +01:00
Erik Sundell
cd5e45b573 start.sh: refactor for readability 2021-11-08 16:25:41 +01:00
Erik Sundell
22c3516abd start.sh: inline documentation 2021-11-08 16:25:40 +01:00
Erik Sundell
52cc15ccf6 start.sh: preserve environment properly when starting as root 2021-11-08 16:25:40 +01:00
Erik Sundell
f3989038a2 start.sh: add info about the user executing hooks 2021-11-08 16:25:40 +01:00
Thijs Walcarius
93a6865aa3 Also copy hidden files/directories
cp -R does not copy hidden files/directories, causing issues (cfr #1465)
2021-09-15 11:17:44 +02:00
Ayaz Salikhov
0e24e5fdfe Update base-notebook/start.sh
Co-authored-by: Erik Sundell <erik.i.sundell@gmail.com>
2021-08-24 15:11:28 +03:00
rigzba21
0dbce4526e removing rsync dependency, using cp -R instead, reducing wait time in test 2021-08-06 14:55:58 -04:00
rigzba21
9d9b76909d fixing bashate and flake8 errors 2021-08-06 13:19:39 -04:00
rigzba21
511ca22321 adding shellcheck fixes 2021-08-06 13:02:16 -04:00
rigzba21
2ef77522e6 using rsync instead of mv to prevent accidental file deletion when bind mount a volume 2021-08-05 22:40:17 -04:00
Ayaz Salikhov
0999f1a36f Unify bash variables usage and add quotes where needed 2021-05-26 13:06:10 +03:00
Ayaz Salikhov
f961906480 Do not comment options 2021-05-21 16:43:05 +03:00
Ayaz Salikhov
7281a33137 Fix 2021-05-21 16:02:08 +03:00
Ayaz Salikhov
c0ae562059 Fix all shellcheck warnings 2021-05-21 15:49:49 +03:00
Ayaz Salikhov
3734d39090 Fix shellcheck warnings 2021-05-20 15:38:03 +03:00
stevenstetzler
eb50198dfa Create home directory before changing ownership 2020-11-06 14:09:24 -08:00
Greg
e95f3c5e86 add -f option with groupadd
Signed-off-by: Greg <werner.greg@gmail.com>
2020-08-20 20:19:39 -04:00
Harry Weppner
2dd822dd6f suppress "id: jovyan: no such user" message during start 2020-07-06 18:14:04 -07:00
Carsten Pohl
0710677ce2 Changed the regular expression in start.sh that reads the /etc/sudoers file and
adds the conda path as a secure path to sudo.

The regular expression expects that the equals sign has no leading and trailing
spaces after the parameter secure_path. Furthermore it expects that the value
is enclosed in double quotes.

This is the case for the sudoers file in debian based distributions, but the
in centos / redhat based distributions this is not the case. The default value
of the secure_path in centos / redhat based distributions has no double quotes
and leading and trailing spaces.

This change adds optional spaces before and after the space, and makes the
double quotes optional.
2020-04-17 16:10:38 +02:00
stevenstetzler
56e54a7320 Fall back on symlink if mv fails 2020-01-19 23:00:24 -08:00
Adrien Delsalle
d66e26cb21 updates on start.sh file
typo correction on env variable: replacing $USER with $NB_USER since $USER is not set
test if group exists before trying to add a new group
2019-08-09 13:20:16 +02:00
Adrien Delsalle
be4674ffdc Modify the way to change user uid/gid
Workaround of a Docker bad handling of sparse files
Fixes #923
2019-08-09 10:53:10 +02:00
Brett Randall
2d9aa71f69 Added logging of CHOWN_HOME_OPTS and CHOWN_EXTRA_OPTS.
Signed-off-by: Brett Randall <javabrett@gmail.com>
2019-03-20 15:10:04 +11:00
Brett Randall
7dc56ab821 Added logging of chown of CHOWN_EXTRA directories.
Signed-off-by: Brett Randall <javabrett@gmail.com>
2019-03-20 15:09:54 +11:00
Brett Randall
475ab49f82 Made variable reference PYTHONPATH safe in case of set -eu.
Signed-off-by: Brett Randall <javabrett@gmail.com>
2019-02-20 14:46:51 +11:00
Peter Parente
a95cb64dfe Merge pull request #791 from rkdarst/run-hooks-loop-bugfix
Fix logging bug in run-hooks (order of logging statement)
2019-01-01 19:08:45 -05:00
Richard Darst
6e104c95b1 Fix logging bug in run-hooks (order of logging statement)
- The "done running loop" log message was inside the loop, causing it
  to appear over and over again, making log quite confusing.
2019-01-01 23:37:23 +02:00
Peter Parente
e2d4d3b40b Set STATUS=0 by default
Addresses code review by @GrahamDumpleton
2018-12-29 18:15:40 -05:00
Peter Parente
9b9c3c7d99 Fix bug where container user is "nayvoj"
whoami &> /dev/null || STATUS=$? && true
causes STATUS to be set to an empty string
when the container starts with option --add-group="root"
resulting in both nayvoj and jovyan having uid=1000
and gid=100. The first match in /etc/password wins
and so the container user ends up being "nayvoj"
accidentally.

Avoid this by checking that whoami STATUS is neither blank nor 0
before adding a new /etc/passwd entry
2018-12-29 15:06:42 -05:00
Đặng Minh Dũng
0329eecec8 fixing inline script problem 2018-11-12 01:45:05 +07:00
Richard Darst
6fa9a4a1f0 Create run-hooks function and switch pre-start hook to that
- This is initial prototype of a more flexible hooks system.
- Add /usr/local/bin/before-notebook.d hooks which is run right before
  the notebook runs.
2018-08-22 01:32:13 +03:00
Richard Darst
a73212ea35 Add a posibliity for a pre-start hook
- The start.sh script does different operations on users, and
  sometimes one may need to do operations *after* that is done (as
  opposed to /usr/local/bin/start-notebook.d/ which is run before).
  This provides that possibility.  (One use case is hooks which must
  be run after the users are set up.)
- To be technically perfect, one might want to use something similar
  to /usr/local/bin/pre-start-notebook.d/.  But let's start with the
  simplest thing possible for now - the expected use of this command
  is only if people use NB_USER, etc in a way that requires small
  follow up commands to be run.
- If notebook is running as root, this allows users to run arbitrary
  commands pre-sudo.  Consider security model.
2018-08-22 01:32:13 +03:00
Richard Darst
fc72be36ad Update group handling: set primary gid, leave suplemental with group users
- If NB_GID is set, it is likely that files created should have NB_GID
  as their gid (if it doesn't matter, then this change is irrelevant.
  If it does matter, the liklihood that 100 matches with what the user
  wants is low).
- When NB_GID is set, create a new group with that gid.  Then, set
  this as the primary gid of the user.  Set the user's supplemental
  gids to NB_GID,100.
2018-08-02 10:27:29 +03:00
Nils Werner
6281d3d89c Change XDG_CACHE_HOME when using NB_USER 2018-07-20 12:18:14 +02:00
Peter Parente
da11c31576 Fix #492: NB_GID adds a supplemental group, leaves primary untouched 2018-06-24 16:10:10 -07:00
Graham Dumpleton
fce599596e Remove writable group file due to issues with being able to give su access when shouldn't be allowed. 2018-06-06 14:21:03 +10:00
Peter Parente
b62c7170c6 Fix some whitespace and quoting 2018-06-02 16:55:29 -04:00
Christian Mesh
e10d80d9cf Add the ability to specify chown arguments for both home and extra
If people have a use case for recursive chowns that's fine.  I think it's dangerous for people to use, but that's tailored to my use case.
2018-05-16 15:45:51 -04:00
Christian Mesh
dee887e6f9 Add CHOWN_EXTRA support
CHOWN_EXTRA is a comma separated list of directories to chown.
2018-05-15 11:13:55 -04:00