Skip to content

Commit

Permalink
Add safe version of rm to prevent deletion of filers. (#648)
Browse files Browse the repository at this point in the history
* add safe version of rm

* move rm wrapper to github gist

* move rm wrapper to github gist

* add safe version of rm via github gist

* fix typo

* fix typo

* fix typo

* change location of script: github -> gitlab

---------

Co-authored-by: Bryan Paget <[email protected]>
  • Loading branch information
bryanpaget and Bryan Paget authored Jul 17, 2024
1 parent f1d4ef0 commit 8a01153
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docker-bits/∞_CMD.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ADD connect-to-filer.md /home/$NB_USER/connect-to-filer.md

# Point conda to Artifactory repository
RUN conda config --remove channels conda-forge --system

USER $NB_USER
ENTRYPOINT ["tini", "--"]
CMD ["start-custom.sh"]
2 changes: 1 addition & 1 deletion output/docker-stacks-datascience-notebook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ADD connect-to-filer.md /home/$NB_USER/connect-to-filer.md

# Point conda to Artifactory repository
RUN conda config --remove channels conda-forge --system

USER $NB_USER
ENTRYPOINT ["tini", "--"]
CMD ["start-custom.sh"]
8 changes: 8 additions & 0 deletions output/docker-stacks-datascience-notebook/start-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ if [ ! -f /home/$NB_USER/.zsh-installed ]; then
touch /home/$NB_USER/.hushlogin
fi

# add rm wrapper:
# https://jirab.statcan.ca/browse/ZPS-40
mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm

export VISUAL="/usr/bin/nano"
export EDITOR="$VISUAL"

Expand Down
2 changes: 1 addition & 1 deletion output/jupyterlab-cpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ ADD connect-to-filer.md /home/$NB_USER/connect-to-filer.md

# Point conda to Artifactory repository
RUN conda config --remove channels conda-forge --system

USER $NB_USER
ENTRYPOINT ["tini", "--"]
CMD ["start-custom.sh"]
8 changes: 8 additions & 0 deletions output/jupyterlab-cpu/start-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ if [ ! -f /home/$NB_USER/.zsh-installed ]; then
touch /home/$NB_USER/.hushlogin
fi

# add rm wrapper:
# https://jirab.statcan.ca/browse/ZPS-40
mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm

export VISUAL="/usr/bin/nano"
export EDITOR="$VISUAL"

Expand Down
2 changes: 1 addition & 1 deletion output/jupyterlab-pytorch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ ADD connect-to-filer.md /home/$NB_USER/connect-to-filer.md

# Point conda to Artifactory repository
RUN conda config --remove channels conda-forge --system

USER $NB_USER
ENTRYPOINT ["tini", "--"]
CMD ["start-custom.sh"]
8 changes: 8 additions & 0 deletions output/jupyterlab-pytorch/start-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ if [ ! -f /home/$NB_USER/.zsh-installed ]; then
touch /home/$NB_USER/.hushlogin
fi

# add rm wrapper:
# https://jirab.statcan.ca/browse/ZPS-40
mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm

export VISUAL="/usr/bin/nano"
export EDITOR="$VISUAL"

Expand Down
2 changes: 1 addition & 1 deletion output/jupyterlab-tensorflow/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ ADD connect-to-filer.md /home/$NB_USER/connect-to-filer.md

# Point conda to Artifactory repository
RUN conda config --remove channels conda-forge --system

USER $NB_USER
ENTRYPOINT ["tini", "--"]
CMD ["start-custom.sh"]
8 changes: 8 additions & 0 deletions output/jupyterlab-tensorflow/start-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ if [ ! -f /home/$NB_USER/.zsh-installed ]; then
touch /home/$NB_USER/.hushlogin
fi

# add rm wrapper:
# https://jirab.statcan.ca/browse/ZPS-40
mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm

export VISUAL="/usr/bin/nano"
export EDITOR="$VISUAL"

Expand Down
8 changes: 8 additions & 0 deletions output/remote-desktop/start-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ if [ ! -f /home/$NB_USER/.zsh-installed ]; then
touch /home/$NB_USER/.hushlogin
fi

# add rm wrapper:
# https://jirab.statcan.ca/browse/ZPS-40
mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm

export VISUAL="/usr/bin/nano"
export EDITOR="$VISUAL"

Expand Down
2 changes: 1 addition & 1 deletion output/rstudio/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ ADD connect-to-filer.md /home/$NB_USER/connect-to-filer.md

# Point conda to Artifactory repository
RUN conda config --remove channels conda-forge --system

USER $NB_USER
ENTRYPOINT ["tini", "--"]
CMD ["start-custom.sh"]
8 changes: 8 additions & 0 deletions output/rstudio/start-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ if [ ! -f /home/$NB_USER/.zsh-installed ]; then
touch /home/$NB_USER/.hushlogin
fi

# add rm wrapper:
# https://jirab.statcan.ca/browse/ZPS-40
mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm

export VISUAL="/usr/bin/nano"
export EDITOR="$VISUAL"

Expand Down
2 changes: 1 addition & 1 deletion output/sas/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ ADD connect-to-filer.md /home/$NB_USER/connect-to-filer.md

# Point conda to Artifactory repository
RUN conda config --remove channels conda-forge --system

USER $NB_USER
ENTRYPOINT ["tini", "--"]
CMD ["start-custom.sh"]
8 changes: 8 additions & 0 deletions output/sas/start-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ if [ ! -f /home/$NB_USER/.zsh-installed ]; then
touch /home/$NB_USER/.hushlogin
fi

# add rm wrapper:
# https://jirab.statcan.ca/browse/ZPS-40
mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm

export VISUAL="/usr/bin/nano"
export EDITOR="$VISUAL"

Expand Down
8 changes: 8 additions & 0 deletions resources/common/start-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ if [ ! -f /home/$NB_USER/.zsh-installed ]; then
touch /home/$NB_USER/.hushlogin
fi

# add rm wrapper:
# https://jirab.statcan.ca/browse/ZPS-40
mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm

export VISUAL="/usr/bin/nano"
export EDITOR="$VISUAL"

Expand Down

0 comments on commit 8a01153

Please sign in to comment.