diff options
author | Simon Rettberg | 2020-08-07 17:56:46 +0200 |
---|---|---|
committer | Simon Rettberg | 2020-08-07 17:56:46 +0200 |
commit | 6c04c02b8e63313f30c07a47eb3dfab590dddf71 (patch) | |
tree | 4cd4a0e0d336da245dccbce54dea9f8cb1d817a5 /core/rootfs | |
parent | [run-virt] Fix timeout calls wrt busybox commit c9720a76 (diff) | |
download | mltk-6c04c02b8e63313f30c07a47eb3dfab590dddf71.tar.gz mltk-6c04c02b8e63313f30c07a47eb3dfab590dddf71.tar.xz mltk-6c04c02b8e63313f30c07a47eb3dfab590dddf71.zip |
[rootfs-stage31] Workaround for busybox tar
Busybox tar (newer versions, tested 1.31.1) print an error and exit 1 if
two identical symlinks exist in the archive. This works with GNU tar and
older versions of busybox. As busybox tar only prints an error but keeps
extracting the remaining files, consider this error a success.
Diffstat (limited to 'core/rootfs')
-rw-r--r-- | core/rootfs/rootfs-stage31/data/inc/activate_sysconfig | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig b/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig index 2d6015e1..c93d6e0d 100644 --- a/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig +++ b/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig @@ -65,7 +65,15 @@ install_config_tgz() { local TEMP_EXTRACT_DIR="/tmp/config.tgz.tmp" # TODO perserve existing directories permissions (but overwrite the permissions of files!) mkdir -p "${TEMP_EXTRACT_DIR}" - tar xf "${CONFIG}.tgz" -C "${TEMP_EXTRACT_DIR}" || { echo "Could not untar ${CONFIG}.tgz to ${TEMP_EXTRACT_DIR}"; return 1; } + # Recent versions of busybox tar bail out if two symlinks with the same name exist in archive + if ! tar xf "${CONFIG}.tgz" -C "${TEMP_EXTRACT_DIR}" 2> /tmp/tarpit; then + # Exit code is unclean... + if ! [ -s /tmp/tarpit ] || grep -q -v 'create symlink' /tmp/tarpit; then + # ...and we have en empty error log, OR any error that isn't "can't create symlink" -> abort + echo "Could not untar ${CONFIG}.tgz to ${TEMP_EXTRACT_DIR}" + return 1 + fi + fi # Write list to stage32 for debug tar tvf "${CONFIG}.tgz" > "${FUTURE_ROOT}/opt/openslx/config.tgz.list" 2>&1 chown -R 0:0 "${TEMP_EXTRACT_DIR}" 2>/dev/null |