diff --git a/README.MD b/README.MD index 4318b7c..91bb61e 100644 --- a/README.MD +++ b/README.MD @@ -1,5 +1,5 @@ ## DEBMAKER -The main goal of this repository is allow to create application from source without install all compilation utility directly on the main system. +The main goal of this repository is allow to create application from source without install compilation utility directly on the main system. All package are install in folder in chroot environnement with only one script. ### Requirement @@ -10,7 +10,7 @@ All package are install in folder in chroot environnement with only one script. ```bash . vaultwarden2deb -allstep +debmake_runAllStep ``` ### package are available without compilation diff --git a/element-web2deb b/element-web2deb index 431ec79..1906369 100755 --- a/element-web2deb +++ b/element-web2deb @@ -1,9 +1,9 @@ #!/bin/bash APP=element-web -VERSION=1.10.2 +VERSION=1.10.4 GIT_VERSION=v$VERSION -DEB_VERSION=$VERSION-2 +DEB_VERSION=$VERSION-1 DEBIAN_VERSION_CODENAME=bullseye source ./lib/function.sh diff --git a/gotify2deb b/gotify2deb index abd9b61..cf8166f 100755 --- a/gotify2deb +++ b/gotify2deb @@ -5,6 +5,7 @@ VERSION=2.1.4 GIT_VERSION=v$VERSION DEB_VERSION=$VERSION-1 DEBIAN_VERSION_CODENAME=bullseye +IMAGE_SIZE=4 source ./lib/function.sh diff --git a/lib/exec_in_chroot.sh b/lib/exec_in_chroot.sh new file mode 100755 index 0000000..8aa289c --- /dev/null +++ b/lib/exec_in_chroot.sh @@ -0,0 +1,9 @@ +#!/bin/bash +if [ ! "$1" == "" ]; +then + source /tmp/dist/$1 + shift + FUNC=$1 + shift + ${FUNC} $* +fi diff --git a/lib/function.sh b/lib/function.sh index 7f910d9..414fc56 100644 --- a/lib/function.sh +++ b/lib/function.sh @@ -1,133 +1,108 @@ #!/bin/bash +source ressources/${APP}/${APP} 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 +MOUNT_APP=/mnt/debmaker/${APP}/ -#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 +[ -d ${CACHE_APP} ] || mkdir -p ${CACHE_APP} + +########################## SUB FUNCTION ########################## +valideStep(){ + CURRENT_STEP=$1 + RESULT=0 + for tmp in ${STEP} + do + if [ $tmp == ${CURRENT_STEP} ] ; then + RESULT=1 + break + fi + done + if [ $RESULT -eq 0 ] + then + echo invalid step fi } -#InstallOs -step2(){ - if [ ! -e ${CACHE_STEP2} ] ; then - mkdir -p ${CACHE_APP} - cp -a ${CACHE_STEP1}/ ${CACHE_STEP2} - cp ressources/${APP}/${APP} ${CACHE_STEP2}/tmp/make - mount -t proc proc ${CACHE_STEP2}/proc - sleep 2 - chroot ${CACHE_STEP2} /tmp/make envinit - umount ${CACHE_STEP2}/proc - rm ${CACHE_STEP2}/tmp/${APP} - fi +getSizeImage(){ + [ "${IMAGE_SIZE}" == "" ] && IMAGE_SIZE=2 } -#ConfigureBeforeBuild -step3(){ - if [ ! -e ${CACHE_STEP3} ]; then - cp -a ${CACHE_STEP2} ${CACHE_STEP3} - cp ressources/${APP}/${APP} ${CACHE_STEP3}/tmp/make - chroot ${CACHE_STEP3} /tmp/make prebuild ${GIT_VERSION} - rm ${CACHE_STEP3}/tmp/make - fi +createImage(){ + dd if=/dev/zero of=${CACHE_APP}/os bs=1G count=${IMAGE_SIZE} + sudo mkfs.ext4 ${CACHE_APP}/os } -#Build -step4(){ - if [ ! -e ${CACHE_STEP4} ] ; then - cp -a ${CACHE_STEP3} ${CACHE_STEP4} - cp ressources/${APP}/${APP} ${CACHE_STEP4}/tmp/make - mount -t proc proc ${CACHE_STEP4}/proc/ - sleep 2 - chroot ${CACHE_STEP4} /tmp/make build - umount ${CACHE_STEP4}/proc/ - rm ${CACHE_STEP4}/tmp/make - fi +previousStep(){ + CURRENT_STEP=$1 + TMP_STEP=os; + for tmp in ${STEP} + do + PREV=${TMP_STEP} + TMP_STEP=$tmp + if [ $tmp == $CURRENT_STEP ] ; then + break + fi + done + echo $PREV } -#PackageDeb -step5(){ - rm -fr dist/${APP} - mkdir dist/${APP} - cp -pfr ressources/${APP}/rootfs/* dist/$APP/ - bash ressources/${APP}/${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} +########################## FUNCTION ########################## + +debmake_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} + [ -d ${MOUNT_APP}/${CURRENT_STEP}/proc ] || sudo mkdir -p ${MOUNT_APP}/${CURRENT_STEP}/proc + sudo mount -t proc proc ${MOUNT_APP}/${CURRENT_STEP}/proc + [ -d ${MOUNT_APP}/${CURRENT_STEP}/sys ] || sudo mkdir -p ${MOUNT_APP}/${CURRENT_STEP}/sys + sudo mount -t sysfs sys ${MOUNT_APP}/${CURRENT_STEP}/sys + sleep 2 } -allstep(){ - step1 - step2 - step3 - step4 - step5 +debmake_umountStep(){ + CURRENT_STEP=$1 + sudo umount ${MOUNT_APP}/${CURRENT_STEP}/sys + sudo umount ${MOUNT_APP}/${CURRENT_STEP}/proc + sudo umount ${MOUNT_APP}/${CURRENT_STEP} } -DeleteStep1(){ - rm -fr ${CACHE_STEP1} ${CACHE_STEP2} ${CACHE_STEP3} ${CACHE_STEP4} -} -DeleteStep2(){ - rm -fr ${CACHE_STEP2} ${CACHE_STEP3} ${CACHE_STEP4} -} -DeleteStep3(){ - rm -fr ${CACHE_STEP3} ${CACHE_STEP4} -} -DeleteStep4(){ - rm -fr ${CACHE_STEP4} +debmake_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/ + sudo mkdir -p ${MOUNT_APP}/${CURRENT_STEP}/tmp/dist + sudo cp -fr ressources/${APP}/* ${MOUNT_APP}/${CURRENT_STEP}/tmp/dist + sudo cp -fr lib/exec_in_chroot.sh ${MOUNT_APP}/${CURRENT_STEP}/tmp/dist + shift + sudo chroot ${MOUNT_APP}${CURRENT_STEP}/ $* + find ${MOUNT_APP}${CURRENT_STEP}/tmp/dist/ -name *.deb -exec cp {} dist/ \; + debmake_umountStep ${CURRENT_STEP} } -StartFromStep1(){ - DeleteStep1 - allstep +########################## FUNCTION ########################## + +debmake_runStepOS() { + CURRENT_STEP=os + getSizeImage + createImage + debmake_mountStep ${CURRENT_STEP} + sudo debootstrap ${DEBIAN_VERSION_CODENAME} ${MOUNT_APP}/os/ + debmake_umountStep ${CURRENT_STEP} } -StartFromStep2(){ - DeleteStep2 - allstep +debmake_runStepCustom() { + CURRENT_STEP=$1 + valideStep ${CURRENT_STEP} + PREVIOUS=$(previousStep ${CURRENT_STEP}) + echo -n copy PREVIOUS in $PREVIOUS ... + cp ${CACHE_APP}/${PREVIOUS} ${CACHE_APP}/${CURRENT_STEP} + echo ": OK" + debmake_chrootStep $1 /tmp/dist/exec_in_chroot.sh ${APP} ${CURRENT_STEP} ${GIT_VERSION} ${DEB_VERSION} } -StartFromStep3(){ - DeleteStep3 - allstep -} - -StartFromStep4(){ - DeleteStep4 - allstep -} - -GotoStep1(){ - chroot ${CACHE_STEP1} -} - -GotoStep2(){ - chroot ${CACHE_STEP2} -} - -GotoStep3(){ - chroot ${CACHE_STEP3} -} - -GotoStep4(){ - mount -t proc proc ${CACHE_STEP4}/proc/ - chroot ${CACHE_STEP4} - umount ${CACHE_STEP4}/proc/ -} - -Clean(){ - rm -fr cache/* -} - -CleanAll(){ - rm -fr cache/* +debmake_runAllStep(){ + debmake_runStepOS + for tmp in ${STEP} + do + debmake_runStepCustom $tmp + done } diff --git a/ressources/element-web/element-web b/ressources/element-web/element-web index 09eb636..a117364 100755 --- a/ressources/element-web/element-web +++ b/ressources/element-web/element-web @@ -1,5 +1,7 @@ #!/bin/bash +STEP="envinit prebuild build makedeb" + envinit() { apt install -y build-essential git python wget ca-certificates wget -qO - https://deb.nodesource.com/setup_16.x | bash @@ -24,14 +26,12 @@ build() { } makedeb(){ - PATH_BUILD=$1 - PATH_DEB=$2 - GIT_VERSION=$3 - - tar -zxf ${PATH_BUILD}/tmp/element-web/dist/element-${GIT_VERSION}-dirty.tar.gz --strip-components=1 -C ${PATH_DEB}/usr/lib/element-web/ - cp ${PATH_DEB}/usr/lib/element-web/config.sample.json ${PATH_DEB}/etc/element-web/config.json + GIT_VERSION=$1 + DEB_VERSION=$2 + PATH_DEB=/tmp/dist/rootfs + + tar -zxf /tmp/element-web/dist/element-${GIT_VERSION}-dirty.tar.gz --strip-components=1 -C ${PATH_DEB}/usr/lib/element-web/ + cp /tmp/element-web/config.sample.json ${PATH_DEB}/etc/element-web/config.json + sed -i "s/%VERSION%/$DEB_VERSION/" /tmp/dist/rootfs/DEBIAN/control + fakeroot dpkg-deb -Z gzip --build /tmp/dist/rootfs/ /tmp/dist/ } -echo $1 -FUNC=$1 -shift -${FUNC} $* diff --git a/ressources/gotify/gotify b/ressources/gotify/gotify index b3d373e..1e32d17 100755 --- a/ressources/gotify/gotify +++ b/ressources/gotify/gotify @@ -1,38 +1,40 @@ #!/bin/bash +STEP="envinit prebuild build makedeb" + envinit() { - apt install -y build-essential git wget ca-certificates + apt install -y build-essential git wget ca-certificates wget -qO - https://deb.nodesource.com/setup_16.x | bash wget -qO - https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor > /usr/share/keyrings/yarnkey.gpg echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" > /etc/apt/sources.list.d/yarn.list apt-get update apt-get install -y nodejs yarn - wget -qO - https://go.dev/dl/go1.17.6.linux-amd64.tar.gz | tar -C /usr/local -xz + wget -qO - https://go.dev/dl/go1.17.7.linux-amd64.tar.gz | tar -C /usr/local -xz } prebuild(){ - VERSION=$1 - cd /tmp/ - git clone https://github.com/gotify/server.git - cd server/ - git checkout ${VERSION} + GIT_VERSION=$1 + git clone https://github.com/gotify/server.git /tmp/server + cd /tmp/server/ + git checkout ${GIT_VERSION} } build() { cd /tmp/server/ - . /root/.bashrc - PATH=${PATH}:/usr/local/go/bin make + PATH=${PATH}:/usr/local/go/bin + export GO111MODULE=on + make download-tools + go get -d + (cd ui && yarn && yarn build) + go run hack/packr/packr.go + go build -ldflags="$LD_FLAGS" -o gotify-server } makedeb(){ - PATH_BUILD=$1 - PATH_DEB=$2 - GIT_VERSION=$3 - - cp ${PATH_BUILD}/tmp/gotify/dist/gotify ${PATH_DEB}/usr/bin/gotify - cp ${PATH_BUILD}/tmp/authelia/config.template.yml ${PATH_DEB}/etc/authelia/configuration.yml + GIT_VERSION=$1 + DEB_VERSION=$2 + cp /tmp/server/gotify-server /tmp/dist/rootfs/usr/bin/gotify-server + cp /tmp/server/config.example.yml /tmp/dist/rootfs/etc/gotify/config.yml + sed -i "s/%VERSION%/$DEB_VERSION/" /tmp/dist/rootfs/DEBIAN/control + fakeroot dpkg-deb -Z gzip --build /tmp/dist/rootfs/ /tmp/dist/ } -echo $1 -FUNC=$1 -shift -${FUNC} $* diff --git a/ressources/gotify/rootfs/DEBIAN/conffiles b/ressources/gotify/rootfs/DEBIAN/conffiles index 2bde2fd..040c32f 100644 --- a/ressources/gotify/rootfs/DEBIAN/conffiles +++ b/ressources/gotify/rootfs/DEBIAN/conffiles @@ -1 +1 @@ -/etc/authelia/configuration.yml +/etc/gotify/config.yml diff --git a/ressources/gotify/rootfs/DEBIAN/postinst b/ressources/gotify/rootfs/DEBIAN/postinst index 7783fc1..0f623ab 100755 --- a/ressources/gotify/rootfs/DEBIAN/postinst +++ b/ressources/gotify/rootfs/DEBIAN/postinst @@ -1,4 +1,4 @@ #!/bin/bash -id authelia &> /dev/null || useradd authelia -r -s /bin/false +id gotify &> /dev/null || useradd gotify -r -s /bin/false diff --git a/ressources/grocy/grocy b/ressources/grocy/grocy index 3f983b9..0b945f8 100755 --- a/ressources/grocy/grocy +++ b/ressources/grocy/grocy @@ -1,5 +1,7 @@ #!/bin/bash +STEP="envinit prebuild build makedeb" + envinit() { apt-get install -y wget ca-certificates gnupg2 composer git php-simplexml php-gd wget -qO - https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor > /usr/share/keyrings/yarnkey.gpg @@ -23,18 +25,17 @@ build() { } makedeb(){ - PATH_BUILD=$1 - PATH_DEB=$2 - GIT_VERSION=$3 + GIT_VERSION=$1 + DEB_VERSION=$2 + PATH_DEB=/tmp/dist/rootfs - find ${PATH_BUILD}/tmp/grocy -name .gitignore -exec rm {} \; - cp -fr ${PATH_BUILD}/tmp/grocy/* ${PATH_DEB}/usr/share/grocy/ + find /tmp/grocy -name .gitignore -exec rm {} \; + cp -fr /tmp/grocy/* ${PATH_DEB}/usr/share/grocy/ cp ${PATH_DEB}/usr/share/grocy/config-dist.php ${PATH_DEB}/etc/grocy/config.php mv ${PATH_DEB}/usr/share/grocy/data ${PATH_DEB}/var/lib/grocy/ ln -s /var/lib/grocy/data/ ${PATH_DEB}/usr/share/grocy/data ln -s /etc/grocy/config.php ${PATH_DEB}/usr/share/grocy/config.php + sed -i "s/%VERSION%/$DEB_VERSION/" /tmp/dist/rootfs/DEBIAN/control + fakeroot dpkg-deb -Z gzip --build /tmp/dist/rootfs/ /tmp/dist/ } -echo $1 -FUNC=$1 -shift -${FUNC} $* + diff --git a/ressources/joplin-server/joplin-server b/ressources/joplin-server/joplin-server index 743a230..ea0c25b 100755 --- a/ressources/joplin-server/joplin-server +++ b/ressources/joplin-server/joplin-server @@ -1,5 +1,7 @@ #!/bin/bash +STEP="envinit prebuild build makedeb" + envinit() { apt install -y build-essential git python wget ca-certificates wget -qO - https://deb.nodesource.com/setup_16.x | bash @@ -27,13 +29,12 @@ build() { } makedeb(){ - PATH_BUILD=$1 - PATH_DEB=$2 - GIT_VERSION=$3 + GIT_VERSION=$1 + DEB_VERSION=$2 + PATH_DEB=/tmp/dist/rootfs - cp -fr ${PATH_BUILD}/tmp/joplin/packages/* ${PATH_DEB}/usr/lib/joplin-server/ + cp -fr /tmp/joplin/packages/* ${PATH_DEB}/usr/lib/joplin-server/ + sed -i "s/%VERSION%/$DEB_VERSION/" /tmp/dist/rootfs/DEBIAN/control + fakeroot dpkg-deb -Z gzip --build /tmp/dist/rootfs/ /tmp/dist/ } -echo $1 -FUNC=$1 -shift -${FUNC} $* + diff --git a/ressources/joplin/joplin b/ressources/joplin/joplin index d6b76d6..3d77e7c 100755 --- a/ressources/joplin/joplin +++ b/ressources/joplin/joplin @@ -1,26 +1,15 @@ #!/bin/bash -envinit() { - ls -} - -prebuild(){ - ls -} - -build() { - ls -} +STEP="makedeb" makedeb(){ - PATH_BUILD=$1 - PATH_DEB=$2 - GIT_VERSION=$3 + GIT_VERSION=$1 + DEB_VERSION=$2 + PATH_DEB=/tmp/dist/rootfs wget https://github.com/laurent22/joplin/releases/download/v${GIT_VERSION}/Joplin-${GIT_VERSION}.AppImage -qO ${PATH_DEB}/usr/share/joplin/Joplin.AppImage chmod +x ${PATH_DEB}/usr/share/joplin/Joplin.AppImage + sed -i "s/%VERSION%/$DEB_VERSION/" /tmp/dist/rootfs/DEBIAN/control + fakeroot dpkg-deb -Z gzip --build /tmp/dist/rootfs/ /tmp/dist/ } -echo $1 -FUNC=$1 -shift -${FUNC} $* + diff --git a/ressources/mautrix-whatsapp/mautrix-whatsapp b/ressources/mautrix-whatsapp/mautrix-whatsapp index d8512c4..0ee6241 100755 --- a/ressources/mautrix-whatsapp/mautrix-whatsapp +++ b/ressources/mautrix-whatsapp/mautrix-whatsapp @@ -1,8 +1,10 @@ #!/bin/bash +STEP="envinit prebuild build makedeb" + envinit() { apt install -y ca-certificates git libolm3 libolm-dev build-essential wget - wget -qO - https://go.dev/dl/go1.17.3.linux-amd64.tar.gz | tar -C /usr/local -xz + wget -qO - https://go.dev/dl/go1.17.7.linux-amd64.tar.gz | tar -C /usr/local -xz } prebuild(){ @@ -15,19 +17,16 @@ prebuild(){ build() { cd /tmp/whatsapp/ - git checkout $1 PATH=$PATH:/usr/local/go/bin ./build.sh } makedeb(){ - PATH_BUILD=$1 - PATH_DEB=$2 - GIT_VERSION=$3 + GIT_VERSION=$1 + DEB_VERSION=$2 + PATH_DEB=/tmp/dist/rootfs - cp ${PATH_BUILD}/tmp/whatsapp/mautrix-whatsapp ${PATH_DEB}/usr/lib/mautrix-whatsapp/mautrix-whatsapp - cp ${PATH_BUILD}/tmp/whatsapp/example-config.yaml ${PATH_DEB}/etc/mautrix-whatsapp/config.yaml + cp /tmp/whatsapp/mautrix-whatsapp ${PATH_DEB}/usr/lib/mautrix-whatsapp/mautrix-whatsapp + cp /tmp/whatsapp/example-config.yaml ${PATH_DEB}/etc/mautrix-whatsapp/config.yaml + sed -i "s/%VERSION%/$DEB_VERSION/" /tmp/dist/rootfs/DEBIAN/control + fakeroot dpkg-deb -Z gzip --build /tmp/dist/rootfs/ /tmp/dist/ } -echo $1 -FUNC=$1 -shift -${FUNC} $* diff --git a/ressources/rss-bridge/rss-bridge b/ressources/rss-bridge/rss-bridge index b55e97a..71a78c1 100755 --- a/ressources/rss-bridge/rss-bridge +++ b/ressources/rss-bridge/rss-bridge @@ -1,5 +1,7 @@ #!/bin/bash +STEP="envinit prebuild makedeb" + envinit() { apt install -y git } @@ -12,16 +14,12 @@ prebuild(){ git checkout $VERSION } -build() { - -} - makedeb(){ - PATH_BUILD=$1 - PATH_DEB=$2 - GIT_VERSION=$3 + GIT_VERSION=$1 + DEB_VERSION=$2 + PATH_DEB=/tmp/dist/rootfs - cp -fr ${PATH_BUILD}/tmp/rss-bridge ${PATH_DEB}/usr/share/ + cp -fr /tmp/rss-bridge ${PATH_DEB}/usr/share/ cp ${PATH_DEB}/usr/share/rss-bridge/config.default.ini.php ${PATH_DEB}/etc/rss-bridge/config.ini.php cp ${PATH_DEB}/usr/share/rss-bridge/whitelist.default.txt ${PATH_DEB}/etc/rss-bridge/whitelist.txt @@ -32,8 +30,7 @@ makedeb(){ mkdir -p ${PATH_DEB}/var/cache/rss-bridge/cache/ rm ${PATH_DEB}/usr/share/rss-bridge/cache ln -s /var/cache/rss-bridge/cache/ ${PATH_DEB}/usr/share/rss-bridge/cache + sed -i "s/%VERSION%/$DEB_VERSION/" /tmp/dist/rootfs/DEBIAN/control + fakeroot dpkg-deb -Z gzip --build /tmp/dist/rootfs/ /tmp/dist/ } -echo $1 -FUNC=$1 -shift -${FUNC} $* + diff --git a/ressources/vaultwarden-web/vaultwarden-web b/ressources/vaultwarden-web/vaultwarden-web index 0ceb1ba..9563983 100755 --- a/ressources/vaultwarden-web/vaultwarden-web +++ b/ressources/vaultwarden-web/vaultwarden-web @@ -1,5 +1,7 @@ #!/bin/bash +STEP="envinit prebuild build makedeb" + envinit() { apt install -y build-essential git python wget ca-certificates wget -qO - https://deb.nodesource.com/setup_16.x | bash @@ -37,13 +39,11 @@ build() { } makedeb(){ - PATH_BUILD=$1 - PATH_DEB=$2 - GIT_VERSION=$3 + GIT_VERSION=$1 + DEB_VERSION=$2 + PATH_DEB=/tmp/dist/rootfs - cp -fr ${PATH_BUILD}/tmp/web-vault/build/* ${PATH_DEB}/usr/share/vaultwarden-web + cp -fr /tmp/web-vault/build/* ${PATH_DEB}/usr/share/vaultwarden-web + sed -i "s/%VERSION%/$DEB_VERSION/" /tmp/dist/rootfs/DEBIAN/control + fakeroot dpkg-deb -Z gzip --build /tmp/dist/rootfs/ /tmp/dist/ } -echo $1 -FUNC=$1 -shift -${FUNC} $* diff --git a/ressources/vaultwarden/vaultwarden b/ressources/vaultwarden/vaultwarden index a23a9c3..687510e 100755 --- a/ressources/vaultwarden/vaultwarden +++ b/ressources/vaultwarden/vaultwarden @@ -1,5 +1,7 @@ #!/bin/bash +STEP="envinit prebuild build makedeb" + envinit() { apt install -y --no-install-recommends build-essential git wget ca-certificates libmariadb-dev libpq-dev pkg-config libmysql++-dev cd /tmp @@ -23,13 +25,11 @@ build() { } makedeb(){ - PATH_BUILD=$1 - PATH_DEB=$2 - GIT_VERSION=$3 + GIT_VERSION=$1 + DEB_VERSION=$2 + PATH_DEB=/tmp/dist/rootfs - cp -fr ${PATH_BUILD}/tmp/vaultwarden/target/release/vaultwarden ${PATH_DEB}/usr/lib/vaultwarden/ + cp -fr /tmp/vaultwarden/target/release/vaultwarden ${PATH_DEB}/usr/lib/vaultwarden/ + sed -i "s/%VERSION%/$DEB_VERSION/" /tmp/dist/rootfs/DEBIAN/control + fakeroot dpkg-deb -Z gzip --build /tmp/dist/rootfs/ /tmp/dist/ } -echo $1 -FUNC=$1 -shift -${FUNC} $* diff --git a/ressources/wallabag/wallabag b/ressources/wallabag/wallabag index e14f33b..42c6adb 100755 --- a/ressources/wallabag/wallabag +++ b/ressources/wallabag/wallabag @@ -1,5 +1,7 @@ #!/bin/bash +STEP="envinit prebuild build makedeb" + envinit() { apt-get install -y wget ca-certificates composer git php-common php-xml php-json php-gd php-mbstring php-xml php-tidy php-curl php-tokenizer php-bcmath php-intl php-fpm unzip } @@ -15,27 +17,24 @@ build() { } makedeb(){ - PATH_BUILD=$1 - PATH_DEB=$2 - GIT_VERSION=$3 + GIT_VERSION=$1 + DEB_VERSION=$2 + PATH_DEB=/tmp/dist/rootfs - cp -fr ${PATH_BUILD}/tmp/wallabag/app ${PATH_DEB}/usr/share/wallabag/app - cp -fr ${PATH_BUILD}/tmp/wallabag/src ${PATH_DEB}/usr/share/wallabag/src - cp -fr ${PATH_BUILD}/tmp/wallabag/vendor ${PATH_DEB}/usr/share/wallabag/vendor - cp -fr ${PATH_BUILD}/tmp/wallabag/web ${PATH_DEB}/usr/share/wallabag/web + cp -fr /tmp/wallabag/app ${PATH_DEB}/usr/share/wallabag/app + cp -fr /tmp/wallabag/src ${PATH_DEB}/usr/share/wallabag/src + cp -fr /tmp/wallabag/vendor ${PATH_DEB}/usr/share/wallabag/vendor + cp -fr /tmp/wallabag/web ${PATH_DEB}/usr/share/wallabag/web - cp -fr ${PATH_BUILD}/tmp/wallabag/data ${PATH_DEB}/var/lib/wallabag/data - cp -fr ${PATH_BUILD}/tmp/wallabag/var ${PATH_DEB}/var/lib/wallabag/var + cp -fr /tmp/wallabag/data ${PATH_DEB}/var/lib/wallabag/data + cp -fr /tmp/wallabag/var ${PATH_DEB}/var/lib/wallabag/var - cp ${PATH_BUILD}/tmp/wallabag/app/config/parameters.yml.dist ${PATH_DEB}/etc/wallabag/parameters.yml + cp /tmp/wallabag/app/config/parameters.yml.dist ${PATH_DEB}/etc/wallabag/parameters.yml ln -s /var/lib/wallabag/data ${PATH_DEB}/usr/share/wallabag/data ln -s /var/lib/wallabag/var ${PATH_DEB}/usr/share/wallabag/var ln -s /etc/wallabag/parameters.yml ${PATH_DEB}/usr/share/wallabag/app/config/parameters.yml + sed -i "s/%VERSION%/$DEB_VERSION/" /tmp/dist/rootfs/DEBIAN/control + fakeroot dpkg-deb -Z gzip --build /tmp/dist/rootfs/ /tmp/dist/ } - -echo $1 -FUNC=$1 -shift -${FUNC} $* diff --git a/ressources/zigbee2mqtt/zigbee2mqtt b/ressources/zigbee2mqtt/zigbee2mqtt index 2ad950c..7a4518d 100755 --- a/ressources/zigbee2mqtt/zigbee2mqtt +++ b/ressources/zigbee2mqtt/zigbee2mqtt @@ -1,5 +1,7 @@ #!/bin/bash +STEP="envinit prebuild build makedeb" + envinit() { apt install -y wget ca-certificates nodejs npm git make g++ gcc } @@ -19,15 +21,13 @@ build() { } makedeb(){ - PATH_BUILD=$1 - PATH_DEB=$2 - GIT_VERSION=$3 + GIT_VERSION=$1 + DEB_VERSION=$2 + PATH_DEB=/tmp/dist/rootfs - cp -fr ${PATH_BUILD}/tmp/zigbee2mqtt/data/configuration.yaml ${PATH_DEB}/etc/zigbee2mqtt/configuration.yaml - cp -fr ${PATH_BUILD}/tmp/zigbee2mqtt/* ${PATH_DEB}/usr/lib/zigbee2mqtt/ + cp -fr /tmp/zigbee2mqtt/data/configuration.yaml ${PATH_DEB}/etc/zigbee2mqtt/configuration.yaml + cp -fr /tmp/zigbee2mqtt/* ${PATH_DEB}/usr/lib/zigbee2mqtt/ + + sed -i "s/%VERSION%/$DEB_VERSION/" /tmp/dist/rootfs/DEBIAN/control + fakeroot dpkg-deb -Z gzip --build /tmp/dist/rootfs/ /tmp/dist/ } - -echo $1 -FUNC=$1 -shift -${FUNC} $*