From 203af7302854f453fa4a05ecefd4403b6c8a4f8d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 26 Aug 2024 12:33:11 +0200 Subject: Adding upstream version 103. Signed-off-by: Daniel Baumann --- modules.d/30convertfs/convertfs.sh | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'modules.d/30convertfs') diff --git a/modules.d/30convertfs/convertfs.sh b/modules.d/30convertfs/convertfs.sh index 58fa56d..1052e5c 100755 --- a/modules.d/30convertfs/convertfs.sh +++ b/modules.d/30convertfs/convertfs.sh @@ -21,13 +21,13 @@ while [[ $ROOT != "${ROOT%/}" ]]; do ROOT=${ROOT%/} done -if [ ! -L "$ROOT"/var/run -a -e "$ROOT"/var/run ]; then +if [ ! -L "$ROOT"/var/run ] && [ -e "$ROOT"/var/run ]; then echo "Converting /var/run to symlink" mv -f "$ROOT"/var/run "$ROOT"/var/run.runmove~ ln -sfn ../run "$ROOT"/var/run fi -if [ ! -L "$ROOT"/var/lock -a -e "$ROOT"/var/lock ]; then +if [ ! -L "$ROOT"/var/lock ] && [ -e "$ROOT"/var/lock ]; then echo "Converting /var/lock to symlink" mv -f "$ROOT"/var/lock "$ROOT"/var/lock.lockmove~ ln -sfn ../run/lock "$ROOT"/var/lock @@ -72,16 +72,8 @@ if [[ ! -e $testfile ]]; then fi rm -f -- "$testfile" -find_mount() { - local dev wanted_dev - wanted_dev="$(readlink -e -q "$1")" - while read -r dev _ || [ -n "$dev" ]; do - [ "$dev" = "$wanted_dev" ] && echo "$dev" && return 0 - done < /proc/mounts - return 1 -} - # clean up after ourselves no matter how we die. +# shellcheck disable=SC2317 # called via EXIT trap cleanup() { echo "Something failed. Move back to the original state" for dir in "$ROOT/bin" "$ROOT/sbin" "$ROOT/lib" "$ROOT/lib64" \ @@ -114,7 +106,7 @@ for dir in bin sbin lib lib64; do echo "Merge the copy with \`$ROOT/$dir'." [[ -d "$ROOT/usr/${dir}.usrmove-new" ]] \ || mkdir -p "$ROOT/usr/${dir}.usrmove-new" - cp -axT $CP_HARDLINK --backup --suffix=.usrmove~ "$ROOT/$dir" "$ROOT/usr/${dir}.usrmove-new" + cp -axT ${CP_HARDLINK:+"$CP_HARDLINK"} --backup --suffix=.usrmove~ "$ROOT/$dir" "$ROOT/usr/${dir}.usrmove-new" echo "Clean up duplicates in \`$ROOT/usr/$dir'." # delete all symlinks that have been backed up find "$ROOT/usr/${dir}.usrmove-new" -type l -name '*.usrmove~' -delete || : -- cgit v1.2.3