mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
3.4 KiB

  1. #!/bin/bash
  2. #
  3. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  4. #
  5. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  6. # Please add additional copyright information _after_ the line containing
  7. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  8. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  9. #
  10. # ROCK Linux: rock-src/scripts/Cleanup
  11. # ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
  12. #
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation; either version 2 of the License, or
  16. # (at your option) any later version. A copy of the GNU General Public
  17. # License can be found at Documentation/COPYING.
  18. #
  19. # Many people helped and are helping developing ROCK Linux. Please
  20. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  21. # file for details.
  22. #
  23. # --- ROCK-COPYRIGHT-NOTE-END ---
  24. #
  25. # Cleanup the build environment
  26. #
  27. fullclean=0
  28. nocheck=0
  29. while [ "$1" ] ; do
  30. case "$1" in
  31. -full)
  32. fullclean=1 ; shift ;;
  33. -nocheck)
  34. nocheck=1 ; shift ;;
  35. -*)
  36. echo "Usage: $0 [ -full ] [ -nocheck ] [ dir(s) ]"
  37. exit 1 ;;
  38. *)
  39. break ;;
  40. esac
  41. done
  42. # Remove src*
  43. #
  44. for x in src src.* build/*/ROCK/src.*; do
  45. if [ -d "$x" -o -L "$x" ] ; then
  46. if [ "$#" != 0 ] ; then
  47. delme=0
  48. for y ; do [ "${y%/}" = "$x" ] && delme=1 ; done
  49. [ "$delme" = 0 ] && continue
  50. fi
  51. delme=1
  52. for y in build.pid; do
  53. if [ $delme = 1 -a -f "$x/$y" ] ; then
  54. if [ "`fuser "$x/$y"`" ] ; then
  55. echo "Found active $y in $x: Not removing!"
  56. delme=0
  57. fi
  58. fi
  59. done
  60. if [ $delme = 1 ] ; then
  61. echo "removing $x .."
  62. rm -rf "$x"
  63. fi
  64. fi
  65. done
  66. # Remove build/*
  67. #
  68. fullhelp=0
  69. for x in build/* ; do
  70. if [ -d "$x" ] ; then
  71. if [ "$#" != 0 ] ; then
  72. delme=0
  73. for y ; do [ "${y%/}" = "$x" ] && delme=1 ; done
  74. [ "$delme" = 0 ] && continue
  75. fi
  76. if [ $fullclean = 1 ] ; then
  77. for y in proc ROCK/loop ROCK/config ROCK/download; do
  78. umount -d -f "$x/$y" > /dev/null 2>&1
  79. umount -d -f -l "$x/$y" > /dev/null 2>&1
  80. rmdir "$x/$y" > /dev/null 2>&1
  81. if [ -d "$x/$y" ] ; then
  82. echo "Found $y in $x: Not removing!"
  83. delme=0
  84. fi
  85. done
  86. if [ "$delme" != 0 ] ; then
  87. echo "removing $x .."
  88. rm -rf "$x"
  89. fi
  90. else
  91. echo "Not removing $x."
  92. fullhelp=1
  93. fi
  94. fi
  95. done
  96. [ $fullhelp -eq 1 ] && echo "Use '$0 -full' to also remove build/*."
  97. [ "$nocheck" = 1 ] && exit 0
  98. # Remove temp/backup files
  99. #
  100. bash scripts/xfind.sh Documentation/. architecture/. misc/. \
  101. package/. scripts/. target/. -type f \( -name '*~' -o \
  102. -name 'a.out' -o -name 'core.*' -o -name 'core' \) | xargs rm -vf
  103. # Print warnings for 'liggering' files
  104. #
  105. bash scripts/xfind.sh Documentation/. architecture/. misc/. \
  106. package/. scripts/. target/. \
  107. \( \
  108. \( -name 'DEADJOE' -o -name '*-[xX]' -o -name '.[^.]*' \
  109. -o -name '*.orig' -o -name '*.rej' -o -name '*#*' \
  110. -o -name '*.mine' -o -name '*.r[1-9][0-9]*' \
  111. -o -name TRANS.TBL -o -name '*.cksum-err' -o -name x \
  112. -o -name '*[.-]old' -o -name a.out -o -name '*~' \
  113. -o -name '*.incomplete' -o -name '*.ckext-err' \) \
  114. -printf 'WARNING: Found %p\n' \
  115. \) -o \( \
  116. \( \( ! -type l ! -perm 755 ! -perm 644 \) -o \
  117. \( -type l ! -perm 777 \) \) \
  118. -printf 'WARNING: Non-Standard Perm at %p\n' \
  119. \) -o \( \
  120. \( ! -type d ! -type f \) \
  121. -printf 'WARNING: Neither a dir nor a regular file: %p\n' \
  122. \)
  123. exit 0