diff --git a/README.MD b/README.MD index c3c65f9..4ecd8f6 100644 --- a/README.MD +++ b/README.MD @@ -9,7 +9,7 @@ To create deb file you just need to run the bellow command : ```bash . joplin-server2deb -debmake_runAllStep +debmaker_runAllStep ``` ### packages available in shared repository diff --git a/lib/function.sh b/lib/function.sh index 443bb88..c8fe4b6 100644 --- a/lib/function.sh +++ b/lib/function.sh @@ -1,4 +1,5 @@ #!/bin/bash +DEBOOTSTRAP_DIR=cache/debootstrap/ source ressources/${APP}/${APP} CACHE_APP=cache/${APP}/ MOUNT_APP=/mnt/debmaker/${APP}/ @@ -6,6 +7,18 @@ MOUNT_APP=/mnt/debmaker/${APP}/ [ -d ${CACHE_APP} ] || mkdir -p ${CACHE_APP} ########################## 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(){ CURRENT_STEP=$1 RESULT=0 @@ -47,7 +60,7 @@ previousStep(){ ########################## FUNCTION ########################## -debmake_mountStep(){ +debmaker_mountStep(){ CURRENT_STEP=$1 [ -d ${MOUNT_APP}/${CURRENT_STEP} ] || sudo mkdir -p ${MOUNT_APP}/${CURRENT_STEP} sudo mount ${CACHE_APP}/${CURRENT_STEP} ${MOUNT_APP}/${CURRENT_STEP} @@ -58,14 +71,14 @@ debmake_mountStep(){ sleep 2 } -debmake_umountStep(){ +debmaker_umountStep(){ CURRENT_STEP=$1 sudo umount ${MOUNT_APP}/${CURRENT_STEP}/sys sudo umount ${MOUNT_APP}/${CURRENT_STEP}/proc sudo umount ${MOUNT_APP}/${CURRENT_STEP} } -debmake_chrootStep(){ +debmaker_chrootStep(){ CURRENT_STEP=$1 debmake_mountStep ${CURRENT_STEP} [ -d ${MOUNT_APP}/${CURRENT_STEP}/tmp/dist/${APP} ] && sudo rm -rf ${MOUNT_APP}/${CURRENT_STEP}/tmp/dist/ @@ -80,16 +93,16 @@ debmake_chrootStep(){ ########################## FUNCTION ########################## -debmake_runStepOS() { +debmaker_runStepOS() { CURRENT_STEP=os getSizeImage createImage 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_runStepCustom() { +debmaker_runStepCustom() { CURRENT_STEP=$1 valideStep ${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_runAllStep(){ +debmaker_runAllStep(){ debmake_runStepOS for tmp in ${STEP} do debmake_runStepCustom $tmp done } + +zdebmaker_getDep +