Add debootstrap in cache file

This commit is contained in:
thomas 2022-02-23 21:25:03 +01:00
parent 30fc01c577
commit 9c0cb8c32f
2 changed files with 24 additions and 8 deletions

View File

@ -9,7 +9,7 @@ To create deb file you just need to run the bellow command :
```bash ```bash
. joplin-server2deb . joplin-server2deb
debmake_runAllStep debmaker_runAllStep
``` ```
### packages available in shared repository ### packages available in shared repository

View File

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
DEBOOTSTRAP_DIR=cache/debootstrap/
source ressources/${APP}/${APP} source ressources/${APP}/${APP}
CACHE_APP=cache/${APP}/ CACHE_APP=cache/${APP}/
MOUNT_APP=/mnt/debmaker/${APP}/ MOUNT_APP=/mnt/debmaker/${APP}/
@ -6,6 +7,18 @@ MOUNT_APP=/mnt/debmaker/${APP}/
[ -d ${CACHE_APP} ] || mkdir -p ${CACHE_APP} [ -d ${CACHE_APP} ] || mkdir -p ${CACHE_APP}
########################## SUB FUNCTION ########################## ########################## SUB FUNCTION ##########################
debmaker_debootstrapUpdate(){
[ -d ${DEBOOTSTRAP_DIR} ] || mkdir ${DEBOOTSTRAP_DIR}
URL=https://salsa.debian.org/installer-team/debootstrap/-/archive/master/debootstrap-master.tar.gz
FILES="debootstrap-master/debootstrap debootstrap-master/scripts/ debootstrap-master/functions"
wget -qO - ${URL} | tar -C ${DEBOOTSTRAP_DIR} --strip-components=1 -zx ${FILES}
}
zdebmaker_getDep(){
[ -d ${DEBOOTSTRAP_DIR} ] || debmaker_debootstrapUpdate
}
valideStep(){ valideStep(){
CURRENT_STEP=$1 CURRENT_STEP=$1
RESULT=0 RESULT=0
@ -47,7 +60,7 @@ previousStep(){
########################## FUNCTION ########################## ########################## FUNCTION ##########################
debmake_mountStep(){ debmaker_mountStep(){
CURRENT_STEP=$1 CURRENT_STEP=$1
[ -d ${MOUNT_APP}/${CURRENT_STEP} ] || sudo mkdir -p ${MOUNT_APP}/${CURRENT_STEP} [ -d ${MOUNT_APP}/${CURRENT_STEP} ] || sudo mkdir -p ${MOUNT_APP}/${CURRENT_STEP}
sudo mount ${CACHE_APP}/${CURRENT_STEP} ${MOUNT_APP}/${CURRENT_STEP} sudo mount ${CACHE_APP}/${CURRENT_STEP} ${MOUNT_APP}/${CURRENT_STEP}
@ -58,14 +71,14 @@ debmake_mountStep(){
sleep 2 sleep 2
} }
debmake_umountStep(){ debmaker_umountStep(){
CURRENT_STEP=$1 CURRENT_STEP=$1
sudo umount ${MOUNT_APP}/${CURRENT_STEP}/sys sudo umount ${MOUNT_APP}/${CURRENT_STEP}/sys
sudo umount ${MOUNT_APP}/${CURRENT_STEP}/proc sudo umount ${MOUNT_APP}/${CURRENT_STEP}/proc
sudo umount ${MOUNT_APP}/${CURRENT_STEP} sudo umount ${MOUNT_APP}/${CURRENT_STEP}
} }
debmake_chrootStep(){ debmaker_chrootStep(){
CURRENT_STEP=$1 CURRENT_STEP=$1
debmake_mountStep ${CURRENT_STEP} debmake_mountStep ${CURRENT_STEP}
[ -d ${MOUNT_APP}/${CURRENT_STEP}/tmp/dist/${APP} ] && sudo rm -rf ${MOUNT_APP}/${CURRENT_STEP}/tmp/dist/ [ -d ${MOUNT_APP}/${CURRENT_STEP}/tmp/dist/${APP} ] && sudo rm -rf ${MOUNT_APP}/${CURRENT_STEP}/tmp/dist/
@ -80,16 +93,16 @@ debmake_chrootStep(){
########################## FUNCTION ########################## ########################## FUNCTION ##########################
debmake_runStepOS() { debmaker_runStepOS() {
CURRENT_STEP=os CURRENT_STEP=os
getSizeImage getSizeImage
createImage createImage
debmake_mountStep ${CURRENT_STEP} debmake_mountStep ${CURRENT_STEP}
sudo debootstrap ${DEBIAN_VERSION_CODENAME} ${MOUNT_APP}/os/ sudo ${DEBOOTSTRAP_DIR}/debootstrap ${DEBIAN_VERSION_CODENAME} ${MOUNT_APP}/os/
debmake_umountStep ${CURRENT_STEP} debmake_umountStep ${CURRENT_STEP}
} }
debmake_runStepCustom() { debmaker_runStepCustom() {
CURRENT_STEP=$1 CURRENT_STEP=$1
valideStep ${CURRENT_STEP} valideStep ${CURRENT_STEP}
PREVIOUS=$(previousStep ${CURRENT_STEP}) PREVIOUS=$(previousStep ${CURRENT_STEP})
@ -99,10 +112,13 @@ debmake_runStepCustom() {
debmake_chrootStep $1 /tmp/dist/exec_in_chroot.sh ${APP} ${CURRENT_STEP} ${GIT_VERSION} ${DEB_VERSION} debmake_chrootStep $1 /tmp/dist/exec_in_chroot.sh ${APP} ${CURRENT_STEP} ${GIT_VERSION} ${DEB_VERSION}
} }
debmake_runAllStep(){ debmaker_runAllStep(){
debmake_runStepOS debmake_runStepOS
for tmp in ${STEP} for tmp in ${STEP}
do do
debmake_runStepCustom $tmp debmake_runStepCustom $tmp
done done
} }
zdebmaker_getDep