aboutsummaryrefslogtreecommitdiff
path: root/usr/share/ddtools/build/get-files
blob: 3302cc5bf1d8d2ba60452e2df5d462126f152d57 (plain)
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
#!/bin/sh
# File: get-files
case "${1}" in
   rpm)
if test -n "${package}"; then cd ${rpmbuilddir}/SOURCES/"${package}-${version}"; else cd $( pwd | sed -r -e 's/(SOURCES\/[^\/]+\/).*/\1/;' ); fi

### for rpm
find * -type d -regextype grep \
   \( -regex 'usr\/share\/ddtools*' -o -regex 'etc\/ddtools*' \) \
   ! -regex '.*gui.*' \
   | sed -e 's/^/%dir \//;'
find * -mindepth 1 ! -name "${package}.spec.$$.swp" \
   ! -type d -regextype grep \
   ! -regex '.*.swp' \
   ! -regex '.*DEBIAN.*' \
   | sed -r -e '
s/^/\//;
s/(.*\.txt)/%doc %attr(444, -, -) \1/;
s/(.*bin.*)/%verify(link) \1/;
s/(.*)\.py$/\1\.py\n\1\.pyc\n\1\.pyo/;
s/(.*\.conf)/%config %attr(666, -, -) \1/;
s/(\/usr)?\/lib\/systemd\/system\/(.*)/%{_unitdir}\/\2/;
'

      ;;
   deb)

### for deb
find . -mindepth 1 ! -name "${package}.spec\.$$\.swp" \
   ! -type d -regextype grep \
   ! -regex '.*hg.*' ! -regex '.*?debian-binary.*' \
   ! -regex '.*DEBIAN.*' ! -regex '.*\.swp' ! -regex '.*\.git.*' ! -name 'README.md' \
   -printf '%P '

      ;;
   *)
      echo "FATAL ERROR: check ./pack or get-files-core. Please use [ rpm | deb ] option. Aborted." 1>&2
      exit 1
      ;;
esac
bgstack15