3 |
source /usr/lib/mage/mage4.functions.sh |
source /usr/lib/mage/mage4.functions.sh |
4 |
|
|
5 |
SMAGEFILE="$1" |
SMAGEFILE="$1" |
6 |
|
if [[ -z ${SMAGEFILE} ]] |
7 |
|
then |
8 |
|
echo "No smagefile given." |
9 |
|
exit 1 |
10 |
|
fi |
11 |
[[ -n $2 ]] && [[ $2 != -st ]] && CVS_COMMIT="$2" |
[[ -n $2 ]] && [[ $2 != -st ]] && CVS_COMMIT="$2" |
12 |
if [[ $3 = -st ]] || [[ $2 = -st ]] |
if [[ $3 = -st ]] || [[ $2 = -st ]] |
13 |
then |
then |
15 |
USE_SRCTARBALL=true |
USE_SRCTARBALL=true |
16 |
fi |
fi |
17 |
|
|
18 |
CURARCH=i686 |
#CURARCH=i686 |
19 |
#CURARCH=x86_64 |
CURARCH=x86_64 |
20 |
|
|
21 |
|
BUILDROOT=/mnt/BUILDROOT-${CURARCH} |
22 |
|
#BUILDROOT=/mnt/BUILDROOT |
23 |
|
|
24 |
SMAGEDIR=$(dirname ${SMAGEFILE}) |
SMAGEDIR=$(dirname ${SMAGEFILE}) |
25 |
MD5DIR=${SMAGEDIR}/md5 |
MD5DIR=${SMAGEDIR}/md5 |
51 |
} |
} |
52 |
|
|
53 |
CURPCATEGORIE=$(get_value_from_file PCATEGORIE ${SMAGEFILE}) |
CURPCATEGORIE=$(get_value_from_file PCATEGORIE ${SMAGEFILE}) |
54 |
INSTALLDB_BUILDROOT=$(get_value_from_file INSTALLDB /mnt/BUILDROOT/etc/mage.rc) |
INSTALLDB_BUILDROOT=$(get_value_from_file INSTALLDB ${BUILDROOT}/etc/mage.rc) |
55 |
|
|
56 |
if [[ -d /mnt/BUILDROOT/${INSTALLDB_BUILDROOT}/${CURPCATEGORIE}/${CURPNAME}-${CURPVER}-${CURPBUILD} ]] |
if [[ -d ${BUILDROOT}/${INSTALLDB_BUILDROOT}/${CURPCATEGORIE}/${CURPNAME}-${CURPVER}-${CURPBUILD} ]] |
57 |
then |
then |
58 |
echo "Package '${CURPCATEGORIE}/${CURPNAME}-${CURPVER}-${CURPBUILD}' already installed in /mnt/BUILDROOT. Aborting!" |
echo "Package '${CURPCATEGORIE}/${CURPNAME}-${CURPVER}-${CURPBUILD}' already installed in ${BUILDROOT}. Aborting!" |
59 |
exit 1 |
exit 1 |
60 |
fi |
fi |
61 |
|
|
78 |
fi |
fi |
79 |
|
|
80 |
sudo -s << EOF |
sudo -s << EOF |
81 |
:> /mnt/BUILDROOT/.installrc |
:> ${BUILDROOT}/.installrc |
82 |
|
|
83 |
echo "CURPNAME=${CURPNAME}" >> /mnt/BUILDROOT/.installrc |
echo "CURPNAME=${CURPNAME}" >> ${BUILDROOT}/.installrc |
84 |
echo "CURPVER=${CURPVER}" >> /mnt/BUILDROOT/.installrc |
echo "CURPVER=${CURPVER}" >> ${BUILDROOT}/.installrc |
85 |
echo "CURPBUILD=${CURPBUILD}" >> /mnt/BUILDROOT/.installrc |
echo "CURPBUILD=${CURPBUILD}" >> ${BUILDROOT}/.installrc |
86 |
echo "CURARCH=${CURARCH}" >> /mnt/BUILDROOT/.installrc |
echo "CURARCH=${CURARCH}" >> ${BUILDROOT}/.installrc |
87 |
echo "SMAGENAME=${SMAGENAME}" >> /mnt/BUILDROOT/.installrc |
echo "SMAGENAME=${SMAGENAME}" >> ${BUILDROOT}/.installrc |
88 |
echo "MD5NAME=${MD5NAME}" >> /mnt/BUILDROOT/.installrc |
echo "MD5NAME=${MD5NAME}" >> ${BUILDROOT}/.installrc |
89 |
echo "PKGNAME=${PKGNAME}" >> /mnt/BUILDROOT/.installrc |
echo "PKGNAME=${PKGNAME}" >> ${BUILDROOT}/.installrc |
90 |
echo "SPKGNAME=${SPKGNAME}" >> /mnt/BUILDROOT/.installrc |
echo "SPKGNAME=${SPKGNAME}" >> ${BUILDROOT}/.installrc |
91 |
echo '/usr/bin/whoami' >> /mnt/BUILDROOT/.installrc |
echo '/usr/bin/whoami' >> ${BUILDROOT}/.installrc |
92 |
echo 'source /etc/profile' >> /mnt/BUILDROOT/.installrc |
echo 'source /etc/profile' >> ${BUILDROOT}/.installrc |
93 |
#echo 'echo PATH=\${PATH};read' >> /mnt/BUILDROOT/.installrc |
#echo 'echo PATH=\${PATH};read' >> ${BUILDROOT}/.installrc |
94 |
echo 'cd /var/cache/mage/smage' >> /mnt/BUILDROOT/.installrc |
echo 'cd /var/cache/mage/smage' >> ${BUILDROOT}/.installrc |
95 |
echo 'cvs update include' >> /mnt/BUILDROOT/.installrc |
echo 'cvs update include' >> ${BUILDROOT}/.installrc |
96 |
echo 'cvs update -dPA ${CURPNAME}' >> /mnt/BUILDROOT/.installrc |
echo 'cvs update -dPA ${CURPNAME}' >> ${BUILDROOT}/.installrc |
97 |
echo 'USE_SRCTARBALL=${USE_SRCTARBALL}' >> /mnt/BUILDROOT/.installrc |
echo 'USE_SRCTARBALL=${USE_SRCTARBALL}' >> ${BUILDROOT}/.installrc |
98 |
echo 'if [[ \${USE_SRCTARBALL} != true ]];then ' >> /mnt/BUILDROOT/.installrc |
echo 'if [[ \${USE_SRCTARBALL} != true ]];then ' >> ${BUILDROOT}/.installrc |
99 |
echo '/sbin/smage2 /var/cache/mage/smage/${CURPNAME}/${SMAGENAME} || exit 1' >> /mnt/BUILDROOT/.installrc |
echo '/sbin/smage2 /var/cache/mage/smage/${CURPNAME}/${SMAGENAME} || exit 1' >> ${BUILDROOT}/.installrc |
100 |
echo 'else' >> /mnt/BUILDROOT/.installrc |
echo 'else' >> ${BUILDROOT}/.installrc |
101 |
echo 'echo "Fetching SRC_TARBALL"' >> /mnt/BUILDROOT/.installrc |
echo 'echo "Fetching SRC_TARBALL"' >> ${BUILDROOT}/.installrc |
102 |
echo 'pushd /var/tmp/magebuild > /dev/null' >> /mnt/BUILDROOT/.installrc |
echo 'pushd /var/tmp/magebuild > /dev/null' >> ${BUILDROOT}/.installrc |
103 |
echo "SRCTARBALL=${CURPNAME}-${CURPVER}-${CURPBUILD}.mpks" >> /mnt/BUILDROOT/.installrc |
echo "SRCTARBALL=${CURPNAME}-${CURPVER}-${CURPBUILD}.mpks" >> ${BUILDROOT}/.installrc |
104 |
echo "SRCTARBALL_URI=${SRCTARBALL_URI}" >> /mnt/BUILDROOT/.installrc |
echo "SRCTARBALL_URI=${SRCTARBALL_URI}" >> ${BUILDROOT}/.installrc |
105 |
echo '/usr/bin/wget -c \${SRCTARBALL_URI}/\${SRCTARBALL}' >> /mnt/BUILDROOT/.installrc |
echo '/usr/bin/wget -c \${SRCTARBALL_URI}/\${SRCTARBALL}' >> ${BUILDROOT}/.installrc |
106 |
echo '/sbin/smage2 -st \${SRCTARBALL}' >> /mnt/BUILDROOT/.installrc |
echo '/sbin/smage2 -st \${SRCTARBALL}' >> ${BUILDROOT}/.installrc |
107 |
echo '[[ -f \${SRCTARBALL} ]] && rm \${SRCTARBALL}' >> /mnt/BUILDROOT/.installrc |
echo '[[ -f \${SRCTARBALL} ]] && rm \${SRCTARBALL}' >> ${BUILDROOT}/.installrc |
108 |
echo 'popd > /dev/null' >> /mnt/BUILDROOT/.installrc |
echo 'popd > /dev/null' >> ${BUILDROOT}/.installrc |
109 |
echo 'fi' >> /mnt/BUILDROOT/.installrc |
echo 'fi' >> ${BUILDROOT}/.installrc |
110 |
echo '/sbin/mage install ${CURPNAME} || exit 1' >> /mnt/BUILDROOT/.installrc |
echo '/sbin/mage install ${CURPNAME} || exit 1' >> ${BUILDROOT}/.installrc |
111 |
echo 'mv /var/cache/mage/packages/${PKGNAME} /BUILDED' >> /mnt/BUILDROOT/.installrc |
echo 'mv /var/cache/mage/packages/${PKGNAME} /BUILDED' >> ${BUILDROOT}/.installrc |
112 |
echo 'mv /var/cache/mage/packages/sources/${SRCPKGNAME} /BUILDED/sources' >> /mnt/BUILDROOT/.installrc |
echo 'mv /var/cache/mage/packages/sources/${SRCPKGNAME} /BUILDED/sources' >> ${BUILDROOT}/.installrc |
113 |
echo 'rm -rf /var/cache/mage/sources/${CURPNAME}' >> /mnt/BUILDROOT/.installrc |
echo 'rm -rf /var/cache/mage/sources/${CURPNAME}' >> ${BUILDROOT}/.installrc |
114 |
EOF |
EOF |
115 |
|
|
116 |
sudo -H /sbin/chroot /mnt/BUILDROOT /bin/bash /.installrc |
sudo -H /sbin/chroot ${BUILDROOT} /bin/bash /.installrc |
117 |
sudo rm /mnt/BUILDROOT/.installrc |
sudo rm ${BUILDROOT}/.installrc |
118 |
|
|
119 |
if [[ -f /mnt/BUILDROOT/BUILDED/${PKGNAME} ]] |
if [[ -f ${BUILDROOT}/BUILDED/${PKGNAME} ]] |
120 |
then |
then |
121 |
scp /mnt/BUILDROOT/BUILDED/${PKGNAME} ${SSHLOGIN}/${CURARCH}/ |
scp ${BUILDROOT}/BUILDED/${PKGNAME} ${SSHLOGIN}/${CURARCH}/ |
122 |
else |
else |
123 |
echo "Error: /mnt/BUILDROOT/BUILDED/${PKGNAME} missing!" |
echo "Error: ${BUILDROOT}/BUILDED/${PKGNAME} missing!" |
124 |
exit 1 |
exit 1 |
125 |
fi |
fi |
126 |
|
|
127 |
if [[ -f /mnt/BUILDROOT/BUILDED/sources/${SRCPKGNAME} ]] |
if [[ -f ${BUILDROOT}/BUILDED/sources/${SRCPKGNAME} ]] |
128 |
then |
then |
129 |
scp /mnt/BUILDROOT/BUILDED/sources/${SRCPKGNAME} ${SSHLOGIN}/src/ |
scp ${BUILDROOT}/BUILDED/sources/${SRCPKGNAME} ${SSHLOGIN}/src/ |
130 |
else |
else |
131 |
echo "Error: /mnt/BUILDROOT/BUILDED/${SRCPKGNAME} missing!" |
echo "Error: ${BUILDROOT}/BUILDED/${SRCPKGNAME} missing!" |
132 |
exit 1 |
exit 1 |
133 |
fi |
fi |
134 |
|
|