Magellan Linux

Annotation of /trunk/mage/usr/lib/mage/pkg_all_sources.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2268 - (hide annotations) (download) (as text)
Fri Oct 25 06:48:57 2013 UTC (10 years, 6 months ago) by niro
File MIME type: application/x-sh
File size: 1860 byte(s)
-fixed header
1 niro 423 #!/bin/bash
2     # build all source packages for given distribution
3 niro 2268 # $Id$
4 niro 423
5 niro 1642 : ${MAGERC="/etc/mage.rc"}
6    
7     source /etc/mage.rc.global
8     source ${MAGERC}
9     source ${MLIBDIR}/mage4.functions.sh
10     source ${MLIBDIR}/smage2.functions.sh
11    
12     if ! have_root_privileges
13 niro 423 then
14     echo "You must be r00t"
15     exit 1
16     fi
17    
18     DISTRI="$1"
19    
20     if [[ -z ${DISTRI} ]]
21     then
22     echo "No Distribution given ..."
23     exit 1
24     fi
25    
26     blacklisted()
27     {
28     local EXCLUDED="${MROOT}/etc/mage-profile/package.blacklist-${ARCH}-${DISTRI}"
29    
30     # return 0 if the list not exist; nothin is masked
31     [[ ! -f ${EXCLUDED} ]] && return 0
32    
33     local SMAGEFILE="$1"
34    
35 niro 1642 smagesource ${SMAGEFILE}
36 niro 423
37     local EXPCAT EXPNAME EXPVER EXPBUILD
38     while read EXPCAT EXPNAME EXPVER EXPBUILD
39     do
40     # ignore spaces and comments
41 niro 1955 case "${EXPCAT}" in
42     \#*|"") continue ;;
43     esac
44 niro 423
45     # exclude full pver
46 niro 1642 if [[ -n ${PCAT} ]] && [[ -n ${PNAME} ]] &&
47 niro 423 [[ -n ${EXPCAT} ]] && [[ -n ${EXPNAME} ]] &&
48     [[ -n ${PVER} ]] && [[ -n ${PBUILD} ]] &&
49     [[ -n ${EXPVER} ]] && [[ -n ${EXPBUILD} ]]
50     then
51 niro 1642 [[ ${EXPCAT}/${EXPNAME}-${EXPVER}-${EXPBUILD} = ${PCAT}/${PNAME}-${PVER}-${PBUILD} ]] && return 1
52 niro 423 fi
53    
54     # exclude pcat/pname only
55 niro 1642 if [[ -n ${PCAT} ]] && [[ -n ${PNAME} ]] &&
56 niro 423 [[ -n ${EXPCAT} ]] && [[ -n ${EXPNAME} ]] &&
57     [[ -z ${EXPVER} ]] && [[ -z ${EXPBUILD} ]]
58     then
59 niro 1642 [[ ${EXPCAT}/${EXPNAME} = ${PCAT}/${PNAME} ]] && return 1
60 niro 423 fi
61     done << EOF
62     $(cat ${EXCLUDED}; echo)
63     EOF
64     return 0
65     }
66    
67     ALLSMAGES=$(grep -irl ${DISTRI} ${SMAGESCRIPTSDIR}/*/*.smage2)
68    
69     for smage in ${ALLSMAGES}
70     do
71     # continue if pkg already exists
72     [[ -f ${PKGDIR}/sources/$(basename ${smage} .smage2).mpks ]] && continue
73     # continue if a virtual pkg
74     [[ -n $(grep -irl 'PKGTYPE="virtual"' ${smage}) ]] && continue
75     [[ -n $(grep -irl 'PKGTYPE=virtual' ${smage}) ]] && continue
76     # handle blacklisted packages
77     blacklisted ${smage} || continue
78    
79     smage2 --create-src-tarball ${smage}
80     done