@@ -9,6 +9,15 @@ CONTAINER_TAG=`cat ${ROOT}/bin/.container-tag`
99# Parse command line arguments
1010PRESERVE_CONFIG=0
1111
12+ CONTAINER_SETUP_CMD=()
13+ run () {
14+ if [ " ${CONTAINER_TYPE} " == " docker" -o " ${CONTAINER_TYPE} " == " podman" ]; then
15+ CONTAINER_SETUP_CMD+=( " $* " )
16+ else
17+ ${RUN} " $@ "
18+ fi
19+ }
20+
1221# Only parse arguments if this script is being run directly (not sourced)
1322if [[ " ${BASH_SOURCE[0]} " == " ${0} " ]]; then
1423 for arg in " $@ " ; do
@@ -159,10 +168,8 @@ if [ -f $ROOT/.git ]; then
159168 HOME_OPT=" ${HOME_OPT} --bind ${GIT_PATH} :${GIT_PATH} "
160169fi
161170
162- if [ " ${CONTAINER_TYPE} " == " devcontainer" ]; then
171+ if [ " ${CONTAINER_TYPE} " == " devcontainer" -o " ${CONTAINER_TYPE} " == " docker " -o " ${CONTAINER_TYPE} " == " podman " ]; then
163172 RUN=" "
164- elif [ " ${CONTAINER_TYPE} " == " docker" -o " ${CONTAINER_TYPE} " == " podman" ]; then
165- RUN=" ${CONTAINER_BASE} "
166173elif [ " ${CONTAINER_TYPE} " == " singularity" ]; then
167174 RUN=" singularity run ${HOME_OPT} ${CONTAINER_PATH} "
168175else
@@ -180,16 +187,16 @@ if [ $PRESERVE_CONFIG -eq 0 ] || [ ! -f $ROOT/.bundle/config ]; then
180187 fi
181188 OLDDIR=$PWD
182189 cd $ROOT
183- ${RUN} bundle config set --local path ${ROOT} /.home/.gems
184- ${RUN} bundle config set --local cache_path ${ROOT} /.home/.cache
185- ${RUN} bundle config set --local with development
190+ run bundle config set --local path ${ROOT} /.home/.gems
191+ run bundle config set --local cache_path ${ROOT} /.home/.cache
192+ run bundle config set --local with development
186193 cd $OLDDIR
187194fi
188195
189196if [ ! -d $ROOT /.home/.gems ]; then
190197 OLDDIR=$PWD
191198 cd $ROOT
192- ${RUN} bundle install
199+ run bundle install
193200 cd $OLDDIR
194201fi
195202
@@ -198,13 +205,13 @@ if [ ! -f $ROOT/ext/rbi-central/README.md ]; then
198205fi
199206
200207if [ ! -d $ROOT /.home/.venv ]; then
201- ${RUN} /usr/bin/python3 -m venv ${ROOT} /.home/.venv
208+ run /usr/bin/python3 -m venv ${ROOT} /.home/.venv
202209fi
203210
204- source ${ROOT} /.home/.venv/bin/activate
211+ run source ${ROOT} /.home/.venv/bin/activate
205212
206213if [ ! -f ${ROOT} /.home/.venv/bin/pre-commit ]; then
207- ${RUN} ${ROOT} /.home/.venv/bin/pip install -r requirements.txt
214+ run ${ROOT} /.home/.venv/bin/pip install -r requirements.txt
208215fi
209216
210217# if [ ! -f $ROOT/ext/riscv-opcodes/README.md ]; then
213220
214221if [[ ! -z " $DEVELOPMENT " && $DEVELOPMENT -eq 1 ]]; then
215222 if [ ! -d " ${ROOT} /.home/.yard/gem_index" ]; then
216- ${RUN} bundle exec --gemfile ${ROOT} /Gemfile yard config --gem-install-yri
217- ${RUN} bundle exec --gemfile ${ROOT} /Gemfile yard gems
223+ run bundle exec --gemfile ${ROOT} /Gemfile yard config --gem-install-yri
224+ run bundle exec --gemfile ${ROOT} /Gemfile yard gems
218225 touch ${ROOT} /.stamps/dev_gems
219226 fi
220227fi
221228
222229if [ ! -d ${ROOT} /node_modules ]; then
223- ${RUN} npm i
230+ run npm i
224231fi
225232
226233if [ " ${CONTAINER_TYPE} " == " devcontainer" ]; then
0 commit comments