Contents of /trunk/pkgtools/add2cvs.sh
Parent Directory | Revision Log
Revision 718 -
(show annotations)
(download)
(as text)
Sun Apr 13 20:43:16 2008 UTC (16 years, 5 months ago) by niro
File MIME type: application/x-sh
File size: 4641 byte(s)
Sun Apr 13 20:43:16 2008 UTC (16 years, 5 months ago) by niro
File MIME type: application/x-sh
File size: 4641 byte(s)
-added ability to use src_tarballs
1 | #!/bin/bash |
2 | |
3 | source /usr/lib/mage/mage4.functions.sh |
4 | |
5 | SMAGEFILE="$1" |
6 | [[ -n $2 ]] && [[ $2 != -st ]] && CVS_COMMIT="$2" |
7 | if [[ $3 = -st ]] || [[ $2 = -st ]] |
8 | then |
9 | echo "Using SRCTARBALL ..." |
10 | USE_SRCTARBALL=true |
11 | fi |
12 | |
13 | CURARCH=i686 |
14 | #CURARCH=x86_64 |
15 | |
16 | SMAGEDIR=$(dirname ${SMAGEFILE}) |
17 | MD5DIR=${SMAGEDIR}/md5 |
18 | MD5NAME=$(basename $1 .smage2).md5 |
19 | SMAGENAME=$(basename $1) |
20 | CURPNAME=$(magename2pname $1) |
21 | CURPVER=$(magename2pver $1) |
22 | CURPBUILD=$(magename2pbuild $(basename $1 .smage2)) |
23 | PKGNAME=${CURPNAME}-${CURPVER}-${CURARCH}-${CURPBUILD}.mpk |
24 | SRCPKGNAME=${CURPNAME}-${CURPVER}-${CURPBUILD}.mpks |
25 | SSHLOGIN="tjoke@magellan-linux.de:/var/www/htdocs/magellan/magellan-dev/unstable/packages" |
26 | SRCTARBALL_URI="http://magellan-linux.de/magellan/magellan-dev/unstable/packages/src" |
27 | |
28 | # abort if the package is already installed in BUILDROOT |
29 | get_value_from_file() |
30 | { |
31 | local var="$1" |
32 | local file="$2" |
33 | local value |
34 | |
35 | # source /etc/mage.rc to get the includes right |
36 | source /etc/mage.rc.global |
37 | source /etc/mage.rc |
38 | |
39 | # evaluate the value |
40 | source ${file} $> /dev/null |
41 | eval value=\$$(echo ${var}) |
42 | echo "${value}" |
43 | } |
44 | |
45 | CURPCATEGORIE=$(get_value_from_file PCATEGORIE ${SMAGEFILE}) |
46 | INSTALLDB_BUILDROOT=$(get_value_from_file INSTALLDB /mnt/BUILDROOT/etc/mage.rc) |
47 | |
48 | if [[ -d /mnt/BUILDROOT/${INSTALLDB_BUILDROOT}/${CURPCATEGORIE}/${CURPNAME}-${CURPVER}-${CURPBUILD} ]] |
49 | then |
50 | echo "Package '${CURPCATEGORIE}/${CURPNAME}-${CURPVER}-${CURPBUILD}' already installed in /mnt/BUILDROOT. Aborting!" |
51 | exit 1 |
52 | fi |
53 | |
54 | # delete md5 if exist |
55 | [[ -f ${MD5DIR}/${MD5NAME} ]] && rm ${MD5DIR}/${MD5NAME} |
56 | |
57 | if [[ ${USE_SRCTARBALL} != true ]] |
58 | then |
59 | /sbin/smage2 download ${SMAGEFILE} |
60 | /sbin/smage2 calcmd5 ${SMAGEFILE} ${MD5DIR} |
61 | pushd ${SMAGEDIR}/../ |
62 | cvs add ${CURPNAME} |
63 | pushd ${SMAGEDIR} |
64 | cvs add md5 |
65 | cvs add ${SMAGENAME} md5/${MD5NAME} |
66 | |
67 | [[ -z ${CVS_COMMIT} ]] && CVS_COMMIT="auto added: ver bump to ${CURPVER}-${CURPBUILD}" |
68 | cvs commit -m "${CVS_COMMIT}" ${SMAGENAME} md5/${MD5NAME} |
69 | popd |
70 | fi |
71 | |
72 | sudo -s << EOF |
73 | :> /mnt/BUILDROOT/.installrc |
74 | |
75 | echo "CURPNAME=${CURPNAME}" >> /mnt/BUILDROOT/.installrc |
76 | echo "CURPVER=${CURPVER}" >> /mnt/BUILDROOT/.installrc |
77 | echo "CURPBUILD=${CURPBUILD}" >> /mnt/BUILDROOT/.installrc |
78 | echo "CURARCH=${CURARCH}" >> /mnt/BUILDROOT/.installrc |
79 | echo "SMAGENAME=${SMAGENAME}" >> /mnt/BUILDROOT/.installrc |
80 | echo "MD5NAME=${MD5NAME}" >> /mnt/BUILDROOT/.installrc |
81 | echo "PKGNAME=${PKGNAME}" >> /mnt/BUILDROOT/.installrc |
82 | echo "SPKGNAME=${SPKGNAME}" >> /mnt/BUILDROOT/.installrc |
83 | echo '/usr/bin/whoami' >> /mnt/BUILDROOT/.installrc |
84 | echo 'source /etc/profile' >> /mnt/BUILDROOT/.installrc |
85 | #echo 'echo PATH=\${PATH};read' >> /mnt/BUILDROOT/.installrc |
86 | echo 'cd /var/cache/mage/smage' >> /mnt/BUILDROOT/.installrc |
87 | echo 'cvs update include' >> /mnt/BUILDROOT/.installrc |
88 | echo 'cvs update -dPA ${CURPNAME}' >> /mnt/BUILDROOT/.installrc |
89 | echo 'USE_SRCTARBALL=${USE_SRCTARBALL}' >> /mnt/BUILDROOT/.installrc |
90 | echo 'if [[ \${USE_SRCTARBALL} != true ]];then ' >> /mnt/BUILDROOT/.installrc |
91 | echo '/sbin/smage2 /var/cache/mage/smage/${CURPNAME}/${SMAGENAME} || exit 1' >> /mnt/BUILDROOT/.installrc |
92 | echo 'else' >> /mnt/BUILDROOT/.installrc |
93 | echo 'echo "Fetching SRC_TARBALL"' >> /mnt/BUILDROOT/.installrc |
94 | echo 'pushd /var/tmp/magebuild > /dev/null' >> /mnt/BUILDROOT/.installrc |
95 | echo "SRCTARBALL=${CURPNAME}-${CURPVER}-${CURPBUILD}.mpks" >> /mnt/BUILDROOT/.installrc |
96 | echo "SRCTARBALL_URI=${SRCTARBALL_URI}" >> /mnt/BUILDROOT/.installrc |
97 | echo '/usr/bin/wget -c \${SRCTARBALL_URI}/\${SRCTARBALL}' >> /mnt/BUILDROOT/.installrc |
98 | echo '/sbin/smage2 -st \${SRCTARBALL}' >> /mnt/BUILDROOT/.installrc |
99 | echo '[[ -f \${SRCTARBALL} ]] && rm \${SRCTARBALL}' >> /mnt/BUILDROOT/.installrc |
100 | echo 'popd > /dev/null' >> /mnt/BUILDROOT/.installrc |
101 | echo 'fi' >> /mnt/BUILDROOT/.installrc |
102 | echo '/sbin/mage install ${CURPNAME} || exit 1' >> /mnt/BUILDROOT/.installrc |
103 | echo 'mv /var/cache/mage/packages/${PKGNAME} /BUILDED' >> /mnt/BUILDROOT/.installrc |
104 | echo 'mv /var/cache/mage/packages/sources/${SRCPKGNAME} /BUILDED/sources' >> /mnt/BUILDROOT/.installrc |
105 | echo 'rm -rf /var/cache/mage/sources/${CURPNAME}' >> /mnt/BUILDROOT/.installrc |
106 | EOF |
107 | |
108 | sudo -H /sbin/chroot /mnt/BUILDROOT /bin/bash /.installrc |
109 | sudo rm /mnt/BUILDROOT/.installrc |
110 | |
111 | if [[ -f /mnt/BUILDROOT/BUILDED/${PKGNAME} ]] |
112 | then |
113 | scp /mnt/BUILDROOT/BUILDED/${PKGNAME} ${SSHLOGIN}/${CURARCH}/ |
114 | else |
115 | echo "Error: /mnt/BUILDROOT/BUILDED/${PKGNAME} missing!" |
116 | exit 1 |
117 | fi |
118 | |
119 | if [[ -f /mnt/BUILDROOT/BUILDED/sources/${SRCPKGNAME} ]] |
120 | then |
121 | scp /mnt/BUILDROOT/BUILDED/sources/${SRCPKGNAME} ${SSHLOGIN}/src/ |
122 | else |
123 | echo "Error: /mnt/BUILDROOT/BUILDED/${SRCPKGNAME} missing!" |
124 | exit 1 |
125 | fi |
126 | |
127 | [[ -d /var/cache/mage/sources/${CURPNAME} ]] && rm -rf /var/cache/mage/sources/${CURPNAME} |
128 | |
129 |
Properties
Name | Value |
---|---|
svn:executable | * |