4
4
install_echo () { cat $1 | cut -d " %" -f 1 | sed ' /^$/d' | xargs -r -n1 printf ' %s\n' ; }
5
5
6
6
# function to install apt-get packages from a text file which lists package names (add comments with % char)
7
- install_apt () { apt-get -qq update -yq --fix-missing && apt-get -qq install -yq --no-install-recommends ` cat $1 | cut -d ' %' -f 1` ; }
7
+ install_apt () { apt-get -qq update -yq --fix-missing && apt-get -qq install -yq --no-install-recommends $( cat " $1 " | cut -d ' %' -f 1) ; }
8
8
9
9
# function to install conda packages from a text file which lists package names (add comments with % char)
10
10
install_conda () { cat $1 | cut -d " %" -f 1 | sed ' /^$/d' | xargs -r -n1 conda install -yq ; }
@@ -44,8 +44,8 @@ install_mvn() { cat $1 | cut -d "%" -f 1 | xargs -r -n1 -I {} mvn dependency:cop
44
44
install__clean (){
45
45
which apt-get && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/*
46
46
which mamba && mamba clean -ya && rm -rf ~ /micromamba
47
- which conda && conda clean -ya && ( rm -rf /opt/conda/pkgs/* || true )
48
- find /opt/conda/lib | grep -E " (__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
47
+ which conda && conda clean -ya && ( rm -rf " ${CONDA_PREFIX :- / opt/ conda} " /pkgs/* || true )
48
+ find " ${CONDA_PREFIX :- / opt/ conda} " /lib | grep -E " (__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
49
49
which npm && npm cache clean --force
50
50
rm -rf /opt/conda/share/jupyter/lab/staging
51
51
( rm -rf /tmp/.* /tmp/* /var/log/* /var/cache/* /root/.cache /root/.* || true )
@@ -72,21 +72,21 @@ list_installed_packages() {
72
72
}
73
73
74
74
fix_permission () {
75
- DIRECTORY= $1 ; GROUP_ID= $2 ; shift 2 ;
76
- for d in " $DIRECTORY " ; do
75
+ GROUP_ID= ${1 :- 0} ; shift 1 ;
76
+ for d in " $@ " ; do
77
77
find " ${d} " \
78
78
! \( \
79
79
-group " ${GROUP_ID} " \
80
80
-a -perm -g+rwX \
81
81
\) \
82
- -exec chgrp " ${GROUP_ID} " {} \; \
83
- -exec chmod g+rwX {} \;
82
+ -exec chgrp " ${GROUP_ID} " -- {} \+ \
83
+ -exec chmod g+rwX -- {} \+
84
84
# setuid, setgid *on directories only*
85
85
find " ${d} " \
86
86
\( \
87
87
-type d \
88
88
-a ! -perm -6000 \
89
89
\) \
90
- -exec chmod +6000 {} \;
90
+ -exec chmod +6000 -- {} \+ ;
91
91
done
92
92
}
0 commit comments