116 lines
2.2 KiB
Bash
116 lines
2.2 KiB
Bash
#!/bin/bash
|
|
CACHE_APP=cache/${APP}/
|
|
CACHE_STEP1=cache/${DEBIAN_VERSION_CODENAME}
|
|
CACHE_STEP2=cache/${APP}/envinit
|
|
CACHE_STEP3=cache/${APP}/prebuild
|
|
CACHE_STEP4=cache/${APP}/build
|
|
|
|
#DownloadOs
|
|
step1() {
|
|
if [ ! -e ${CACHE_STEP1} ]
|
|
then
|
|
mkdir -p ${CACHE_STEP1}/proc
|
|
mount -t proc proc ${CACHE_STEP1}/proc
|
|
sleep 2
|
|
debootstrap ${DEBIAN_VERSION_CODENAME} ${CACHE_STEP1}
|
|
umount ${CACHE_STEP1}/proc
|
|
fi
|
|
}
|
|
|
|
#InstallOs
|
|
step2(){
|
|
if [ -e ressources/${APP}/envinit ]; then
|
|
if [ ! -e ${CACHE_STEP2} ] ; then
|
|
mkdir -p ${CACHE_APP}
|
|
cp -a ${CACHE_STEP1}/ ${CACHE_STEP2}
|
|
cp ressources/${APP}/envinit ${CACHE_STEP2}/tmp/envinit
|
|
mount -t proc proc ${CACHE_STEP2}/proc
|
|
sleep 2
|
|
chroot ${CACHE_STEP2} /tmp/envinit
|
|
umount ${CACHE_STEP2}/proc
|
|
rm ${CACHE_STEP2}/tmp/envinit
|
|
fi
|
|
fi
|
|
}
|
|
|
|
#ConfigureBeforeBuild
|
|
step3(){
|
|
if [ -e ressources/${APP}/prebuild ]; then
|
|
if [ ! -e ${CACHE_STEP3} ]; then
|
|
cp -a ${CACHE_STEP2} ${CACHE_STEP3}
|
|
cp ressources/${APP}/prebuild ${CACHE_STEP3}/tmp/prebuild
|
|
chroot ${CACHE_STEP3} /tmp/prebuild ${GIT_VERSION}
|
|
rm ${CACHE_STEP3}/tmp/prebuild
|
|
fi
|
|
fi
|
|
}
|
|
|
|
#Build
|
|
step4(){
|
|
if [ -e ressources/${APP}/build ]; then
|
|
if [ ! -e ${CACHE_STEP4} ] ; then
|
|
cp -a ${CACHE_STEP3} ${CACHE_STEP4}
|
|
cp ressources/${APP}/build ${CACHE_STEP4}/tmp/build
|
|
mount -t proc proc ${CACHE_STEP4}/proc/
|
|
sleep 2
|
|
chroot ${CACHE_STEP4} /tmp/build
|
|
umount ${CACHE_STEP4}/proc/
|
|
fi
|
|
fi
|
|
}
|
|
|
|
#PackageDeb
|
|
step5(){
|
|
rm -fr dist/${APP}
|
|
mkdir dist/${APP}
|
|
cp -fr ressources/${APP}/rootfs/* dist/$APP/
|
|
bash ressources/${APP}/makedeb ${CACHE_STEP4} dist/${APP} ${GIT_VERSION}
|
|
sed -i "s/%VERSION%/$DEB_VERSION/" dist/${APP}/DEBIAN/control
|
|
fakeroot dpkg-deb -Z gzip --build dist/${APP} dist
|
|
rm -fr dist/${APP}
|
|
}
|
|
|
|
allstep(){
|
|
step1
|
|
step2
|
|
step3
|
|
step4
|
|
step5
|
|
}
|
|
|
|
StartFromStep1(){
|
|
rm -fr ${CACHE_STEP1} ${CACHE_STEP2} ${CACHE_STEP3} ${CACHE_STEP4}
|
|
allstep
|
|
}
|
|
|
|
StartFromStep2(){
|
|
rm -fr ${CACHE_STEP2} ${CACHE_STEP3} ${CACHE_STEP4}
|
|
allstep
|
|
}
|
|
|
|
StartFromStep3(){
|
|
rm -fr ${CACHE_STEP3} ${CACHE_STEP4}
|
|
allstep
|
|
}
|
|
|
|
StartFromStep4(){
|
|
rm -fr ${CACHE_STEP4}
|
|
allstep
|
|
}
|
|
|
|
GotoStep1(){
|
|
chroot ${CACHE_STEP1}
|
|
}
|
|
|
|
GotoStep2(){
|
|
chroot ${CACHE_STEP2}
|
|
}
|
|
|
|
GotoStep3(){
|
|
chroot ${CACHE_STEP3}
|
|
}
|
|
|
|
GotoStep4(){
|
|
chroot ${CACHE_STEP4}
|
|
}
|