install-lss.sh 802 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. # $LynxId: install-lss.sh,v 1.1 2007/05/13 22:15:29 tom Exp $
  3. # install lynx.lss, ensuring the old config-file is saved to a backup file.
  4. #
  5. # $1 = install program
  6. # $2 = file to install
  7. # $3 = where to install it
  8. PRG="$1"
  9. SRC=$2
  10. DST=$3
  11. if test -f "$DST" ; then
  12. # See if we have saved this information before
  13. if cmp -s $SRC $DST
  14. then
  15. echo "... installed $DST would not be changed"
  16. else
  17. NUM=1
  18. while test -f ${DST}-${NUM}
  19. do
  20. if cmp -s $SRC ${DST}-${NUM}
  21. then
  22. break
  23. fi
  24. NUM=`expr $NUM + 1`
  25. done
  26. if test ! -f ${DST}-${NUM}
  27. then
  28. echo "... saving old config as ${DST}-${NUM}"
  29. mv $DST ${DST}-${NUM} || exit 1
  30. fi
  31. echo "** installing $SRC as $DST"
  32. eval $PRG $SRC $DST || exit 1
  33. fi
  34. else
  35. echo "** installing $SRC as $DST"
  36. eval $PRG $SRC $DST || exit 1
  37. fi