diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 10:33:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 10:33:11 +0000 |
commit | ae3ecffbd2e40760fef5dc09db30ea8a81abec70 (patch) | |
tree | f3b77bfda1bae06d3326ef27c3cb61539e7f93cc /modules.d/30convertfs/convertfs.sh | |
parent | Adding debian version 102-3. (diff) | |
download | dracut-ae3ecffbd2e40760fef5dc09db30ea8a81abec70.tar.xz dracut-ae3ecffbd2e40760fef5dc09db30ea8a81abec70.zip |
Merging upstream version 103.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'modules.d/30convertfs/convertfs.sh')
-rwxr-xr-x | modules.d/30convertfs/convertfs.sh | 16 |
1 files changed, 4 insertions, 12 deletions
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 || : |