-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathpostStartCommand.sh
More file actions
executable file
·70 lines (62 loc) · 3.22 KB
/
postStartCommand.sh
File metadata and controls
executable file
·70 lines (62 loc) · 3.22 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
# Copyright (c) 2023 b-data GmbH
# Distributed under the terms of the MIT License.
set -e
# Create R user library
mkdir -p "$(Rscript -e "cat(Sys.getenv('R_LIBS_USER'))")"
if [ -n "${RSTUDIO_VERSION}" ]; then
# Set environment variables in Renviron.site
exclude_vars="HOME LD_LIBRARY_PATH OLDPWD PATH PWD RSTUDIO_VERSION SHLVL"
for var in $(compgen -e); do
[[ ! $exclude_vars =~ $var ]] && echo "$var='${!var//\'/\'\\\'\'}'" \
>> "$(R RHOME)/etc/Renviron.site"
done
RS_USD="$HOME/.config/rstudio"
# Install RStudio settings if home directory is bind mounted
mkdir -p "$RS_USD"
if [[ ! -f "$RS_USD/rstudio-prefs.json" ]]; then
cp -a /etc/skel/.config/rstudio/rstudio-prefs.json \
"$RS_USD/rstudio-prefs.json"
fi
# Create user's working folder
mkdir -p "$HOME/working"
fi
# Copy QGIS stuff from skeleton directory if home directory is bind mounted
if [ "$(id -un)" == "root" ]; then
if [ "$(command -v qgis)" ] && [ ! -d /root/.local/share ]; then
cp -R /etc/skel/.local/share /root/.local;
fi
# Copy plugin 'Processing Saga NextGen Provider'
if [ "$(command -v qgis)" ]; then
rm -rf /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/processing_saga_nextgen;
cp -R /etc/skel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/processing_saga_nextgen \
/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/processing_saga_nextgen;
fi
# Copy plugin 'OrfeoToolbox Provider'
if [ "$(command -v qgis)" ] && [ ! -d /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/orfeoToolbox_provider ]; then
if [ -d /etc/skel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/orfeoToolbox_provider ]; then
cp -R /etc/skel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/orfeoToolbox_provider \
/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/orfeoToolbox_provider;
fi
fi
else
if [ "$(command -v qgis)" ] && [ ! -d "$HOME/.local/share" ]; then
sudo cp -R /etc/skel/.local/share "$HOME/.local";
sudo chown -R "$(id -u)":"$(id -g)" "$HOME/.local/share";
fi
# Copy plugin 'Processing Saga NextGen Provider'
if [ "$(command -v qgis)" ]; then
sudo rm -rf "$HOME/.local/share/QGIS/QGIS3/profiles/default/python/plugins/processing_saga_nextgen";
sudo cp -R /etc/skel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/processing_saga_nextgen \
"$HOME/.local/share/QGIS/QGIS3/profiles/default/python/plugins/processing_saga_nextgen";
sudo chown -R "$(id -u)":"$(id -g)" "$HOME/.local/share/QGIS/QGIS3/profiles/default/python/plugins/processing_saga_nextgen";
fi
# Copy plugin 'OrfeoToolbox Provider'
if [ "$(command -v qgis)" ] && [ ! -d "$HOME/.local/share/QGIS/QGIS3/profiles/default/python/plugins/orfeoToolbox_provider" ]; then
if [ -d /etc/skel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/orfeoToolbox_provider ]; then
sudo cp -R /etc/skel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/orfeoToolbox_provider \
"$HOME/.local/share/QGIS/QGIS3/profiles/default/python/plugins/orfeoToolbox_provider";
sudo chown -R "$(id -u)":"$(id -g)" "$HOME/.local/share/QGIS/QGIS3/profiles/default/python/plugins/orfeoToolbox_provider";
fi
fi
fi