13 |
CURARCH=i686 |
CURARCH=i686 |
14 |
#CURARCH=x86_64 |
#CURARCH=x86_64 |
15 |
|
|
16 |
|
BUILDROOT=/mnt/BUILDROOT |
17 |
|
|
18 |
SMAGEDIR=$(dirname ${SMAGEFILE}) |
SMAGEDIR=$(dirname ${SMAGEFILE}) |
19 |
MD5DIR=${SMAGEDIR}/md5 |
MD5DIR=${SMAGEDIR}/md5 |
20 |
MD5NAME=$(basename $1 .smage2).md5 |
MD5NAME=$(basename $1 .smage2).md5 |
45 |
} |
} |
46 |
|
|
47 |
CURPCATEGORIE=$(get_value_from_file PCATEGORIE ${SMAGEFILE}) |
CURPCATEGORIE=$(get_value_from_file PCATEGORIE ${SMAGEFILE}) |
48 |
INSTALLDB_BUILDROOT=$(get_value_from_file INSTALLDB /mnt/BUILDROOT/etc/mage.rc) |
INSTALLDB_BUILDROOT=$(get_value_from_file INSTALLDB ${BUILDROOT}/etc/mage.rc) |
49 |
|
|
50 |
if [[ -d /mnt/BUILDROOT/${INSTALLDB_BUILDROOT}/${CURPCATEGORIE}/${CURPNAME}-${CURPVER}-${CURPBUILD} ]] |
if [[ -d ${BUILDROOT}/${INSTALLDB_BUILDROOT}/${CURPCATEGORIE}/${CURPNAME}-${CURPVER}-${CURPBUILD} ]] |
51 |
then |
then |
52 |
echo "Package '${CURPCATEGORIE}/${CURPNAME}-${CURPVER}-${CURPBUILD}' already installed in /mnt/BUILDROOT. Aborting!" |
echo "Package '${CURPCATEGORIE}/${CURPNAME}-${CURPVER}-${CURPBUILD}' already installed in ${BUILDROOT}. Aborting!" |
53 |
exit 1 |
exit 1 |
54 |
fi |
fi |
55 |
|
|
72 |
fi |
fi |
73 |
|
|
74 |
sudo -s << EOF |
sudo -s << EOF |
75 |
:> /mnt/BUILDROOT/.installrc |
:> ${BUILDROOT}/.installrc |
76 |
|
|
77 |
echo "CURPNAME=${CURPNAME}" >> /mnt/BUILDROOT/.installrc |
echo "CURPNAME=${CURPNAME}" >> ${BUILDROOT}/.installrc |
78 |
echo "CURPVER=${CURPVER}" >> /mnt/BUILDROOT/.installrc |
echo "CURPVER=${CURPVER}" >> ${BUILDROOT}/.installrc |
79 |
echo "CURPBUILD=${CURPBUILD}" >> /mnt/BUILDROOT/.installrc |
echo "CURPBUILD=${CURPBUILD}" >> ${BUILDROOT}/.installrc |
80 |
echo "CURARCH=${CURARCH}" >> /mnt/BUILDROOT/.installrc |
echo "CURARCH=${CURARCH}" >> ${BUILDROOT}/.installrc |
81 |
echo "SMAGENAME=${SMAGENAME}" >> /mnt/BUILDROOT/.installrc |
echo "SMAGENAME=${SMAGENAME}" >> ${BUILDROOT}/.installrc |
82 |
echo "MD5NAME=${MD5NAME}" >> /mnt/BUILDROOT/.installrc |
echo "MD5NAME=${MD5NAME}" >> ${BUILDROOT}/.installrc |
83 |
echo "PKGNAME=${PKGNAME}" >> /mnt/BUILDROOT/.installrc |
echo "PKGNAME=${PKGNAME}" >> ${BUILDROOT}/.installrc |
84 |
echo "SPKGNAME=${SPKGNAME}" >> /mnt/BUILDROOT/.installrc |
echo "SPKGNAME=${SPKGNAME}" >> ${BUILDROOT}/.installrc |
85 |
echo '/usr/bin/whoami' >> /mnt/BUILDROOT/.installrc |
echo '/usr/bin/whoami' >> ${BUILDROOT}/.installrc |
86 |
echo 'source /etc/profile' >> /mnt/BUILDROOT/.installrc |
echo 'source /etc/profile' >> ${BUILDROOT}/.installrc |
87 |
#echo 'echo PATH=\${PATH};read' >> /mnt/BUILDROOT/.installrc |
#echo 'echo PATH=\${PATH};read' >> ${BUILDROOT}/.installrc |
88 |
echo 'cd /var/cache/mage/smage' >> /mnt/BUILDROOT/.installrc |
echo 'cd /var/cache/mage/smage' >> ${BUILDROOT}/.installrc |
89 |
echo 'cvs update include' >> /mnt/BUILDROOT/.installrc |
echo 'cvs update include' >> ${BUILDROOT}/.installrc |
90 |
echo 'cvs update -dPA ${CURPNAME}' >> /mnt/BUILDROOT/.installrc |
echo 'cvs update -dPA ${CURPNAME}' >> ${BUILDROOT}/.installrc |
91 |
echo 'USE_SRCTARBALL=${USE_SRCTARBALL}' >> /mnt/BUILDROOT/.installrc |
echo 'USE_SRCTARBALL=${USE_SRCTARBALL}' >> ${BUILDROOT}/.installrc |
92 |
echo 'if [[ \${USE_SRCTARBALL} != true ]];then ' >> /mnt/BUILDROOT/.installrc |
echo 'if [[ \${USE_SRCTARBALL} != true ]];then ' >> ${BUILDROOT}/.installrc |
93 |
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 |
94 |
echo 'else' >> /mnt/BUILDROOT/.installrc |
echo 'else' >> ${BUILDROOT}/.installrc |
95 |
echo 'echo "Fetching SRC_TARBALL"' >> /mnt/BUILDROOT/.installrc |
echo 'echo "Fetching SRC_TARBALL"' >> ${BUILDROOT}/.installrc |
96 |
echo 'pushd /var/tmp/magebuild > /dev/null' >> /mnt/BUILDROOT/.installrc |
echo 'pushd /var/tmp/magebuild > /dev/null' >> ${BUILDROOT}/.installrc |
97 |
echo "SRCTARBALL=${CURPNAME}-${CURPVER}-${CURPBUILD}.mpks" >> /mnt/BUILDROOT/.installrc |
echo "SRCTARBALL=${CURPNAME}-${CURPVER}-${CURPBUILD}.mpks" >> ${BUILDROOT}/.installrc |
98 |
echo "SRCTARBALL_URI=${SRCTARBALL_URI}" >> /mnt/BUILDROOT/.installrc |
echo "SRCTARBALL_URI=${SRCTARBALL_URI}" >> ${BUILDROOT}/.installrc |
99 |
echo '/usr/bin/wget -c \${SRCTARBALL_URI}/\${SRCTARBALL}' >> /mnt/BUILDROOT/.installrc |
echo '/usr/bin/wget -c \${SRCTARBALL_URI}/\${SRCTARBALL}' >> ${BUILDROOT}/.installrc |
100 |
echo '/sbin/smage2 -st \${SRCTARBALL}' >> /mnt/BUILDROOT/.installrc |
echo '/sbin/smage2 -st \${SRCTARBALL}' >> ${BUILDROOT}/.installrc |
101 |
echo '[[ -f \${SRCTARBALL} ]] && rm \${SRCTARBALL}' >> /mnt/BUILDROOT/.installrc |
echo '[[ -f \${SRCTARBALL} ]] && rm \${SRCTARBALL}' >> ${BUILDROOT}/.installrc |
102 |
echo 'popd > /dev/null' >> /mnt/BUILDROOT/.installrc |
echo 'popd > /dev/null' >> ${BUILDROOT}/.installrc |
103 |
echo 'fi' >> /mnt/BUILDROOT/.installrc |
echo 'fi' >> ${BUILDROOT}/.installrc |
104 |
echo '/sbin/mage install ${CURPNAME} || exit 1' >> /mnt/BUILDROOT/.installrc |
echo '/sbin/mage install ${CURPNAME} || exit 1' >> ${BUILDROOT}/.installrc |
105 |
echo 'mv /var/cache/mage/packages/${PKGNAME} /BUILDED' >> /mnt/BUILDROOT/.installrc |
echo 'mv /var/cache/mage/packages/${PKGNAME} /BUILDED' >> ${BUILDROOT}/.installrc |
106 |
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 |
107 |
echo 'rm -rf /var/cache/mage/sources/${CURPNAME}' >> /mnt/BUILDROOT/.installrc |
echo 'rm -rf /var/cache/mage/sources/${CURPNAME}' >> ${BUILDROOT}/.installrc |
108 |
EOF |
EOF |
109 |
|
|
110 |
sudo -H /sbin/chroot /mnt/BUILDROOT /bin/bash /.installrc |
sudo -H /sbin/chroot ${BUILDROOT} /bin/bash /.installrc |
111 |
sudo rm /mnt/BUILDROOT/.installrc |
sudo rm ${BUILDROOT}/.installrc |
112 |
|
|
113 |
if [[ -f /mnt/BUILDROOT/BUILDED/${PKGNAME} ]] |
if [[ -f ${BUILDROOT}/BUILDED/${PKGNAME} ]] |
114 |
then |
then |
115 |
scp /mnt/BUILDROOT/BUILDED/${PKGNAME} ${SSHLOGIN}/${CURARCH}/ |
scp ${BUILDROOT}/BUILDED/${PKGNAME} ${SSHLOGIN}/${CURARCH}/ |
116 |
else |
else |
117 |
echo "Error: /mnt/BUILDROOT/BUILDED/${PKGNAME} missing!" |
echo "Error: ${BUILDROOT}/BUILDED/${PKGNAME} missing!" |
118 |
exit 1 |
exit 1 |
119 |
fi |
fi |
120 |
|
|
121 |
if [[ -f /mnt/BUILDROOT/BUILDED/sources/${SRCPKGNAME} ]] |
if [[ -f ${BUILDROOT}/BUILDED/sources/${SRCPKGNAME} ]] |
122 |
then |
then |
123 |
scp /mnt/BUILDROOT/BUILDED/sources/${SRCPKGNAME} ${SSHLOGIN}/src/ |
scp ${BUILDROOT}/BUILDED/sources/${SRCPKGNAME} ${SSHLOGIN}/src/ |
124 |
else |
else |
125 |
echo "Error: /mnt/BUILDROOT/BUILDED/${SRCPKGNAME} missing!" |
echo "Error: ${BUILDROOT}/BUILDED/${SRCPKGNAME} missing!" |
126 |
exit 1 |
exit 1 |
127 |
fi |
fi |
128 |
|
|