Skip to content
Snippets Groups Projects
Commit 5a1cbb7f authored by Ludovico de Nittis's avatar Ludovico de Nittis
Browse files

Merge branch 'wip/variable-dir' into 'master'

Unpack runtimes into var/ by default

See merge request !29
parents 6cb59402 409a50a5
No related branches found
No related tags found
1 merge request!29Unpack runtimes into var/ by default
Pipeline #7495 passed with warnings
...@@ -13,7 +13,7 @@ is_main=yes ...@@ -13,7 +13,7 @@ is_main=yes
suite=scout suite=scout
verbose= verbose=
log_to_file= log_to_file=
log_dir=${STEAM_LINUX_RUNTIME_LOG_DIR-"${here}/var"} log_dir=${STEAM_LINUX_RUNTIME_LOG_DIR-"${PRESSURE_VESSEL_VARIABLE_DIR-"${here}/var"}"}
keep_logs= keep_logs=
use_timestamp= use_timestamp=
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# deploy-runtime — unpack and deploy a new runtime # deploy-runtime — unpack and deploy a new runtime
# #
# Copyright © 2019 Collabora Ltd. # Copyright © 2019-2021 Collabora Ltd.
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
# #
...@@ -64,7 +64,7 @@ usage () { ...@@ -64,7 +64,7 @@ usage () {
echo "Options:" echo "Options:"
echo "--arch ARCH Use architecture(s) ARCH instead of amd64,i386" echo "--arch ARCH Use architecture(s) ARCH instead of amd64,i386"
echo "--basename NAME Unpack archive based on NAME instead of RUNTIME-SUITE-ARCH" echo "--basename NAME Unpack archive based on NAME instead of RUNTIME-SUITE-ARCH"
echo "--name DIR Unpack into DIR instead of SUITE" echo "--name DIR Unpack into var/DIR, instead of var/SUITE"
echo "--runtime RUNTIME Use runtime RUNTIME instead of" echo "--runtime RUNTIME Use runtime RUNTIME instead of"
echo " com.valvesoftware.SteamRuntime.Platform" echo " com.valvesoftware.SteamRuntime.Platform"
echo "--suite SUITE Use suite SUITE instead of scout" echo "--suite SUITE Use suite SUITE instead of scout"
...@@ -156,6 +156,20 @@ while [ "$#" -gt 0 ]; do ...@@ -156,6 +156,20 @@ while [ "$#" -gt 0 ]; do
esac esac
done done
if [ -z "${PRESSURE_VESSEL_VARIABLE_DIR-}" ]; then
mkdir -p "${here}/var"
export PRESSURE_VESSEL_VARIABLE_DIR="${here}/var"
fi
# Make it absolute
case "$PRESSURE_VESSEL_VARIABLE_DIR" in
(/*)
;;
(*)
export PRESSURE_VESSEL_VARIABLE_DIR="${here}/${PRESSURE_VESSEL_VARIABLE_DIR}"
;;
esac
if [ -z "$basename" ]; then if [ -z "$basename" ]; then
basename="${runtime}-${arch}-${suite}" basename="${runtime}-${arch}-${suite}"
fi fi
...@@ -182,38 +196,47 @@ check_ok_for_filename "build ID" "$current_build_id" ...@@ -182,38 +196,47 @@ check_ok_for_filename "build ID" "$current_build_id"
updated= updated=
# Ensure that current_build_id is unpacked # Ensure that current_build_id is unpacked
if [ -d "${here}/${name}_${current_build_id}/files" ]; then if [ -d "${PRESSURE_VESSEL_VARIABLE_DIR}/${name}_${current_build_id}/files" ]; then
verbose "${name}_${current_build_id}/files already unpacked" verbose "${name}_${current_build_id}/files already unpacked"
else else
rm -fr --one-file-system "${here}/.${name}_${current_build_id}_unpack-temp" rm -fr --one-file-system "${PRESSURE_VESSEL_VARIABLE_DIR}/.${name}_${current_build_id}_unpack-temp"
mkdir "${here}/.${name}_${current_build_id}_unpack-temp" mkdir "${PRESSURE_VESSEL_VARIABLE_DIR}/.${name}_${current_build_id}_unpack-temp"
tar -C "${here}/.${name}_${current_build_id}_unpack-temp" -z"${tar_v}"xf "${here}/${basename}-runtime.tar.gz" tar \
-C "${PRESSURE_VESSEL_VARIABLE_DIR}/.${name}_${current_build_id}_unpack-temp" \
-z"${tar_v}"xf \
"${here}/${basename}-runtime.tar.gz"
# If we have the detached debug symbols, we extract them too # If we have the detached debug symbols, we extract them too
if [ -f "${here}/${basename}-debug.tar.gz" ]; then if [ -f "${here}/${basename}-debug.tar.gz" ]; then
tar -C "${here}/.${name}_${current_build_id}_unpack-temp/files/lib/debug" \ tar \
-C "${PRESSURE_VESSEL_VARIABLE_DIR}/.${name}_${current_build_id}_unpack-temp/files/lib/debug" \
--strip-components=1 \ --strip-components=1 \
-z"${tar_v}"xf \ -z"${tar_v}"xf \
"${here}/${basename}-debug.tar.gz" \ "${here}/${basename}-debug.tar.gz" \
"files/" "files/"
fi fi
mv "${here}/.${name}_${current_build_id}_unpack-temp" "${here}/${name}_${current_build_id}" mv \
"${PRESSURE_VESSEL_VARIABLE_DIR}/.${name}_${current_build_id}_unpack-temp" \
"${PRESSURE_VESSEL_VARIABLE_DIR}/${name}_${current_build_id}"
updated=yes updated=yes
fi fi
if [ -z "$updated" ] \ if [ -z "$updated" ] \
&& [ -d "${here}/${name}/files" ] \ && [ -d "${PRESSURE_VESSEL_VARIABLE_DIR}/${name}/files" ] \
&& [ -L "${here}/${name}" ] && [ -L "${PRESSURE_VESSEL_VARIABLE_DIR}/${name}" ]
then then
verbose "${name} is already a symlink to some runtime" verbose "${name} is already a symlink to some runtime"
else else
if [ -e "${here}/${name}" ] && ! [ -L "${here}/${name}" ]; then rm -fr "${PRESSURE_VESSEL_VARIABLE_DIR}/${name}"
mv "${here}/${name}" "${here}/${name}_before_${current_build_id}" ln -fns "${name}_${current_build_id}" "${PRESSURE_VESSEL_VARIABLE_DIR}/${name}"
fi fi
ln -fns "${name}_${current_build_id}" "${here}/${name}" if [ -L "${here}/${name}" ]
then
verbose "Removing old symbolic link ${here}/${name}"
rm -f "${here}/${name}" || :
fi fi
pressure_vessel="${PRESSURE_VESSEL_PREFIX:-"${here}/pressure-vessel"}" pressure_vessel="${PRESSURE_VESSEL_PREFIX:-"${here}/pressure-vessel"}"
...@@ -221,11 +244,17 @@ pressure_vessel="${PRESSURE_VESSEL_PREFIX:-"${here}/pressure-vessel"}" ...@@ -221,11 +244,17 @@ pressure_vessel="${PRESSURE_VESSEL_PREFIX:-"${here}/pressure-vessel"}"
adverb="$pressure_vessel/bin/pressure-vessel-adverb" adverb="$pressure_vessel/bin/pressure-vessel-adverb"
# GC old runtimes # GC old runtimes
for deployment in "${here}/${name}"_before_* "${here}/${name}"_[0-9].* "${here}/.${name}"_*_unpack-temp; do for deployment in \
"${here}/${name}"_before_* \
"${here}/${name}"_[0-9].* \
"${here}/.${name}"_*_unpack-temp \
"${PRESSURE_VESSEL_VARIABLE_DIR}/${name}"_[0-9].* \
"${PRESSURE_VESSEL_VARIABLE_DIR}/.${name}"_*_unpack-temp \
; do
if ! [ -d "$deployment" ]; then if ! [ -d "$deployment" ]; then
continue continue
fi fi
if [ "x$deployment" = "x${here}/${name}_${current_build_id}" ]; then if [ "x$deployment" = "x${PRESSURE_VESSEL_VARIABLE_DIR}/${name}_${current_build_id}" ]; then
continue continue
fi fi
if ! [ -d "$deployment/files" ]; then if ! [ -d "$deployment/files" ]; then
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# run-in-steamrt — undo the Steam Runtime's environment and use # run-in-steamrt — undo the Steam Runtime's environment and use
# a given runtime, assuming the layout of the SteamLinuxRuntime depot. # a given runtime, assuming the layout of the SteamLinuxRuntime depot.
# #
# Copyright © 2019-2020 Collabora Ltd. # Copyright © 2019-2021 Collabora Ltd.
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
# #
...@@ -204,6 +204,20 @@ check_ok_for_filename SUITE "$suite" ...@@ -204,6 +204,20 @@ check_ok_for_filename SUITE "$suite"
pressure_vessel="${PRESSURE_VESSEL_PREFIX:-"${here}/pressure-vessel"}" pressure_vessel="${PRESSURE_VESSEL_PREFIX:-"${here}/pressure-vessel"}"
if [ -z "${PRESSURE_VESSEL_VARIABLE_DIR-}" ]; then
mkdir -p "${here}/var"
export PRESSURE_VESSEL_VARIABLE_DIR="${here}/var"
fi
# Make it absolute
case "$PRESSURE_VESSEL_VARIABLE_DIR" in
(/*)
;;
(*)
export PRESSURE_VESSEL_VARIABLE_DIR="${here}/${PRESSURE_VESSEL_VARIABLE_DIR}"
;;
esac
adverb="$pressure_vessel/bin/pressure-vessel-adverb" adverb="$pressure_vessel/bin/pressure-vessel-adverb"
if [ -n "$deploy" ]; then if [ -n "$deploy" ]; then
...@@ -211,10 +225,10 @@ if [ -n "$deploy" ]; then ...@@ -211,10 +225,10 @@ if [ -n "$deploy" ]; then
# Ignore: there is no build ID in the depot. We'll just use a # Ignore: there is no build ID in the depot. We'll just use a
# ${name} directory if it exists. # ${name} directory if it exists.
: :
elif [ -d "${here}/${name}_${current_build_id}/files" ] \ elif [ -d "${PRESSURE_VESSEL_VARIABLE_DIR}/${name}_${current_build_id}/files" ] \
&& [ -d "${here}/${name}" ] \ && [ -d "${PRESSURE_VESSEL_VARIABLE_DIR}/${name}" ] \
&& [ -L "${here}/${name}" ] \ && [ -L "${PRESSURE_VESSEL_VARIABLE_DIR}/${name}" ] \
&& [ "x$(readlink "${here}/${name}")" = "x${name}_${current_build_id}" ] && [ "x$(readlink "${PRESSURE_VESSEL_VARIABLE_DIR}/${name}")" = "x${name}_${current_build_id}" ]
then then
# Fast path: skip the locking and the deploy step if the correct runtime # Fast path: skip the locking and the deploy step if the correct runtime
# is already in place. # is already in place.
...@@ -227,7 +241,7 @@ if [ -n "$deploy" ]; then ...@@ -227,7 +241,7 @@ if [ -n "$deploy" ]; then
unset LD_PRELOAD unset LD_PRELOAD
"$adverb" \ "$adverb" \
--create --write --wait \ --create --write --wait \
--lock-file "$here/.ref" \ --lock-file "${PRESSURE_VESSEL_VARIABLE_DIR}/.ref" \
-- \ -- \
"$here/deploy-runtime" \ "$here/deploy-runtime" \
--arch="${arch}" \ --arch="${arch}" \
...@@ -242,16 +256,21 @@ if [ -n "$deploy" ]; then ...@@ -242,16 +256,21 @@ if [ -n "$deploy" ]; then
fi fi
if [ -e /.flatpak-info ] && [ -z "${PRESSURE_VESSEL_COPY_RUNTIME_INTO+set}" ]; then if [ -e /.flatpak-info ] && [ -z "${PRESSURE_VESSEL_COPY_RUNTIME_INTO+set}" ]; then
mkdir -p "${here}/var" export PRESSURE_VESSEL_COPY_RUNTIME_INTO="$PRESSURE_VESSEL_VARIABLE_DIR"
export PRESSURE_VESSEL_COPY_RUNTIME_INTO="${here}/var"
fi fi
if [ -e "${here}/var/copy-runtime" ] && [ -z "${PRESSURE_VESSEL_COPY_RUNTIME_INTO+set}" ]; then if [ -e "${here}/var/copy-runtime" ] && [ -z "${PRESSURE_VESSEL_COPY_RUNTIME_INTO+set}" ]; then
export PRESSURE_VESSEL_COPY_RUNTIME_INTO="${here}/var" export PRESSURE_VESSEL_COPY_RUNTIME_INTO="$PRESSURE_VESSEL_VARIABLE_DIR"
fi fi
export PRESSURE_VESSEL_RUNTIME_BASE="${here}" export PRESSURE_VESSEL_RUNTIME_BASE="${here}"
export PRESSURE_VESSEL_RUNTIME="${name}/files"
if [ -d "${PRESSURE_VESSEL_VARIABLE_DIR}/${name}/files" ]; then
export PRESSURE_VESSEL_RUNTIME="${PRESSURE_VESSEL_VARIABLE_DIR}/${name}/files"
else
export PRESSURE_VESSEL_RUNTIME="${name}/files"
fi
exec "$pressure_vessel/bin/pressure-vessel-unruntime" "$@" exec "$pressure_vessel/bin/pressure-vessel-unruntime" "$@"
# vim:set sw=4 sts=4 et: # vim:set sw=4 sts=4 et:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment