File: clean

package info (click to toggle)
linbot 0.8-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 140 kB
  • ctags: 5
  • sloc: sh: 602; makefile: 126; perl: 7
file content (114 lines) | stat: -rwxr-xr-x 2,409 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/sh
#
# source:
#   /var/cvs/projects/debian/dpkg.common/clean,v
#
# revision:
#   @(#) clean,v 1.6 1998/04/25 03:19:45 jplejacq Exp
#
# copyright:
#   Copyright (C) 1998 Jean Pierre LeJacq <jplejacq@quoininc.com>
#
#   Distributed under the GNU GENERAL PUBLIC LICENSE.
#
# synopsis:
#   clean
#
# description:
#   Cleans directory of all generated files except scheme-*.
#
#   I change the ownership of the files before removing them to limit
#   the set of commands that require root priveleges.  chown is
#   necessary but rm is not.
#
#   This program is careful about not removing CVS directories when
#   using the non-exported version of the package.
#
#   This program is package independent and should work unmodified
#   with any package.


# main:
  set -e


  PATH=debian:${PATH}:/usr/lib/debhelper

  . /usr/lib/debhelper/dh_lib


  echo "${0}: removing generated debian supplemental files..."
    find debian/dpkg.src\
      \( -type d -name CVS -prune \)\
      -o\
      \(\
        \(\
          -type d\
          -o\
          -name "*.in"\
          -o\
          -name changelog\
          -o\
          -name control\
        \)\
        -o\
        \(\
          -exec chown "$(id -r -u):$(id -r -g)" {} \;\
          -exec rm -f {} \;\
        \)\
      \)


  echo "${0}: removing generated debian scripts..."
    find debian/dpkg.scripts\
      \( -type d -name CVS -prune \)\
      -o\
      \(\
        \(\
          -type d\
          -o\
          -name "*.in"\
          -o\
          -name "clean"\
          -o\
          -name "modifydpkg"\
          -o\
          -name "substfiles"\
        \)\
        -o\
        \(\
          -exec chown "$(id -r -u):$(id -r -g)" {} \;\
          -exec rm -f {} \;\
        \)\
      \)


  echo "${0}: removing source and build directories..."
    for srcdir in ${DH_DOPACKAGES}
    do
      if [ -d "debian/${srcdir}.src" ]
      then
        chown -R "$(id -r -u):$(id -r -g)" debian/${srcdir}.src
        rm -r -f debian/${srcdir}.src
      fi

      if [ -d "debian/${srcdir}.tmp" ]
      then
        chown -R "$(id -r -u):$(id -r -g)" debian/${srcdir}.tmp
        rm -r -f debian/${srcdir}.tmp
      fi
    done


  echo "${0}: removing makefile stamps..."
    find debian\
      -maxdepth 1\
      -name "*.stamp-*"\
      -exec chown -R "$(id -r -u):$(id -r -g)" {} \;\
      -exec rm -r -f {} \;


  dh_clean


  exit 0