From bdd09560617b8b594248d841b914714e04e27eb4 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 21 Nov 2002 03:51:36 +0000 Subject: [PATCH] Only unlink symlink if its target is the one we linked to. --- v7/src/etc/Clean.sh | 11 +++++------ v7/src/etc/functions.sh | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/v7/src/etc/Clean.sh b/v7/src/etc/Clean.sh index d38676315..13dd05798 100755 --- a/v7/src/etc/Clean.sh +++ b/v7/src/etc/Clean.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: Clean.sh,v 1.8 2002/11/21 03:39:27 cph Exp $ +# $Id: Clean.sh,v 1.9 2002/11/21 03:51:18 cph Exp $ # # Copyright (c) 2000, 2001, 2002 Massachusetts Institute of Technology # @@ -68,11 +68,10 @@ if [ "${DIST}" = "yes" ]; then fi if [ "${MAINTAINER}" = "yes" ]; then - for FN in .edwin-ffi Clean.sh Makefile Setup.sh Stage.sh Tags.sh; do - if [ -L ${FN} ]; then - echo "rm ${FN}" - rm ${FN} - fi + maybe_unlink Makefile ../Makefile.std + maybe_unlink .edwin-ffi ed-ffi.scm + for FN in Clean.sh Setup.sh Stage.sh Tags.sh; do + maybe_unlink "${FN}" "../etc/${FN}" done fi diff --git a/v7/src/etc/functions.sh b/v7/src/etc/functions.sh index 9d6f9cba4..56afef831 100644 --- a/v7/src/etc/functions.sh +++ b/v7/src/etc/functions.sh @@ -1,8 +1,8 @@ #!/bin/sh # -# $Id: functions.sh,v 1.2 2002/11/20 19:46:05 cph Exp $ +# $Id: functions.sh,v 1.3 2002/11/21 03:51:36 cph Exp $ # -# Copyright (c) 2000 Massachusetts Institute of Technology +# Copyright (c) 2000, 2002 Massachusetts Institute of Technology # # This file is part of MIT Scheme. # @@ -25,16 +25,24 @@ maybe_mkdir () { - if [ ! -e ${1} ]; then + if [ ! -e "${1}" ]; then echo "mkdir ${1}" - mkdir ${1} + mkdir "${1}" fi } maybe_link () { - if [ ! -e ${1} ] && [ ! -L ${1} ]; then + if [ ! -e "${1}" ] && [ ! -L "${1}" ]; then echo "ln -s ${2} ${1}" - ln -s ${2} ${1} + ln -s "${2}" "${1}" + fi +} + +maybe_unlink () +{ + if [ -L "${1}" ] && [ "${1}" -ef "${2}" ]; then + echo "rm ${1}" + rm "${1}" fi } -- 2.25.1