Skip to content

Commit

Permalink
Merge pull request #192 from nmfs-opensci/eeholmes-patch-1
Browse files Browse the repository at this point in the history
move desktop.sh to scripts
  • Loading branch information
eeholmes authored Nov 15, 2024
2 parents a789850 + 33ec630 commit e394a91
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RUN mkdir -p /pyrocket_scripts && \
RUN /pyrocket_scripts/install-conda-packages.sh ${REPO_DIR}/environment.yml

# Install R, RStudio via Rocker scripts. Requires the prefix for a rocker Dockerfile
# RUN /pyrocket_scripts/install-rocker.sh "verse_${R_VERSION}"
RUN /pyrocket_scripts/install-rocker.sh "verse_${R_VERSION}"

# Install extra apt packages
# Install linux packages after R installation since the R install scripts get rid of packages
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build and push container image](https://github.com/nmfs-opensci/py-rocket-base/actions/workflows/build.yaml/badge.svg)](https://github.com/nmfs-opensci/py-rocket-base/actions/workflows/build.yaml)[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.13942617.svg)](https://doi.org/10.5281/zenodo.13942617)[![GitHub Release](https://img.shields.io/github/v/release/nmfs-opensci/py-rocket-base)](https://github.com/nmfs-opensci/py-rocket-base/releases)

The py-rocket-base image is a base image for the JupyterHubs with Python and RStudio. The py-rocket-base image is designed to install the Jupyter and JupyterHub environment with [repo2docker](https://repo2docker.readthedocs.io) and the R environment with [Rocker](https://rocker-project.org/) installation scripts. You can scroll through the Rocker [installation scripts](https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_rstudio.sh) to see how the environment is set up.
The py-rocket-base image is a base image for the JupyterHubs with Python and RStudio. The py-rocket-base image uses the [Pangeo base-image](https://github.com/pangeo-data/pangeo-docker-images/tree/master/base-image) (minus the `ONBUILD` commands) as the base image (stored in `py-rocket-base/base-image`) and the [pangeo-notebook metapackage](https://github.com/conda-forge/pangeo-notebook-feedstock/blob/main/recipe/meta.yaml) to setup the core JupyterHub environment (following [Pangeo base-notebook](https://github.com/pangeo-data/pangeo-docker-images/blob/master/base-notebook/environment.yml). [Additional Python packages](https://github.com/nmfs-opensci/py-rocket-base/blob/main/environment.yml) are installed to provide a fuller JupyterLab, RStudio, Desktop, and VSCode environment. The R environment is installed with [Rocker](https://rocker-project.org/) installation scripts. You can scroll through the Rocker [installation scripts](https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_rstudio.sh) to see how that environment is set up.

image url
```
Expand Down
13 changes: 7 additions & 6 deletions scripts/install-desktop.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
# Required User: root
# Usage: RUN /pyrocket_scripts/setup-desktop.sh <directory path>"

echo "Running setup-desktop.sh"

Expand Down Expand Up @@ -43,13 +44,13 @@ else
fi

# Check if desktop.sh exists before executing
if [ -f "${REPO_DIR}/desktop.sh" ]; then
echo " Running ${REPO_DIR}/desktop.sh to move Desktop files to appropriate directories and register as applications."
chmod +x "${REPO_DIR}/desktop.sh"
"${REPO_DIR}/desktop.sh"
if [ -f "${REPO_DIR}/scripts/setup-desktop.sh" ]; then
echo " Running ${REPO_DIR}/scripts/setup-desktop.sh to move Desktop files to appropriate directories and register as applications."
chmod +x "${REPO_DIR}/scripts/setup-desktop.sh"
"${REPO_DIR}/scripts/setup-desktop.sh"
else
echo " Warning: desktop.sh not found. Skipping execution."
echo " Warning: ${REPO_DIR}/scripts/setup-desktop.sh not found. Skipping execution."
fi

echo " Success! setup-desktop.sh"
echo " Success! install-desktop.sh"

5 changes: 3 additions & 2 deletions desktop.sh → scripts/setup-desktop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# The default for XDG and xfce4 is for Desktop files to be in ~/Desktop but this leads to a variety of problems
# First we are altering the user directiory which seems rude, second orphan desktop files might be in ~/Desktop so who knows
# what the user Desktop experience with be, here the Desktop dir is set to /usr/share/Desktop so is part of the image.
# users that really want to customize Desktop can change ~/.config/user-dirs.dirs. Though py-rocket-base might not respect that.
# users that want to customize Desktop can change /etc/xdg/user-dirs.dirs though py-rocket resets that each time the server is restarted.
set -e

# Copy in the Desktop files
Expand All @@ -13,7 +13,8 @@ mkdir -p "${DESKTOP_DIR}"
chown :staff /usr/share/Desktop
chmod 775 /usr/share/Desktop
# set the Desktop dir default for XDG
echo "XDG_DESKTOP_DIR=\"${DESKTOP_DIR}\"" > /etc/xdg/user-dirs.defaults
# this is likely not used. It would be used in xdg-user-dirs-update, but that is not run. Doesn't seem to set up /etc/xdg/user-dirs.dirs correctly
echo "DESKTOP=\"${DESKTOP_DIR}\"" > /etc/xdg/user-dirs.defaults

# The for loops will fail if they return null (no files). Set shell option nullglob
shopt -s nullglob
Expand Down

0 comments on commit e394a91

Please sign in to comment.